Skip to content

Commit 1ef0471

Browse files
authored
Revert "[10.x] Add string capability to withTrashed method (#46356)" (#46360)
This reverts commit 9a0aa69.
1 parent 9a0aa69 commit 1ef0471

File tree

2 files changed

+2
-87
lines changed

2 files changed

+2
-87
lines changed

src/Illuminate/Routing/PendingResourceRegistration.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,15 +230,11 @@ public function scoped(array $fields = [])
230230
/**
231231
* Define which routes should allow "trashed" models to be retrieved when resolving implicit model bindings.
232232
*
233-
* @param array|string $methods
233+
* @param array $methods
234234
* @return \Illuminate\Routing\PendingResourceRegistration
235235
*/
236-
public function withTrashed(array|string $methods = [])
236+
public function withTrashed(array $methods = [])
237237
{
238-
if (is_string($methods)) {
239-
$methods = (array) $methods;
240-
}
241-
242238
$this->options['trashed'] = $methods;
243239

244240
return $this;

tests/Integration/Routing/ImplicitModelRouteBindingTest.php

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -7,72 +7,11 @@
77
use Illuminate\Database\Eloquent\Model;
88
use Illuminate\Database\Eloquent\SoftDeletes;
99
use Illuminate\Database\Schema\Blueprint;
10-
use Illuminate\Http\Request;
11-
use Illuminate\Routing\Controller;
1210
use Illuminate\Support\Facades\Route;
1311
use Illuminate\Support\Facades\Schema;
1412
use Orchestra\Testbench\Concerns\InteractsWithPublishedFiles;
1513
use Orchestra\Testbench\TestCase;
1614

17-
class ImplicitController extends Controller
18-
{
19-
/**
20-
* Display a listing of the resource.
21-
*/
22-
public function index()
23-
{
24-
//
25-
}
26-
27-
/**
28-
* Show the form for creating a new resource.
29-
*/
30-
public function create()
31-
{
32-
//
33-
}
34-
35-
/**
36-
* Store a newly created resource in storage.
37-
*/
38-
public function store(Request $request)
39-
{
40-
//
41-
}
42-
43-
/**
44-
* Display the specified resource.
45-
*/
46-
public function show(ImplicitBindingUser $user)
47-
{
48-
return $user;
49-
}
50-
51-
/**
52-
* Show the form for editing the specified resource.
53-
*/
54-
public function edit(ImplicitBindingUser $user)
55-
{
56-
//
57-
}
58-
59-
/**
60-
* Update the specified resource in storage.
61-
*/
62-
public function update(Request $request, ImplicitBindingUser $user)
63-
{
64-
//
65-
}
66-
67-
/**
68-
* Remove the specified resource from storage.
69-
*/
70-
public function destroy(ImplicitBindingUser $user)
71-
{
72-
//
73-
}
74-
}
75-
7615
class ImplicitModelRouteBindingTest extends TestCase
7716
{
7817
use InteractsWithPublishedFiles;
@@ -202,26 +141,6 @@ public function testSoftDeletedModelsCanBeRetrievedUsingWithTrashedMethod()
202141
]);
203142
}
204143

205-
public function testSoftDeletedModelsCanBeRetrievedUsingWithTrashedMethodWithSpecificFunction()
206-
{
207-
$user = ImplicitBindingUser::create(['name' => 'Dries']);
208-
209-
$user->delete();
210-
211-
config(['app.key' => str_repeat('a', 32)]);
212-
213-
Route::resource('users', ImplicitController::class)
214-
->middleware(['web'])
215-
->withTrashed('show');
216-
217-
$response = $this->getJson("/users/{$user->id}");
218-
219-
$response->assertJson([
220-
'id' => $user->id,
221-
'name' => $user->name,
222-
]);
223-
}
224-
225144
public function testEnforceScopingImplicitRouteBindings()
226145
{
227146
$user = ImplicitBindingUser::create(['name' => 'Dries']);

0 commit comments

Comments
 (0)