VedantInfoWays/ November 15, 2018/ Laravel/ 0 comments

  1. 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) { // Guests });
  2. 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); }
Share this Post

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>