Skip to content

Commit

Permalink
chore: fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiethorpe committed Nov 1, 2024
2 parents 7c44895 + 61e221c commit 02e0c01
Show file tree
Hide file tree
Showing 48 changed files with 692 additions and 211 deletions.
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
# Release Notes for 11.x

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

## [v11.30.0](https://github.com/laravel/framework/compare/v11.29.0...v11.30.0) - 2024-10-30

* Add `$bind` parameter to `Blade::directive` by [@hossein-zare](https://github.com/hossein-zare) in https://github.com/laravel/framework/pull/53279
* [11.x] Fix `trans_choice()` when translation replacement include `|` separator by [@crynobone](https://github.com/crynobone) in https://github.com/laravel/framework/pull/53331
* [11.x] Allow the authorize method to accept Backed Enums directly by [@johanvanhelden](https://github.com/johanvanhelden) in https://github.com/laravel/framework/pull/53330
* [11.x] use `exists()` instead of `count()` by [@browner12](https://github.com/browner12) in https://github.com/laravel/framework/pull/53328
* [11.x] Docblock Improvements by [@mtlukaszczyk](https://github.com/mtlukaszczyk) in https://github.com/laravel/framework/pull/53325
* Allow for custom Postgres operators to be added by [@boris-glumpler](https://github.com/boris-glumpler) in https://github.com/laravel/framework/pull/53324
* [11.x] Support Optional Dimensions for `vector` Column Type by [@akr4m](https://github.com/akr4m) in https://github.com/laravel/framework/pull/53316
* [11.x] Test Improvements by [@saMahmoudzadeh](https://github.com/saMahmoudzadeh) in https://github.com/laravel/framework/pull/53306
* [11.x] Added `dropColumnsIfExists`, `dropColumnIfExists` and `dropForeignIfExists` by [@eusonlito](https://github.com/eusonlito) in https://github.com/laravel/framework/pull/53305
* [11.x] Provide an error message for PostTooLargeException by [@patrickomeara](https://github.com/patrickomeara) in https://github.com/laravel/framework/pull/53301
* [11.x] Fix integrity constraint violation on failed_jobs_uuid_unique by [@bytestream](https://github.com/bytestream) in https://github.com/laravel/framework/pull/53264
* Revert "[11.x] Added `dropColumnsIfExists`, `dropColumnIfExists` and `dropForeignIfExists`" by [@taylorotwell](https://github.com/taylorotwell) in https://github.com/laravel/framework/pull/53338
* [11.x] Introduce `HasUniqueStringIds` by [@cosmastech](https://github.com/cosmastech) in https://github.com/laravel/framework/pull/53280
* [11.x] Refactor: check for contextual attribute before getting parameter class name by [@korkoshko](https://github.com/korkoshko) in https://github.com/laravel/framework/pull/53339
* [11.x] Pick up existing views and markdowns when creating mails by [@kevinb1989](https://github.com/kevinb1989) in https://github.com/laravel/framework/pull/53308
* [11.x] Add withoutDefer and withDefer testing helpers by [@timacdonald](https://github.com/timacdonald) in https://github.com/laravel/framework/pull/53340

## [v11.29.0](https://github.com/laravel/framework/compare/v11.28.1...v11.29.0) - 2024-10-22

Expand Down
8 changes: 5 additions & 3 deletions src/Illuminate/Bus/PendingBatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
use Laravel\SerializableClosure\SerializableClosure;
use Throwable;

use function Illuminate\Support\enum_value;

class PendingBatch
{
use Conditionable;
Expand Down Expand Up @@ -261,12 +263,12 @@ public function connection()
/**
* Specify the queue that the batched jobs should run on.
*
* @param string $queue
* @param \BackedEnum|string|null $queue
* @return $this
*/
public function onQueue(string $queue)
public function onQueue($queue)
{
$this->options['queue'] = $queue;
$this->options['queue'] = enum_value($queue);

return $this;
}
Expand Down
6 changes: 4 additions & 2 deletions src/Illuminate/Database/Concerns/ManagesTransactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
trait ManagesTransactions
{
/**
* @template TReturn of mixed
*
* Execute a Closure within a transaction.
*
* @param \Closure $callback
* @param (\Closure(static): TReturn) $callback
* @param int $attempts
* @return mixed
* @return TReturn
*
* @throws \Throwable
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function handle()
{
if ($this->isProhibited() ||
! $this->confirmToProceed()) {
return 1;
return Command::FAILURE;
}

// Next we'll gather some of the options so that we can have the right options
Expand Down
3 changes: 2 additions & 1 deletion src/Illuminate/Database/Console/Migrations/ResetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Illuminate\Database\Console\Migrations;

use Illuminate\Console\Command;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Console\Prohibitable;
use Illuminate\Database\Migrations\Migrator;
Expand Down Expand Up @@ -56,7 +57,7 @@ public function handle()
{
if ($this->isProhibited() ||
! $this->confirmToProceed()) {
return 1;
return Command::FAILURE;
}

return $this->migrator->usingConnection($this->option('database'), function () {
Expand Down
69 changes: 5 additions & 64 deletions src/Illuminate/Database/Eloquent/Concerns/HasUlids.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,14 @@

namespace Illuminate\Database\Eloquent\Concerns;

use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Support\Str;

trait HasUlids
{
/**
* Initialize the trait.
*
* @return void
*/
public function initializeHasUlids()
{
$this->usesUniqueIds = true;
}
use HasUniqueStringIds;

/**
* Get the columns that should receive a unique identifier.
*
* @return array
*/
public function uniqueIds()
{
return [$this->getKeyName()];
}

/**
* Generate a new ULID for the model.
* Generate a new unique key for the model.
*
* @return string
*/
Expand All @@ -38,53 +19,13 @@ public function newUniqueId()
}

/**
* Retrieve the model for a bound value.
* Determine if given key is valid.
*
* @param \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Relations\Relation<*, *, *> $query
* @param mixed $value
* @param string|null $field
* @return \Illuminate\Contracts\Database\Eloquent\Builder
*
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException
*/
public function resolveRouteBindingQuery($query, $value, $field = null)
{
if ($field && in_array($field, $this->uniqueIds()) && ! Str::isUlid($value)) {
throw (new ModelNotFoundException)->setModel(get_class($this), $value);
}

if (! $field && in_array($this->getRouteKeyName(), $this->uniqueIds()) && ! Str::isUlid($value)) {
throw (new ModelNotFoundException)->setModel(get_class($this), $value);
}

return parent::resolveRouteBindingQuery($query, $value, $field);
}

/**
* Get the auto-incrementing key type.
*
* @return string
*/
public function getKeyType()
{
if (in_array($this->getKeyName(), $this->uniqueIds())) {
return 'string';
}

return $this->keyType;
}

/**
* Get the value indicating whether the IDs are incrementing.
*
* @return bool
*/
public function getIncrementing()
protected function isValidUniqueId($value): bool
{
if (in_array($this->getKeyName(), $this->uniqueIds())) {
return false;
}

return $this->incrementing;
return Str::isUlid($value);
}
}
94 changes: 94 additions & 0 deletions src/Illuminate/Database/Eloquent/Concerns/HasUniqueStringIds.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?php

namespace Illuminate\Database\Eloquent\Concerns;

use Illuminate\Database\Eloquent\ModelNotFoundException;

trait HasUniqueStringIds
{
/**
* Generate a new unique key for the model.
*
* @return mixed
*/
abstract public function newUniqueId();

/**
* Determine if given key is valid.
*
* @param mixed $value
* @return bool
*/
abstract protected function isValidUniqueId($value): bool;

/**
* Initialize the trait.
*
* @return void
*/
public function initializeHasUniqueStringIds()
{
$this->usesUniqueIds = true;
}

/**
* Get the columns that should receive a unique identifier.
*
* @return array
*/
public function uniqueIds()
{
return [$this->getKeyName()];
}

/**
* Retrieve the model for a bound value.
*
* @param \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Relations\Relation<*, *, *> $query
* @param mixed $value
* @param string|null $field
* @return \Illuminate\Contracts\Database\Eloquent\Builder
*
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException
*/
public function resolveRouteBindingQuery($query, $value, $field = null)
{
if ($field && in_array($field, $this->uniqueIds()) && ! $this->isValidUniqueId($value)) {
throw (new ModelNotFoundException)->setModel(get_class($this), $value);
}

if (! $field && in_array($this->getRouteKeyName(), $this->uniqueIds()) && ! $this->isValidUniqueId($value)) {
throw (new ModelNotFoundException)->setModel(get_class($this), $value);
}

return parent::resolveRouteBindingQuery($query, $value, $field);
}

/**
* Get the auto-incrementing key type.
*
* @return string
*/
public function getKeyType()
{
if (in_array($this->getKeyName(), $this->uniqueIds())) {
return 'string';
}

return $this->keyType;
}

/**
* Get the value indicating whether the IDs are incrementing.
*
* @return bool
*/
public function getIncrementing()
{
if (in_array($this->getKeyName(), $this->uniqueIds())) {
return false;
}

return $this->incrementing;
}
}
69 changes: 5 additions & 64 deletions src/Illuminate/Database/Eloquent/Concerns/HasUuids.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,14 @@

namespace Illuminate\Database\Eloquent\Concerns;

use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Support\Str;

trait HasUuids
{
/**
* Initialize the trait.
*
* @return void
*/
public function initializeHasUuids()
{
$this->usesUniqueIds = true;
}
use HasUniqueStringIds;

/**
* Get the columns that should receive a unique identifier.
*
* @return array
*/
public function uniqueIds()
{
return [$this->getKeyName()];
}

/**
* Generate a new UUID for the model.
* Generate a new unique key for the model.
*
* @return string
*/
Expand All @@ -38,53 +19,13 @@ public function newUniqueId()
}

/**
* Retrieve the model for a bound value.
* Determine if given key is valid.
*
* @param \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Relations\Relation<*, *, *> $query
* @param mixed $value
* @param string|null $field
* @return \Illuminate\Contracts\Database\Eloquent\Builder
*
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException
*/
public function resolveRouteBindingQuery($query, $value, $field = null)
{
if ($field && in_array($field, $this->uniqueIds()) && ! Str::isUuid($value)) {
throw (new ModelNotFoundException)->setModel(get_class($this), $value);
}

if (! $field && in_array($this->getRouteKeyName(), $this->uniqueIds()) && ! Str::isUuid($value)) {
throw (new ModelNotFoundException)->setModel(get_class($this), $value);
}

return parent::resolveRouteBindingQuery($query, $value, $field);
}

/**
* Get the auto-incrementing key type.
*
* @return string
*/
public function getKeyType()
{
if (in_array($this->getKeyName(), $this->uniqueIds())) {
return 'string';
}

return $this->keyType;
}

/**
* Get the value indicating whether the IDs are incrementing.
*
* @return bool
*/
public function getIncrementing()
protected function isValidUniqueId($value): bool
{
if (in_array($this->getKeyName(), $this->uniqueIds())) {
return false;
}

return $this->incrementing;
return Str::isUuid($value);
}
}
Loading

0 comments on commit 02e0c01

Please sign in to comment.