Skip to content

Commit

Permalink
Merge branch '11.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
driesvints committed Mar 8, 2024
2 parents c85bd7a + bb80a3b commit fba12e1
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 4 deletions.
13 changes: 12 additions & 1 deletion src/Illuminate/Foundation/Configuration/Middleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ public function getMiddlewareGroups()
}

/**
* Configure where guests are redirected by the authentication middleware.
* Configure where guests are redirected by the "auth" middleware.
*
* @param callable|string $redirect
* @return $this
Expand All @@ -500,6 +500,17 @@ public function redirectGuestsTo(callable|string $redirect)
return $this->redirectTo(guests: $redirect);
}

/**
* Configure where users are redirected by the "guest" middleware.
*
* @param callable|string $redirect
* @return $this
*/
public function redirectUsersTo(callable|string $redirect)
{
return $this->redirectTo(users: $redirect);
}

/**
* Configure where users are redirected by the authentication and guest middleware.
*
Expand Down
9 changes: 6 additions & 3 deletions src/Illuminate/Foundation/Console/ApiInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class ApiInstallCommand extends Command
protected $signature = 'install:api
{--composer=global : Absolute path to the Composer binary which should be used to install packages}
{--force : Overwrite any existing API routes file}
{--passport : Install Laravel Passport instead of Laravel Sanctum}';
{--passport : Install Laravel Passport instead of Laravel Sanctum}
{--without-migration-prompt : Do not prompt to run pending migrations}';

/**
* The console command description.
Expand Down Expand Up @@ -69,8 +70,10 @@ public function handle()

$this->components->info('API scaffolding installed. Please add the [Laravel\Passport\HasApiTokens] trait to your User model.');
} else {
if ($this->confirm('One new database migration has been published. Would you like to run all pending database migrations?', false)) {
$this->call('migrate');
if (! $this->option('without-migration-prompt')) {
if ($this->confirm('One new database migration has been published. Would you like to run all pending database migrations?', true)) {
$this->call('migrate');
}
}

$this->components->info('API scaffolding installed. Please add the [Laravel\Sanctum\HasApiTokens] trait to your User model.');
Expand Down
33 changes: 33 additions & 0 deletions tests/Integration/Generators/ClassMakeCommandTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace Integration\Generators;

use Illuminate\Tests\Integration\Generators\TestCase;

class ClassMakeCommandTest extends TestCase
{
public function testItCanGenerateClassFile()
{
$this->artisan('make:class', ['name' => 'Reverb'])
->assertExitCode(0);

$this->assertFileContains([
'namespace App;',
'class Reverb',
'public function __construct()',
], 'app/Reverb.php');
}

public function testItCanGenerateInvokableClassFile()
{
$this->artisan('make:class', ['name' => 'Notification', '--invokable' => true])
->assertExitCode(0);

$this->assertFileContains([
'namespace App;',
'class Notification',
'public function __construct()',
'public function __invoke()',
], 'app/Notification.php');
}
}
19 changes: 19 additions & 0 deletions tests/Integration/Generators/InterfaceMakeCommandTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Integration\Generators;

use Illuminate\Tests\Integration\Generators\TestCase;

class InterfaceMakeCommandTest extends TestCase
{
public function testItCanGenerateEnumFile()
{
$this->artisan('make:interface', ['name' => 'Gateway'])
->assertExitCode(0);

$this->assertFileContains([
'namespace App;',
'interface Gateway',
], 'app/Gateway.php');
}
}

0 comments on commit fba12e1

Please sign in to comment.