Skip to content

Commit

Permalink
Merge branch 'laravel:11.x' into 11.x
Browse files Browse the repository at this point in the history
  • Loading branch information
toarupg0318 authored Oct 8, 2024
2 parents d470014 + bc5bd66 commit c7eeb7e
Show file tree
Hide file tree
Showing 52 changed files with 642 additions and 136 deletions.
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
# Release Notes for 11.x

## [Unreleased](https://github.com/laravel/framework/compare/v11.25.0...11.x)
## [Unreleased](https://github.com/laravel/framework/compare/v11.26.0...11.x)

## [v11.26.0](https://github.com/laravel/framework/compare/v11.25.0...v11.26.0) - 2024-10-01

* [11.x] Fix PHPDoc typo by [@LucaRed](https://github.com/LucaRed) in https://github.com/laravel/framework/pull/52960
* Add stop() method to Process and Pool by [@MiniCodeMonkey](https://github.com/MiniCodeMonkey) in https://github.com/laravel/framework/pull/52959
* [11.x] Improve PHPDoc by [@staudenmeir](https://github.com/staudenmeir) in https://github.com/laravel/framework/pull/52949
* [11.x] Fix crash of method PreventsCircularRecursion::withoutRecursion() on mocked models by [@maximetassy](https://github.com/maximetassy) in https://github.com/laravel/framework/pull/52943
* [11.x] Document callable types for `Enumerable::implode()` by [@devfrey](https://github.com/devfrey) in https://github.com/laravel/framework/pull/52937
* [11.x] Allows Unit & Backed Enums for registering named `RateLimiter` & `RateLimited` middleware by [@sethsandaru](https://github.com/sethsandaru) in https://github.com/laravel/framework/pull/52935
* [11.x] Test Improvements by [@crynobone](https://github.com/crynobone) in https://github.com/laravel/framework/pull/52933
* [11.x] Fixes trust proxy `REMOTE_ADDR` not working in Swoole by [@chuoke](https://github.com/chuoke) in https://github.com/laravel/framework/pull/52889
* [11.x] Fixes function loading conflicts when using `[@include](https://github.com/include)('vendor/autoload.php')` via Laravel Envoy by [@s-damian](https://github.com/s-damian) in https://github.com/laravel/framework/pull/52974
* [11.x] Support Laravel Prompts 0.3+ by [@crynobone](https://github.com/crynobone) in https://github.com/laravel/framework/pull/52993
* Allow mass assignment with mutators when using model::guarded by [@Apfelfrisch](https://github.com/Apfelfrisch) in https://github.com/laravel/framework/pull/52962
* [11.x] Add `make:job-middleware` artisan command by [@dshafik](https://github.com/dshafik) in https://github.com/laravel/framework/pull/52965
* [11.x] Auto discover Events outside app namespace when folder name is in kebab-case by [@xizprodev](https://github.com/xizprodev) in https://github.com/laravel/framework/pull/52976
* [11.x] Feat: factory generic in make:model command by [@MrPunyapal](https://github.com/MrPunyapal) in https://github.com/laravel/framework/pull/52855

## [v11.25.0](https://github.com/laravel/framework/compare/v11.24.1...v11.25.0) - 2024-09-26

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"fruitcake/php-cors": "^1.3",
"guzzlehttp/guzzle": "^7.8",
"guzzlehttp/uri-template": "^1.0",
"laravel/prompts": "^0.1.18|^0.2.0",
"laravel/prompts": "^0.1.18|^0.2.0|^0.3.0",
"laravel/serializable-closure": "^1.3",
"league/commonmark": "^2.2.1",
"league/flysystem": "^3.8.0",
Expand Down
8 changes: 5 additions & 3 deletions src/Illuminate/Cache/FileStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,11 @@ public function restoreLock($name, $owner)
public function forget($key)
{
if ($this->files->exists($file = $this->path($key))) {
$this->files->delete($this->path("illuminate:cache:flexible:created:{$key}"));

return $this->files->delete($file);
return tap($this->files->delete($file), function ($forgotten) use ($key) {
if ($forgotten && $this->files->exists($file = $this->path("illuminate:cache:flexible:created:{$key}"))) {
$this->files->delete($file);
}
});
}

return false;
Expand Down
12 changes: 4 additions & 8 deletions src/Illuminate/Cache/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,9 @@ public function missing($key)
/**
* Retrieve an item from the cache by key.
*
* @template TCacheValue
*
* @param array|string $key
* @param TCacheValue|(\Closure(): TCacheValue) $default
* @return (TCacheValue is null ? mixed : TCacheValue)
* @param mixed $default
* @return mixed
*/
public function get($key, $default = null): mixed
{
Expand Down Expand Up @@ -198,11 +196,9 @@ protected function handleManyResult($keys, $key, $value)
/**
* Retrieve an item from the cache and delete it.
*
* @template TCacheValue
*
* @param array|string $key
* @param TCacheValue|(\Closure(): TCacheValue) $default
* @return (TCacheValue is null ? mixed : TCacheValue)
* @param mixed $default
* @return mixed
*/
public function pull($key, $default = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ public function isGuarded($key)
*/
protected function isGuardableColumn($key)
{
if ($this->hasSetMutator($key) || $this->hasAttributeSetMutator($key)) {
return true;
}

if (! isset(static::$guardableColumns[get_class($this)])) {
$columns = $this->getConnection()
->getSchemaBuilder()
Expand All @@ -222,6 +226,7 @@ protected function isGuardableColumn($key)
if (empty($columns)) {
return true;
}

static::$guardableColumns[get_class($this)] = $columns;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1620,7 +1620,7 @@ public function getCasts()
/**
* Get the attributes that should be cast.
*
* @return array
* @return array<string, string>
*/
protected function casts()
{
Expand Down
3 changes: 1 addition & 2 deletions src/Illuminate/Database/Schema/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ public function hasTable($table)
{
$table = $this->connection->getTablePrefix().$table;

/** @phpstan-ignore arguments.count (SQLite accepts a withSize argument) */
foreach ($this->getTables(false) as $value) {
foreach ($this->getTables() as $value) {
if (strtolower($table) === strtolower($value['name'])) {
return true;
}
Expand Down
17 changes: 17 additions & 0 deletions src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,23 @@ public function compileDropDatabaseIfExists($name)
);
}

/**
* Compile the query to determine if the given table exists.
*
* @param string $database
* @param string $table
* @return string
*/
public function compileTableExists($database, $table)
{
return sprintf(
'select exists (select 1 from information_schema.tables where '
."table_schema = %s and table_name = %s and table_type in ('BASE TABLE', 'SYSTEM VERSIONED')) as `exists`",
$this->quoteString($database),
$this->quoteString($table)
);
}

/**
* Compile the query to determine the tables.
*
Expand Down
17 changes: 17 additions & 0 deletions src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,23 @@ public function compileDropDatabaseIfExists($name)
);
}

/**
* Compile the query to determine if the given table exists.
*
* @param string $schema
* @param string $table
* @return string
*/
public function compileTableExists($schema, $table)
{
return sprintf(
'select exists (select 1 from pg_class c, pg_namespace n where '
."n.nspname = %s and c.relname = %s and c.relkind in ('r', 'p') and n.oid = c.relnamespace)",
$this->quoteString($schema),
$this->quoteString($table)
);
}

/**
* Compile the query to determine the tables.
*
Expand Down
14 changes: 14 additions & 0 deletions src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ public function compileDbstatExists()
return "select exists (select 1 from pragma_compile_options where compile_options = 'ENABLE_DBSTAT_VTAB') as enabled";
}

/**
* Compile the query to determine if the given table exists.
*
* @param string $table
* @return string
*/
public function compileTableExists($table)
{
return sprintf(
'select exists (select 1 from sqlite_master where name = %s and type = \'table\') as "exists"',
$this->quoteString(str_replace('.', '__', $table))
);
}

/**
* Compile the query to determine the tables.
*
Expand Down
15 changes: 15 additions & 0 deletions src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,21 @@ public function compileDropDatabaseIfExists($name)
);
}

/**
* Compile the query to determine if the given table exists.
*
* @param string|null $schema
* @param string $table
* @return string
*/
public function compileTableExists($schema, $table)
{
return sprintf(
'select (case when object_id(%s, \'U\') is null then 0 else 1 end) as [exists]',
$this->quoteString($schema ? $schema.'.'.$table : $table)
);
}

/**
* Compile the query to determine the tables.
*
Expand Down
17 changes: 17 additions & 0 deletions src/Illuminate/Database/Schema/MySqlBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,23 @@ public function dropDatabaseIfExists($name)
);
}

/**
* Determine if the given table exists.
*
* @param string $table
* @return bool
*/
public function hasTable($table)
{
$table = $this->connection->getTablePrefix().$table;

$database = $this->connection->getDatabaseName();

return (bool) $this->connection->scalar(
$this->grammar->compileTableExists($database, $table)
);
}

/**
* Get the tables for the database.
*
Expand Down
11 changes: 3 additions & 8 deletions src/Illuminate/Database/Schema/PostgresBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,9 @@ public function hasTable($table)

$table = $this->connection->getTablePrefix().$table;

foreach ($this->getTables() as $value) {
if (strtolower($table) === strtolower($value['name'])
&& strtolower($schema) === strtolower($value['schema'])) {
return true;
}
}

return false;
return (bool) $this->connection->scalar(
$this->grammar->compileTableExists($schema, $table)
);
}

/**
Expand Down
15 changes: 15 additions & 0 deletions src/Illuminate/Database/Schema/SQLiteBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ public function dropDatabaseIfExists($name)
: true;
}

/**
* Determine if the given table exists.
*
* @param string $table
* @return bool
*/
public function hasTable($table)
{
$table = $this->connection->getTablePrefix().$table;

return (bool) $this->connection->scalar(
$this->grammar->compileTableExists($table)
);
}

/**
* Get the tables for the database.
*
Expand Down
12 changes: 3 additions & 9 deletions src/Illuminate/Database/Schema/SqlServerBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,11 @@ public function hasTable($table)
{
[$schema, $table] = $this->parseSchemaAndTable($table);

$schema ??= $this->getDefaultSchema();
$table = $this->connection->getTablePrefix().$table;

foreach ($this->getTables() as $value) {
if (strtolower($table) === strtolower($value['name'])
&& strtolower($schema) === strtolower($value['schema'])) {
return true;
}
}

return false;
return (bool) $this->connection->scalar(
$this->grammar->compileTableExists($schema, $table)
);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Application extends Container implements ApplicationContract, CachesConfig
*
* @var string
*/
const VERSION = '11.25.0';
const VERSION = '11.26.0';

/**
* The base path for the Laravel installation.
Expand Down
7 changes: 4 additions & 3 deletions src/Illuminate/Foundation/Console/ApiInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Facades\Process;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Process\PhpExecutableFinder;

use function Illuminate\Support\php_binary;

#[AsCommand(name: 'install:api')]
class ApiInstallCommand extends Command
Expand Down Expand Up @@ -65,7 +66,7 @@ public function handle()

if ($this->option('passport')) {
Process::run(array_filter([
(new PhpExecutableFinder())->find(false) ?: 'php',
php_binary(),
defined('ARTISAN_BINARY') ? ARTISAN_BINARY : 'artisan',
'passport:install',
$this->confirm('Would you like to use UUIDs for all client IDs?') ? '--uuids' : null,
Expand Down Expand Up @@ -130,7 +131,7 @@ protected function installSanctum()

if (! $migrationPublished) {
Process::run([
(new PhpExecutableFinder())->find(false) ?: 'php',
php_binary(),
defined('ARTISAN_BINARY') ? ARTISAN_BINARY : 'artisan',
'vendor:publish',
'--provider',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Facades\Process;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Process\PhpExecutableFinder;

use function Illuminate\Support\php_binary;
use function Laravel\Prompts\confirm;

#[AsCommand(name: 'install:broadcasting')]
Expand Down Expand Up @@ -155,7 +155,7 @@ protected function installReverb()
]);

Process::run([
(new PhpExecutableFinder())->find(false) ?: 'php',
php_binary(),
defined('ARTISAN_BINARY') ? ARTISAN_BINARY : 'artisan',
'reverb:install',
]);
Expand Down
Loading

0 comments on commit c7eeb7e

Please sign in to comment.