Created
February 16, 2018 03:10
-
-
Save nxmad/12a482c241b8020e5d09f62f9feaf85e to your computer and use it in GitHub Desktop.
LogirovatVremyaRegistraciiVOtdelnyObject
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use \Carbon\Carbon; | |
/* | |
* Usage eg.: | |
* protected function create(array $data) | |
* { | |
* (new SeparatedObject)->setRegisteredAt(Carbon::now()); | |
* | |
* return User::create([ | |
* 'name' => $data['name'], | |
* 'email' => $data['email'], | |
* 'password' => Hash::make($data['password']), | |
* ]); | |
* } | |
*/ | |
class SeparatedObject | |
{ | |
/** | |
* The time of registration. | |
* | |
* @var Carbon | |
*/ | |
protected $registered_at = null; | |
/** | |
* Set registration time. | |
* | |
* @param Carbon $dateTime | |
* | |
* @return void | |
*/ | |
public function setRegisteredAt(Carbon $dateTime) : void | |
{ | |
$this->registered_at = $dateTime; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment