VedantInfoWays/ November 15, 2018/ Laravel/ 0 comments
- Guest User Gates
In Laravel 5.6 and below authorization gates and policies automatically return false
for unauthenticated users. New in Laravel 5.7, you can now allow guests to go through authorization checks by using a nullable type-hint or setting the default value as null:
<?php Gate::define(‘view-post’, function (?User $user) { });
- Testing Artisan Commands in Laravel 5.7
Laravel 5.7 is going to improve how you write Artisan console commands
public function test_console_command() { $this->artisan(‘laracon’) ->expectsQuestion(‘What is your name?’, ‘Taylor Otwell’) ->expectsQuestion(‘Which language do you program in?’, ‘PHP’) ->expectsOutput(‘Your name is Taylor Otwell and you program in PHP.’) ->assertExitCode(0); }