Skip to content

Instantly share code, notes, and snippets.

@nxmad
Created February 16, 2018 03:10
Show Gist options
  • Save nxmad/12a482c241b8020e5d09f62f9feaf85e to your computer and use it in GitHub Desktop.
Save nxmad/12a482c241b8020e5d09f62f9feaf85e to your computer and use it in GitHub Desktop.
LogirovatVremyaRegistraciiVOtdelnyObject
<?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