Call to a member function givePermissionTo() on null
PHP Snippet 1:
Auth::user()->givePermissionTo('edit articles');
PHP Snippet 2:
public function __construct()
{
$this->middleware('auth');
}
PHP Snippet 3:
Auth::user()->givePermissionTo('edit articles');
PHP Snippet 4:
$user = Auth::user();
$user->givePermissionTo('edit articles);