Replies: 3 comments 5 replies
-
If you'll use Orchid CRUD package - it will handle default routes for you |
Beta Was this translation helpful? Give feedback.
-
a route::screenResource() might not be a bad idea and I think is not so hard to implement Now it require to pas the listScreen and the Editscreen as param Any way you can also point the CRUD route to the editScreen and, with some logic inside query method returns it along with the data. So wich layout to display (or the state of what ever you want to show should match your create or update or view or delete action to perform ). |
Beta Was this translation helpful? Give feedback.
-
Hi @kdv88. As mentioned earlier in the answer for a fast CRUD, we have a separate package. Maybe it will suit you for simple things. As for your proposal, I think it will be a little clear to users. Since It's effortless to do. You can do it yourself in your app or release it as a package. use Illuminate\Support\Facades\Route;
Route::macro('resourceScreen', function ($params) {
// The logic you want to get
}); Then, you can call in your routes: Route::resourceScreen('Any values will be passed to the closure function') It also makes it impossible to ask any additional things, like excluding middleware or breadcrumbs. You can read more about macros here: https://laravel-news.com/laravel-route-tips-to-improve-your-routing or https://laravel.com/api/8.x/Illuminate/Support/Traits/Macroable.html (If you like reading code more) |
Beta Was this translation helpful? Give feedback.
-
Laravel has the Route::resource(), which automatically builds the routes. For now the Orchid-way would be to create separate routes:
In Laravel these can be summarized by
Route::resource('projects', 'ProjectController');
I would love to see a
Route::ScreenResource('project')
which automatically handles routing.Perhaps automatically looking for
{$name}EditScreen::class
and{$name}ListScreen::class
Beta Was this translation helpful? Give feedback.
All reactions