laravel-generator
laravel-generator copied to clipboard
[Enhancement]: Better definition for the route used for links.
Many ways to do this but as of right now the routes are only working some of the time.
Here is an example using model binding into route:
/**************** Model binding into route **************************/
Route::model('call', 'App\Models\Call');
Route::model('category', 'App\Models\Category');
Route::model('city', 'App\Models\City');
Route::model('company', 'App\Models\Company');
Route::model('email', 'App\Models\Email');
Route::pattern('slug', '[a-z0-9-]+');
Route::pattern('slug2', '[a-z_]+');
Route::pattern('id', '[0-9]+');
Add this right into the routes file or a seperate file and include it like you did with api_routes.php
/* |--------------------------------------------------------------------------
route model binding |
---|
*/ |
require config('infyom.laravel_generator.path.route_model_binding_file');
Like that above shown, also following style:
/posts /posts/comments
/*
* ----------------- Post Routes --------------
*/
Route::resource("posts", "PostController");
Route::group(['prefix' => 'posts'], function ()
{
/*
* ----------------- Comment Routes --------------
*/
Route::resource("comments", "CommentController");
Route::group(['prefix' => 'comments'], function ()
{
moving to the second milestone. Because we are going to implement some Exception handler stuff rather than just throwing 404 errors. #130