我在RouteServiceProvider中有代码:
$router->bind('user', function ($value) {
try{
throw (new \Symfony\Component\HttpKernel\Exception\NotFoundHttpException);
}catch(Exception $e){
exit('nott');
}
});
Run Code Online (Sandbox Code Playgroud)
而且我没有提出输出
nott
Run Code Online (Sandbox Code Playgroud)
我正进入(状态
Sorry, the page you are looking for could not be found.
NotFoundHttpException in RouteServiceProvider.php line 75:
...
Run Code Online (Sandbox Code Playgroud)
编辑:这有效:
$router->bind('user', function ($value) {
try{
throw (new \Symfony\Component\HttpKernel\Exception\NotFoundHttpException);
}catch(\Symfony\Component\HttpKernel\Exception\NotFoundHttpException $e){
exit('addd');
}
});
Run Code Online (Sandbox Code Playgroud)
但这不起作用:
$router->bind('user', function ($value) {
try{
return (new User)->findOrFail(122);
}catch(\Symfony\Component\HttpKernel\Exception\NotFoundHttpException $e){
exit('addd');
}
});
Run Code Online (Sandbox Code Playgroud) 我有两个mysql脚本:
select
p.*
from
`products` p
JOIN dispensaries d ON (p.dispensary_id = d.id)
JOIN dispensary_locations dl ON(dl.dispensary_id = d.id AND dl.is_primary = 1)
JOIN dispensary_location_zip_codes dlzc ON(dlzc.dispensary_location_id = dl.id AND dlzc.zip_code = '941033')
and p.`is_hidden` = 0
and p.`deleted_at` is null
GROUP BY p.id
order by p.`points` desc
limit 12
Run Code Online (Sandbox Code Playgroud)
和
select
*
from
`products`
where
exists (
select
*
from
`dispensaries`
where
`products`.`dispensary_id` = `dispensaries`.`id`
and exists (
select
*
from
`dispensary_locations`
where
`dispensary_locations`.`dispensary_id` = `dispensaries`.`id`
and exists ( …Run Code Online (Sandbox Code Playgroud) 我在route.php中有这个:
Route::post('myFunction', ['uses' => 'MyPackage\MyController@updateMeta']);
Run Code Online (Sandbox Code Playgroud)
我得到这个错误:
ReflectionException in Route.php line 280:
Class App\Http\Controllers\MyPackage\MyController does not exist
Run Code Online (Sandbox Code Playgroud)
任何想法如何在routes.php中使用供应商的控制器?