Skip to content

[9.x] Allow loading trashed models for resource routes#44405

Merged
taylorotwell merged 4 commits intolaravel:9.xfrom
browner12:resource-routes-with-trash
Oct 4, 2022
Merged

[9.x] Allow loading trashed models for resource routes#44405
taylorotwell merged 4 commits intolaravel:9.xfrom
browner12:resource-routes-with-trash

Conversation

@browner12
Copy link
Contributor

This change gives the ability to load trashed models when registering a route resource.

You can load trashed models on all the resource routes by calling withTrashed() with no parameters:

Route::resource('users', UserController::class)->withTrashed();

You can selectively load trashed models on methods by passing an array:

Route::resource('users', UserController::class)->withTrashed(['show']);

This change gives the ability to load trashed models when registering a route resource.

You can load trashed models on **all** the resource routes by calling `withTrashed()` with no parameters:

```php
Route::resource('users', UserController::class)->withTrashed();
```

You can selectively load trashed models on methods by passing an array:

```php
Route::resource('users', UserController::class)->withTrashed(['show']);
```
@taylorotwell taylorotwell merged commit 1fa2669 into laravel:9.x Oct 4, 2022
@browner12 browner12 deleted the resource-routes-with-trash branch October 4, 2022 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments