File tree Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 20
20
* @method \Illuminate\Routing\RouteRegistrar controller(string $controller)
21
21
* @method \Illuminate\Routing\RouteRegistrar domain(string $value)
22
22
* @method \Illuminate\Routing\RouteRegistrar middleware(array|string|null $middleware)
23
+ * @method \Illuminate\Routing\RouteRegistrar missing(\Closure $missing)
23
24
* @method \Illuminate\Routing\RouteRegistrar name(string $value)
24
25
* @method \Illuminate\Routing\RouteRegistrar namespace(string|null $value)
25
26
* @method \Illuminate\Routing\RouteRegistrar prefix(string $prefix)
@@ -65,6 +66,7 @@ class RouteRegistrar
65
66
'controller ' ,
66
67
'domain ' ,
67
68
'middleware ' ,
69
+ 'missing ' ,
68
70
'name ' ,
69
71
'namespace ' ,
70
72
'prefix ' ,
Original file line number Diff line number Diff line change @@ -498,9 +498,9 @@ public function testRouteGroupChaining()
498
498
public function testRegisteringNonApprovedAttributesThrows ()
499
499
{
500
500
$ this ->expectException (BadMethodCallException::class);
501
- $ this ->expectExceptionMessage ('Method Illuminate\Routing\RouteRegistrar::missing does not exist. ' );
501
+ $ this ->expectExceptionMessage ('Method Illuminate\Routing\RouteRegistrar::unsupportedMethod does not exist. ' );
502
502
503
- $ this ->router ->domain ('foo ' )->missing ('bar ' )->group (function ($ router ) {
503
+ $ this ->router ->domain ('foo ' )->unsupportedMethod ('bar ' )->group (function ($ router ) {
504
504
//
505
505
});
506
506
}
Original file line number Diff line number Diff line change @@ -1883,6 +1883,29 @@ public function testImplicitBindingsWithMissingModelHandledByMissing()
1883
1883
$ this ->assertEquals (302 , $ response ->getStatusCode ());
1884
1884
}
1885
1885
1886
+ public function testImplicitBindingsWithMissingModelHandledByMissingOnGroupLevel ()
1887
+ {
1888
+ $ router = $ this ->getRouter ();
1889
+ $ router ->as ('foo. ' )
1890
+ ->missing (fn () => new RedirectResponse ('/ ' , 302 ))
1891
+ ->group (function () use ($ router ) {
1892
+ $ router ->get ('foo/{bar} ' , [
1893
+ 'middleware ' => SubstituteBindings::class,
1894
+ 'uses ' => function (RouteModelBindingNullStub $ bar = null ) {
1895
+ $ this ->assertInstanceOf (RouteModelBindingNullStub::class, $ bar );
1896
+
1897
+ return $ bar ->first ();
1898
+ },
1899
+ ]);
1900
+ });
1901
+
1902
+ $ request = Request::create ('foo/taylor ' , 'GET ' );
1903
+
1904
+ $ response = $ router ->dispatch ($ request );
1905
+ $ this ->assertTrue ($ response ->isRedirect ('/ ' ));
1906
+ $ this ->assertEquals (302 , $ response ->getStatusCode ());
1907
+ }
1908
+
1886
1909
public function testImplicitBindingsWithOptionalParameterWithNoKeyInUri ()
1887
1910
{
1888
1911
$ router = $ this ->getRouter ();
You can’t perform that action at this time.
0 commit comments