/** * Edit Post * * @return Redirect */ public function postEdit(PostRequest $request, $id) { $command = new EditPostCommand($request->all()); try { $this->bus->execute($command); } catch (ValidationException $e) { return Redirect::to(\OogleeBConfig::get('laravelblog::routes.base_uri_admin') . '/post/{$id}/edit')->withErrors($e->getErrors()); } catch (\DomainException $e) { return Redirect::to(\OogleeBConfig::get('laravelblog::routes.base_uri_admin') . '/post/{$id}/edit')->withErrors($e->getErrors()); } return Redirect::to(\OogleeBConfig::get('laravelblog::routes.base_uri_admin') . '/posts')->with(['message' => 'success!']); }
/** * Make the category response. * * @param ICategory $category */ public function make(ICategory $category) { //$category->setResponse($this->response->view('admin.categorys.view', compact('category'))); $category->setResponse($this->response->view(\OogleeBConfig::get('config.category_view.view'), compact('category'))); }
<?php // Application routes Route::group(['namespace' => 'Application'], function () { #POST MODEL // List Resources Route::get(OogleeBConfig::get('config.blog_routes.base_uri'), ['as' => 'post.index', 'uses' => 'PostsController@getIndex']); // Show resource Route::get(OogleeBConfig::get('config.blog_routes.base_uri') . '/' . OogleeBConfig::get('config.post_routes.path_structure') . '/{id}', ['as' => 'post.view', 'uses' => 'PostsController@getShow']); }); // Admin routes Route::group(['prefix' => 'admin', 'namespace' => 'Admin'], function () { Route::group(['middleware' => 'auth'], function () { #POST MODEL // List Resources Route::get(OogleeBConfig::get('config.post_routes.base_uri_admin') . '/post', ['as' => 'admin.post.index', 'uses' => 'PostsController@getIndex']); // Create Resource GET/POST Route::get(OogleeBConfig::get('config.post_routes.base_uri_admin') . '/post/create', ['as' => 'admin.post.create', 'uses' => 'PostsController@getCreate']); Route::post(OogleeBConfig::get('config.post_routes.base_uri_admin') . '/post/create', ['as' => 'admin.post.create', 'uses' => 'PostsController@postCreate']); // Edit resource GET/POST Route::get(OogleeBConfig::get('config.post_routes.base_uri_admin') . '/post/edit/{id}', ['as' => 'admin.post.edit', 'uses' => 'PostsController@getEdit']); Route::post(OogleeBConfig::get('config.post_routes.base_uri_admin') . '/post/edit/{id}', ['as' => 'admin.post.edit', 'uses' => 'PostsController@postEdit']); // Delete resource Route::get(OogleeBConfig::get('config.post_routes.base_uri_admin') . '/post/delete/{id}', ['as' => 'admin.post.delete', 'uses' => 'PostsController@postDelete']); }); });
/** * Display a listing of the resource. * * @return Response */ public function getIndex() { $response = $this->modelService->getAll(); //return resources listing view return view(\OogleeBConfig::get('config.post_index.index'), compact('response')); }
/** * Make the post response. * * @param PostInterface $post */ public function make(IPost $post) { //$post->setResponse($this->response->view('admin.posts.view', compact('post'))); $post->setResponse($this->response->view(\OogleeBConfig::get('config.post_view.view'), compact('post'))); }
/** * Make the view content. * * @param ICategory $category */ public function make(ICategory $category) { //$category->setContent($this->view->make($category->getLayoutViewPath(), compact('category'))->render()); $category->setContent($this->view->make(\OogleeBConfig::get('config.category_view.view'), compact('category'))->render()); }
/** * Make the view content. * * @param PostInterface $p */ public function make(IPost $post) { //$post->setContent($this->view->make($post->getLayoutViewPath(), compact('post'))->render()); $post->setContent($this->view->make(\OogleeBConfig::get('config.post_view.view'), compact('post'))->render()); }