1. Go to this page and download the library: Download agilesdesign/pseudo library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
Auth::check() // true if User false if Pseudo/Contracts/GuestContract
Auth::user() // returns instance of Pseudo/Contracts/GuestContract instead of null if no user found
@can() // no longer automatically fails if not authenticated, allows Gate to be checked
'guards' => [
// To use with web guard
'web' => [
'driver' => 'pseudo',
'provider' => 'users',
],
// To use with api guard
'api' => [
'driver' => 'pseudo-token',
'provider' => 'users',
],
],
public function register()
{
$this->app->bind(GuestContract::class, Guest::class);
}
class GuestUser extends User implements GuestContract
{
//You can override any attribute by using Eloquent Accessors
public function getNameAttribute(){
return 'Guest User';
}
}