for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Tinyissue package.
*
* (c) Mohamed Alsharaf <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tinyissue\Extensions\Auth;
use Tinyissue\Model\User;
/**
* @author Mohamed Alsharaf <[email protected]>
trait LoggedUser
{
* @var mixed
protected $loggedUser;
* Return instance of the logged user.
* @param mixed $user
* @return $this
public function setLoggedUser($user)
$this->loggedUser = $user;
return $this;
}
* @return User
public function getLoggedUser()
if (null === $this->loggedUser) {
$this->loggedUser = auth()->user();
if (!$this->loggedUser instanceof User) {
throw new \DomainException('Unable to find a valid instance of logged user.');
return $this->loggedUser;