2016-09-01 16:23:39 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
2016-09-11 07:19:11 +01:00
|
|
|
use App\User;
|
2016-09-01 16:23:39 +01:00
|
|
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
|
|
|
use Illuminate\Routing\Controller as BaseController;
|
|
|
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
|
|
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
2016-09-11 07:19:11 +01:00
|
|
|
use Illuminate\Support\Facades\Auth;
|
2016-09-01 16:23:39 +01:00
|
|
|
|
|
|
|
class Controller extends BaseController
|
|
|
|
{
|
|
|
|
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
2016-09-11 07:19:11 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets either the authenticated user, or a user object representing the anonymous user.
|
|
|
|
* @return User
|
|
|
|
*/
|
|
|
|
protected function getUser()
|
|
|
|
{
|
|
|
|
$user = Auth::user();
|
|
|
|
return (is_null($user)
|
|
|
|
? User::anonymous()
|
|
|
|
: $user);
|
|
|
|
}
|
2016-09-01 16:23:39 +01:00
|
|
|
}
|