Skip to content

Commit

Permalink
Use singular route parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
nWidart committed Jul 8, 2015
1 parent 500d867 commit 9e201df
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Http/Requests/UpdatePostRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public function rules()

public function translationRules()
{
$id = $this->route()->getParameter('posts')->id;
$id = $this->route()->getParameter('post')->id;

return [
"title" => "required",
Expand Down
20 changes: 10 additions & 10 deletions Http/backendRoutes.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?php

$router->bind('categories', function ($id) {
return app('Modules\Blog\Repositories\CategoryRepository')->find($id);
$router->bind('category', function ($id) {
return app(\Modules\Blog\Repositories\CategoryRepository::class)->find($id);
});
$router->bind('posts', function ($id) {
return app('Modules\Blog\Repositories\PostRepository')->find($id);
$router->bind('post', function ($id) {
return app(\Modules\Blog\Repositories\PostRepository::class)->find($id);
});

$router->group(['prefix' => '/blog'], function () {
get('posts', ['as' => 'admin.blog.post.index', 'uses' => 'PostController@index']);
get('posts/create', ['as' => 'admin.blog.post.create', 'uses' => 'PostController@create']);
post('posts', ['as' => 'admin.blog.post.store', 'uses' => 'PostController@store']);
get('posts/{posts}/edit', ['as' => 'admin.blog.post.edit', 'uses' => 'PostController@edit']);
put('posts/{posts}', ['as' => 'admin.blog.post.update', 'uses' => 'PostController@update']);
delete('posts/{posts}', ['as' => 'admin.blog.post.destroy', 'uses' => 'PostController@destroy']);
get('posts/{post}/edit', ['as' => 'admin.blog.post.edit', 'uses' => 'PostController@edit']);
put('posts/{post}', ['as' => 'admin.blog.post.update', 'uses' => 'PostController@update']);
delete('posts/{post}', ['as' => 'admin.blog.post.destroy', 'uses' => 'PostController@destroy']);

get('categories', ['as' => 'admin.blog.category.index', 'uses' => 'CategoryController@index']);
get('categories/create', ['as' => 'admin.blog.category.create', 'uses' => 'CategoryController@create']);
post('categories', ['as' => 'admin.blog.category.store', 'uses' => 'CategoryController@store']);
get('categories/{categories}/edit', ['as' => 'admin.blog.category.edit', 'uses' => 'CategoryController@edit']);
put('categories/{categories}', ['as' => 'admin.blog.category.update', 'uses' => 'CategoryController@update']);
delete('categories/{categories}', ['as' => 'admin.blog.category.destroy', 'uses' => 'CategoryController@destroy']);
get('categories/{category}/edit', ['as' => 'admin.blog.category.edit', 'uses' => 'CategoryController@edit']);
put('categories/{category}', ['as' => 'admin.blog.category.update', 'uses' => 'CategoryController@update']);
delete('categories/{category}', ['as' => 'admin.blog.category.destroy', 'uses' => 'CategoryController@destroy']);
});

0 comments on commit 9e201df

Please sign in to comment.