Unverified Commit 849c0904 authored by Vipul Basapati's avatar Vipul Basapati Committed by GitHub

Merge pull request #229 from bvipul/develop

Responsable Trait Implementation
parents 371a28e4 d8218f5f
......@@ -3,14 +3,18 @@
namespace App\Http\Controllers\Backend\Access\Permission;
use App\Http\Controllers\Controller;
use App\Http\Responses\ViewResponse;
use App\Http\Responses\RedirectResponse;
use App\Models\Access\Permission\Permission;
use App\Http\Responses\Backend\Access\Permission\EditResponse;
use App\Http\Responses\Backend\Access\Permission\CreateResponse;
use App\Repositories\Backend\Access\Permission\PermissionRepository;
use App\Http\Requests\Backend\Access\Permission\EditPermissionRequest;
use App\Http\Requests\Backend\Access\Permission\StorePermissionRequest;
use App\Http\Requests\Backend\Access\Permission\CreatePermissionRequest;
use App\Http\Requests\Backend\Access\Permission\DeletePermissionRequest;
use App\Http\Requests\Backend\Access\Permission\EditPermissionRequest;
use App\Http\Requests\Backend\Access\Permission\ManagePermissionRequest;
use App\Http\Requests\Backend\Access\Permission\StorePermissionRequest;
use App\Http\Requests\Backend\Access\Permission\UpdatePermissionRequest;
use App\Models\Access\Permission\Permission;
use App\Repositories\Backend\Access\Permission\PermissionRepository;
/**
* Class PermissionController.
......@@ -33,71 +37,69 @@ class PermissionController extends Controller
/**
* @param ManagePermissionRequest $request
*
* @return mixed
* @return \App\Http\Responses\ViewResponse
*/
public function index(ManagePermissionRequest $request)
{
return view('backend.access.permissions.index');
return new ViewResponse('backend.access.permissions.index');
}
/**
* @param CreatePermissionRequest $request
*
* @return mixed
* @return \App\Http\Responses\Backend\Access\Permission\CreateResponse
*/
public function create(CreatePermissionRequest $request)
{
return view('backend.access.permissions.create')
->withPermissionCount($this->permissions->getCount());
return new CreateResponse($this->permissions);
}
/**
* @param StorePermissionRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function store(StorePermissionRequest $request)
{
$this->permissions->create($request->all());
return redirect()->route('admin.access.permission.index')->withFlashSuccess(trans('alerts.backend.permissions.created'));
return new RedirectResponse(route('admin.access.permission.index'), ['flash_success' => trans('alerts.backend.permissions.created')]);
}
/**
* @param Permission $permission
* @param EditPermissionRequest $request
*
* @return mixed
* @return \App\Http\Responses\Backend\Access\Permission\EditResponse
*/
public function edit(Permission $permission, EditPermissionRequest $request)
{
return view('backend.access.permissions.edit')
->withPermission($permission);
return new EditResponse($permission);
}
/**
* @param Permission $permission
* @param UpdatePermissionRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function update(Permission $permission, UpdatePermissionRequest $request)
{
$this->permissions->update($permission, $request->all());
return redirect()->route('admin.access.permission.index')->withFlashSuccess(trans('alerts.backend.permissions.updated'));
return new RedirectResponse(route('admin.access.permission.index'), ['flash_success' => trans('alerts.backend.permissions.updated')]);
}
/**
* @param Permission $permission
* @param DeletePermissionRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function destroy(Permission $permission, DeletePermissionRequest $request)
{
$this->permissions->delete($permission);
return redirect()->route('admin.access.permission.index')->withFlashSuccess(trans('alerts.backend.permissions.deleted'));
return new RedirectResponse(route('admin.access.permission.index'), ['flash_success' => trans('alerts.backend.permissions.deleted')]);
}
}
......@@ -71,7 +71,7 @@ class RoleController extends Controller
{
$this->roles->create($request->all());
return new RedirectResponse('admin.access.role.index', ['flash_success' => trans('alerts.backend.roles.created')]);
return new RedirectResponse(route('admin.access.role.index'), ['flash_success' => trans('alerts.backend.roles.created')]);
}
/**
......@@ -95,7 +95,7 @@ class RoleController extends Controller
{
$this->roles->update($role, $request->all());
return new RedirectResponse('admin.access.role.index', ['flash_success' => trans('alerts.backend.roles.updated')]);
return new RedirectResponse(route('admin.access.role.index'), ['flash_success' => trans('alerts.backend.roles.updated')]);
}
/**
......@@ -108,6 +108,6 @@ class RoleController extends Controller
{
$this->roles->delete($role);
return new RedirectResponse('admin.access.role.index', ['flash_success' => trans('alerts.backend.roles.deleted')]);
return new RedirectResponse(route('admin.access.role.index'), ['flash_success' => trans('alerts.backend.roles.deleted')]);
}
}
......@@ -76,7 +76,7 @@ class UserController extends Controller
{
$this->users->create($request);
return new RedirectResponse('admin.access.user.index', ['flash_success' => trans('alerts.backend.users.created')]);
return new RedirectResponse(route('admin.access.user.index'), ['flash_success' => trans('alerts.backend.users.created')]);
}
/**
......@@ -114,7 +114,7 @@ class UserController extends Controller
{
$this->users->update($user, $request);
return new RedirectResponse('admin.access.user.index', ['flash_success' => trans('alerts.backend.users.updated')]);
return new RedirectResponse(route('admin.access.user.index'), ['flash_success' => trans('alerts.backend.users.updated')]);
}
/**
......@@ -127,6 +127,6 @@ class UserController extends Controller
{
$this->users->delete($user);
return new RedirectResponse('admin.access.user.index', ['flash_success' => trans('alerts.backend.users.deleted')]);
return new RedirectResponse(route('admin.access.user.index'), ['flash_success' => trans('alerts.backend.users.deleted')]);
}
}
......@@ -3,14 +3,16 @@
namespace App\Http\Controllers\Backend\BlogCategories;
use App\Http\Controllers\Controller;
use App\Http\Responses\ViewResponse;
use App\Http\Responses\RedirectResponse;
use App\Models\BlogCategories\BlogCategory;
use App\Repositories\Backend\BlogCategories\BlogCategoriesRepository;
use App\Http\Requests\Backend\BlogCategories\EditBlogCategoriesRequest;
use App\Http\Requests\Backend\BlogCategories\StoreBlogCategoriesRequest;
use App\Http\Requests\Backend\BlogCategories\CreateBlogCategoriesRequest;
use App\Http\Requests\Backend\BlogCategories\DeleteBlogCategoriesRequest;
use App\Http\Requests\Backend\BlogCategories\EditBlogCategoriesRequest;
use App\Http\Requests\Backend\BlogCategories\ManageBlogCategoriesRequest;
use App\Http\Requests\Backend\BlogCategories\StoreBlogCategoriesRequest;
use App\Http\Requests\Backend\BlogCategories\UpdateBlogCategoriesRequest;
use App\Models\BlogCategories\BlogCategory;
use App\Repositories\Backend\BlogCategories\BlogCategoriesRepository;
/**
* Class BlogCategoriesController.
......@@ -30,21 +32,21 @@ class BlogCategoriesController extends Controller
/**
* @param \App\Http\Requests\Backend\BlogCategories\ManageBlogCategoriesRequest $request
*
* @return mixed
* @return ViewResponse
*/
public function index(ManageBlogCategoriesRequest $request)
{
return view('backend.blogcategories.index');
return new ViewResponse('backend.blogcategories.index');
}
/**
* @param \App\Http\Requests\Backend\BlogCategories\CreateBlogCategoriesRequest $request
*
* @return mixed
* @return \App\Http\Responses\ViewResponse
*/
public function create(CreateBlogCategoriesRequest $request)
{
return view('backend.blogcategories.create');
return new ViewResponse('backend.blogcategories.create');
}
/**
......@@ -56,9 +58,7 @@ class BlogCategoriesController extends Controller
{
$this->blogcategory->create($request->all());
return redirect()
->route('admin.blogCategories.index')
->with('flash_success', trans('alerts.backend.blogcategories.created'));
return new RedirectResponse(route('admin.blogCategories.index'), ['flash_success' => trans('alerts.backend.blogcategories.created')]);
}
/**
......@@ -69,37 +69,32 @@ class BlogCategoriesController extends Controller
*/
public function edit(BlogCategory $blogCategory, EditBlogCategoriesRequest $request)
{
return view('backend.blogcategories.edit')
->with('blogcategory', $blogCategory);
return new EditResponse($blogCategory);
}
/**
* @param \App\Models\BlogCategories\BlogCategory $blogCategory
* @param \App\Http\Requests\Backend\BlogCategories\UpdateBlogCategoriesRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function update(BlogCategory $blogCategory, UpdateBlogCategoriesRequest $request)
{
$this->blogcategory->update($blogCategory, $request->all());
return redirect()
->route('admin.blogCategories.index')
->with('flash_success', trans('alerts.backend.blogcategories.updated'));
return new RedirectResponse(route('admin.blogCategories.index'), ['flash_success' => trans('alerts.backend.blogcategories.updated')]);
}
/**
* @param \App\Models\BlogCategories\BlogCategory $blogCategory
* @param \App\Http\Requests\Backend\BlogCategories\DeleteBlogCategoriesRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function destroy(BlogCategory $blogCategory, DeleteBlogCategoriesRequest $request)
{
$this->blogcategory->delete($blogCategory);
return redirect()
->route('admin.blogCategories.index')
->with('flash_success', trans('alerts.backend.blogcategories.deleted'));
return new RedirectResponse(route('admin.blogCategories.index'), ['flash_success' => trans('alerts.backend.blogcategories.deleted')]);
}
}
......@@ -2,15 +2,18 @@
namespace App\Http\Controllers\Backend\BlogTags;
use App\Models\BlogTags\BlogTag;
use App\Http\Controllers\Controller;
use App\Http\Responses\ViewResponse;
use App\Http\Responses\RedirectResponse;
use App\Http\Responses\Backend\BlogTag\EditResponse;
use App\Repositories\Backend\BlogTags\BlogTagsRepository;
use App\Http\Requests\Backend\BlogTags\EditBlogTagsRequest;
use App\Http\Requests\Backend\BlogTags\StoreBlogTagsRequest;
use App\Http\Requests\Backend\BlogTags\CreateBlogTagsRequest;
use App\Http\Requests\Backend\BlogTags\DeleteBlogTagsRequest;
use App\Http\Requests\Backend\BlogTags\EditBlogTagsRequest;
use App\Http\Requests\Backend\BlogTags\ManageBlogTagsRequest;
use App\Http\Requests\Backend\BlogTags\StoreBlogTagsRequest;
use App\Http\Requests\Backend\BlogTags\UpdateBlogTagsRequest;
use App\Models\BlogTags\BlogTag;
use App\Repositories\Backend\BlogTags\BlogTagsRepository;
/**
* Class BlogTagsController.
......@@ -33,47 +36,44 @@ class BlogTagsController extends Controller
/**
* @param \App\Http\Requests\Backend\BlogTags\ManageBlogTagsRequest $request
*
* @return mixed
* @return \App\Http\Responses\ViewResponse
*/
public function index(ManageBlogTagsRequest $request)
{
return view('backend.blogtags.index');
return new ViewResponse('backend.blogtags.index');
}
/**
* @param \App\Http\Requests\Backend\BlogTags\CreateBlogTagsRequest $request
*
* @return mixed
* @return \App\Http\Responses\ViewResponse
*/
public function create(CreateBlogTagsRequest $request)
{
return view('backend.blogtags.create');
return new ViewResponse('backend.blogtags.create');
}
/**
* @param \App\Http\Requests\Backend\BlogTags\StoreBlogTagsRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function store(StoreBlogTagsRequest $request)
{
$this->blogtag->create($request->except('token'));
return redirect()
->route('admin.blogTags.index')
->with('flash_success', trans('alerts.backend.blogtags.created'));
return new RedirectResponse(route('admin.blogTags.index'), ['flash_success' => trans('alerts.backend.blogtags.created')]);
}
/**
* @param \App\Models\BlogTags\BlogTag $blogTag
* @param \App\Http\Requests\Backend\BlogTags\EditBlogTagsRequest $request
*
* @return mixed
* @return \App\Http\Responses\Backend\BlogTag\EditResponse
*/
public function edit(BlogTag $blogTag, EditBlogTagsRequest $request)
{
return view('backend.blogtags.edit')
->with('blogtag', $blogTag);
return new EditResponse($blogTag);
}
/**
......@@ -86,9 +86,7 @@ class BlogTagsController extends Controller
{
$this->blogtag->update($blogTag, $request->except(['_method', '_token']));
return redirect()
->route('admin.blogTags.index')
->with('flash_success', trans('alerts.backend.blogtags.updated'));
return new RedirectResponse(route('admin.blogTags.index'), ['flash_success' => trans('alerts.backend.blogtags.updated')]);
}
/**
......@@ -101,8 +99,6 @@ class BlogTagsController extends Controller
{
$this->blogtag->delete($blogTag);
return redirect()
->route('admin.blogTags.index')
->with('flash_success', trans('alerts.backend.blogtags.deleted'));
return new RedirectResponse(route('admin.blogTags.index'), ['flash_success' => trans('alerts.backend.blogtags.deleted')]);
}
}
......@@ -46,7 +46,7 @@ class BlogsController extends Controller
/**
* @param \App\Http\Requests\Backend\Blogs\ManageBlogsRequest $request
*
* @return mixed
* @return \App\Http\Responses\Backend\Blog\IndexResponse
*/
public function index(ManageBlogsRequest $request)
{
......@@ -69,20 +69,20 @@ class BlogsController extends Controller
/**
* @param \App\Http\Requests\Backend\Blogs\StoreBlogsRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function store(StoreBlogsRequest $request)
{
$this->blog->create($request->except('_token'));
return new RedirectResponse('admin.blogs.index', ['flash_success' => trans('alerts.backend.blogs.created')]);
return new RedirectResponse(route('admin.blogs.index'), ['flash_success' => trans('alerts.backend.blogs.created')]);
}
/**
* @param \App\Models\Blogs\Blog $blog
* @param \App\Http\Requests\Backend\Blogs\ManageBlogsRequest $request
*
* @return mixed
* @return \App\Http\Responses\Backend\Blog\EditResponse
*/
public function edit(Blog $blog, ManageBlogsRequest $request)
{
......@@ -96,7 +96,7 @@ class BlogsController extends Controller
* @param \App\Models\Blogs\Blog $blog
* @param \App\Http\Requests\Backend\Blogs\UpdateBlogsRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function update(Blog $blog, UpdateBlogsRequest $request)
{
......@@ -104,19 +104,19 @@ class BlogsController extends Controller
$this->blog->update($blog, $request->except(['_token', '_method']));
return new RedirectResponse('admin.blogs.index', ['flash_success' => trans('alerts.backend.blogs.updated')]);
return new RedirectResponse(route('admin.blogs.index'), ['flash_success' => trans('alerts.backend.blogs.updated')]);
}
/**
* @param \App\Models\Blogs\Blog $blog
* @param \App\Http\Requests\Backend\Blogs\ManageBlogsRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function destroy(Blog $blog, ManageBlogsRequest $request)
{
$this->blog->delete($blog);
return new RedirectResponse('admin.blogs.index', ['flash_success' => trans('alerts.backend.blogs.deleted')]);
return new RedirectResponse(route('admin.blogs.index'), ['flash_success' => trans('alerts.backend.blogs.deleted')]);
}
}
......@@ -2,18 +2,26 @@
namespace App\Http\Controllers\Backend\Faqs;
use App\Models\Faqs\Faq;
use App\Http\Controllers\Controller;
use App\Http\Responses\ViewResponse;
use App\Http\Responses\RedirectResponse;
use App\Http\Responses\Backend\Faq\EditResponse;
use App\Repositories\Backend\Faqs\FaqsRepository;
use App\Http\Requests\Backend\Faqs\EditFaqsRequest;
use App\Http\Requests\Backend\Faqs\StoreFaqsRequest;
use App\Http\Requests\Backend\Faqs\CreateFaqsRequest;
use App\Http\Requests\Backend\Faqs\DeleteFaqsRequest;
use App\Http\Requests\Backend\Faqs\EditFaqsRequest;
use App\Http\Requests\Backend\Faqs\ManageFaqsRequest;
use App\Http\Requests\Backend\Faqs\StoreFaqsRequest;
use App\Http\Requests\Backend\Faqs\UpdateFaqsRequest;
use App\Models\Faqs\Faq;
use App\Repositories\Backend\Faqs\FaqsRepository;
class FaqsController extends Controller
{
/**
* Faq Repository
*
* @var \App\Repositories\Backend\Faqs\FaqsRepository
*/
protected $faq;
/**
......@@ -29,11 +37,11 @@ class FaqsController extends Controller
*
* @param \App\Http\Requests\Backend\Faqs\ManageFaqsRequest $request
*
* @return \Illuminate\Http\Response
* @return \App\Http\Responses\ViewResponse
*/
public function index(ManageFaqsRequest $request)
{
return view('backend.faqs.index');
return new ViewResponse('backend.faqs.index');
}
/**
......@@ -41,11 +49,11 @@ class FaqsController extends Controller
*
* @param \App\Http\Requests\Backend\Faqs\CreateFaqsRequest $request
*
* @return \Illuminate\Http\Response
* @return \App\Http\Responses\ViewResponse
*/
public function create(CreateFaqsRequest $request)
{
return view('backend.faqs.create');
return new ViewResponse('backend.faqs.create');
}
/**
......@@ -53,17 +61,13 @@ class FaqsController extends Controller
*
* @param \App\Http\Requests\Backend\Faqs\StoreFaqsRequest $request
*
* @return \Illuminate\Http\Response
* @return \App\Http\Responses\RedirectResponse
*/
public function store(StoreFaqsRequest $request)
{
$input = $request->all();
$this->faq->create($input);
$this->faq->create($request->all());
return redirect()
->route('admin.faqs.index')
->with('flash_success', trans('alerts.backend.faqs.created'));
return new RedirectResponse(route('admin.faqs.index'), ['flash_success' => trans('alerts.backend.faqs.created')]);
}
/**
......@@ -72,12 +76,11 @@ class FaqsController extends Controller
* @param \App\Models\Faqs\Faq $faq
* @param \App\Http\Requests\Backend\Faqs\EditFaqsRequest $request
*
* @return \Illuminate\Http\Response
* @return \App\Http\Responses\Backend\Faq\EditResponse
*/
public function edit(Faq $faq, EditFaqsRequest $request)
{
return view('backend.faqs.edit')
->with('faq', $faq);
return new EditResponse($faq);
}
/**
......@@ -86,17 +89,13 @@ class FaqsController extends Controller
* @param \App\Http\Requests\Backend\Faqs\UpdateFaqsRequest $request
* @param \App\Models\Faqs\Faq $id
*
* @return \Illuminate\Http\Response
* @return \App\Http\Responses\RedirectResponse
*/
public function update(UpdateFaqsRequest $request, Faq $faq)
{
$input = $request->all();
$this->faq->update($faq, $input);
$this->faq->update($faq, $request->all());
return redirect()
->route('admin.faqs.index')
->with('flash_success', trans('alerts.backend.faqs.updated'));
return new RedirectResponse(route('admin.faqs.index'), ['flash_success' => trans('alerts.backend.faqs.updated')]);
}
/**
......@@ -105,14 +104,12 @@ class FaqsController extends Controller
* @param \App\Models\Faqs\Faq $faq
* @param \App\Http\Requests\Backend\Faqs\DeleteFaqsRequest $request
*
* @return \Illuminate\Http\Response
* @return \App\Http\Responses\RedirectResponse
*/
public function destroy(Faq $faq, DeleteFaqsRequest $request)
{
$this->faq->delete($faq);
return redirect()
->route('admin.faqs.index')
->with('flash_success', trans('alerts.backend.faqs.deleted'));
return new RedirectResponse(route('admin.faqs.index'), ['flash_success' => trans('alerts.backend.faqs.deleted')]);
}
}
......@@ -2,27 +2,59 @@
namespace App\Http\Controllers\Backend\Menu;
use App\Models\Menu\Menu;
use Bvipul\Generator\Module;
use Illuminate\Support\Facades\DB;
use App\Http\Controllers\Controller;
use App\Http\Responses\ViewResponse;
use App\Http\Responses\RedirectResponse;
use App\Http\Responses\Backend\Menu\EditResponse;
use App\Repositories\Backend\Menu\MenuRepository;
use App\Http\Requests\Backend\Menu\EditMenuRequest;
use App\Http\Responses\Backend\Menu\CreateResponse;
use App\Http\Requests\Backend\Menu\StoreMenuRequest;
use App\Http\Requests\Backend\Menu\CreateMenuRequest;
use App\Http\Requests\Backend\Menu\DeleteMenuRequest;
use App\Http\Requests\Backend\Menu\EditMenuRequest;
use App\Http\Requests\Backend\Menu\ManageMenuRequest;
use App\Http\Requests\Backend\Menu\StoreMenuRequest;
use App\Http\Requests\Backend\Menu\UpdateMenuRequest;
use App\Models\Menu\Menu;
use App\Repositories\Backend\Menu\MenuRepository;
use Illuminate\Support\Facades\DB;
class MenuController extends Controller
{
/**
* Menu Model Object
*
* @var \App\Models\Menu\Menu
*/
protected $menu;
/**
* Module Model Object
*
* @var \Bvipul\Generator\Module
*/
protected $modules;
/**
* Menu Types
*
* @var Array
*/
protected $types;
/**
* @param \App\Repositories\Backend\Menu\MenuRepository $menu
*/
public function __construct(MenuRepository $menu)
public function __construct(MenuRepository $menu, Module $module)
{
$this->menu = $menu;
$this->modules = $module;
$this->types = [
'backend' => 'Backend',
'frontend' => 'Frontend',
];
}
/**
......@@ -30,11 +62,11 @@ class MenuController extends Controller
*
* @param \App\Http\Requests\Backend\Menu\ManageMenuRequest $request
*
* @return \Illuminate\Http\Response
* @return \App\Http\Responses\ViewResponse
*/
public function index(ManageMenuRequest $request)
{
return view('backend.menus.index');
return new ViewResponse('backend.menus.index');
}
/**
......@@ -42,17 +74,11 @@ class MenuController extends Controller
*
* @param \App\Http\Requests\Backend\Menu\CreateMenuRequest $request
*
* @return \Illuminate\Http\Response
* @return \App\Http\Responses\Backend\Menu\CreateResponse
*/
public function create(CreateMenuRequest $request)
{
$types = [
'backend' => 'Backend',
'frontend' => 'Frontend',
];
$modules = DB::table('modules')->get();
return view('backend.menus.create')->withTypes($types)->withModules($modules);
return new CreateResponse($this->types, $this->modules);
}
/**
......@@ -60,13 +86,13 @@ class MenuController extends Controller
*
* @param \App\Http\Requests\Backend\Menu\StoreMenuRequest $request
*
* @return \Illuminate\Http\Response
* @return \App\Http\Responses\RedirectResponse
*/
public function store(StoreMenuRequest $request)
{
$this->menu->create($request->except('_token'));
return redirect()->route('admin.menus.index')->withFlashSuccess(trans('alerts.backend.menus.created'));
return new RedirectResponse(route('admin.menus.index'), ['flash_success' => trans('alerts.backend.menus.created')]);
}
/**
......@@ -75,21 +101,11 @@ class MenuController extends Controller
* @param \App\Models\Menu\Menu $menu
* @param \App\Http\Requests\Backend\Menu\EditMenuRequest $request
*
* @return \Illuminate\Http\Response
* @return \App\Http\Responses\Backend\Menu\EditResponse
*/
public function edit(Menu $menu, EditMenuRequest $request)
{
$types = [
'backend' => 'Backend',
'frontend' => 'Frontend',
];
$modules = DB::table('modules')->get();
return view('backend.menus.edit')
->with('types', $types)
->with('menu', $menu)
->with('modules', $modules);
return new EditResponse($menu, $this->types, $this->modules);
}
/**
......@@ -98,15 +114,13 @@ class MenuController extends Controller
* @param \App\Models\Menu\Menu $menu
* @param \App\Http\Requests\Backend\Menu\UpdateMenuRequest $request
*
* @return \Illuminate\Http\Response
* @return \App\Http\Responses\RedirectResponse
*/
public function update(Menu $menu, UpdateMenuRequest $request)
{
$this->menu->update($menu, $request->all());
return redirect()
->route('admin.menus.index')
->with('flash_success', trans('alerts.backend.menus.updated'));
return new RedirectResponse(route('admin.menus.index'), ['flash_success' => trans('alerts.backend.menus.updated')]);
}
/**
......@@ -115,14 +129,12 @@ class MenuController extends Controller
* @param \App\Models\Menu\Menu $menu
* @param \App\Http\Requests\Backend\Menu\DeleteMenuRequest $request
*
* @return \Illuminate\Http\Response
* @return \App\Http\Responses\RedirectResponse
*/
public function destroy(Menu $menu, DeleteMenuRequest $request)
{
$this->menu->delete($menu);
return redirect()
->route('admin.menus.index')
->with('flash_success', trans('alerts.backend.menus.deleted'));
return new RedirectResponse(route('admin.menus.index'), ['flash_success' => trans('alerts.backend.menus.deleted')]);
}
}
......@@ -2,15 +2,18 @@
namespace App\Http\Controllers\Backend\Pages;
use App\Models\Page\Page;
use App\Http\Controllers\Controller;
use App\Http\Responses\ViewResponse;
use App\Http\Responses\RedirectResponse;
use App\Http\Responses\Backend\Page\EditResponse;
use App\Repositories\Backend\Pages\PagesRepository;
use App\Http\Requests\Backend\Pages\EditPageRequest;
use App\Http\Requests\Backend\Pages\StorePageRequest;
use App\Http\Requests\Backend\Pages\CreatePageRequest;
use App\Http\Requests\Backend\Pages\DeletePageRequest;
use App\Http\Requests\Backend\Pages\EditPageRequest;
use App\Http\Requests\Backend\Pages\ManagePageRequest;
use App\Http\Requests\Backend\Pages\StorePageRequest;
use App\Http\Requests\Backend\Pages\UpdatePageRequest;
use App\Models\Page\Page;
use App\Repositories\Backend\Pages\PagesRepository;
/**
* Class PagesController.
......@@ -30,70 +33,69 @@ class PagesController extends Controller
/**
* @param \App\Http\Requests\Backend\Pages\ManagePageRequest $request
*
* @return mixed
* @return \App\Http\Responses\ViewResponse
*/
public function index(ManagePageRequest $request)
{
return view('backend.pages.index');
return new ViewResponse('backend.pages.index');
}
/**
* @param \App\Http\Requests\Backend\Pages\CreatePageRequest $request
*
* @return mixed
* @return \App\Http\Responses\ViewResponse
*/
public function create(CreatePageRequest $request)
{
return view('backend.pages.create');
return new ViewResponse('backend.pages.create');
}
/**
* @param \App\Http\Requests\Backend\Pages\StorePageRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function store(StorePageRequest $request)
{
$this->pages->create($request->except(['_token']));
return redirect()->route('admin.pages.index')->withFlashSuccess(trans('alerts.backend.pages.created'));
return new RedirectResponse(route('admin.pages.index'), ['flash_success' => trans('alerts.backend.pages.created')]);
}
/**
* @param \App\Models\Page\Page $page
* @param \App\Http\Requests\Backend\Pages\EditPageRequest $request
*
* @return mixed
* @return \App\Http\Responses\Backend\Page\EditResponse
*/
public function edit(Page $page, EditPageRequest $request)
{
return view('backend.pages.edit')
->withPage($page);
return new EditResponse($page);
}
/**
* @param \App\Models\Page\Page $page
* @param \App\Http\Requests\Backend\Pages\UpdatePageRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function update(Page $page, UpdatePageRequest $request)
{
$this->pages->update($page, $request->except(['_method', '_token']));
return redirect()->route('admin.pages.index')->withFlashSuccess(trans('alerts.backend.pages.updated'));
return new RedirectResponse(route('admin.pages.index'), ['flash_success' => trans('alerts.backend.pages.updated')]);
}
/**
* @param \App\Models\Page\Page $page
* @param \App\Http\Requests\Backend\Pages\DeletePageRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function destroy(Page $page, DeletePageRequest $request)
{
$this->pages->delete($page);
return redirect()->route('admin.pages.index')->withFlashSuccess(trans('alerts.backend.pages.deleted'));
return new RedirectResponse(route('admin.pages.index'), ['flash_success' => trans('alerts.backend.pages.deleted')]);
}
}
......@@ -2,11 +2,13 @@
namespace App\Http\Controllers\Backend\Settings;
use App\Models\Settings\Setting;
use App\Http\Controllers\Controller;
use App\Http\Responses\RedirectResponse;
use App\Http\Responses\Backend\Setting\EditResponse;
use App\Repositories\Backend\Settings\SettingsRepository;
use App\Http\Requests\Backend\Settings\ManageSettingsRequest;
use App\Http\Requests\Backend\Settings\UpdateSettingsRequest;
use App\Models\Settings\Setting;
use App\Repositories\Backend\Settings\SettingsRepository;
/**
* Class SettingsController.
......@@ -27,26 +29,23 @@ class SettingsController extends Controller
* @param \App\Models\Settings\Setting $setting
* @param \App\Http\Requests\Backend\Settings\ManageSettingsRequest $request
*
* @return mixed
* @return \App\Http\Responses\Backend\Setting\EditResponse
*/
public function edit(Setting $setting, ManageSettingsRequest $request)
{
return view('backend.settings.edit')
->withSetting($setting);
return new EditResponse($setting);
}
/**
* @param \App\Models\Settings\Setting $setting
* @param \App\Http\Requests\Backend\Settings\UpdateSettingsRequest $request
*
* @return mixed
* @return \App\Http\Responses\RedirectResponse
*/
public function update(Setting $setting, UpdateSettingsRequest $request)
{
$this->settings->update($setting, $request->except(['_token', '_method']));
return redirect()
->route('admin.settings.edit', $setting->id)
->with('flash_success', trans('alerts.backend.settings.updated'));
return new RedirectResponse(route('admin.settings.edit', $setting->id), ['flash_success' => trans('alerts.backend.settings.updated')]);
}
}
<?php
namespace App\Http\Responses\Backend\Access\User;
namespace App\Http\Responses\Backend\Access\Permission;
use Illuminate\Contracts\Support\Responsable;
class ShowResponse implements Responsable
class CreateResponse implements Responsable
{
/**
* @var \App\Models\Access\User\User
* @var \App\Repositories\Backend\Access\Permission\PermissionRepository
*/
protected $user;
protected $permissions;
/**
* @param \App\Models\Access\User\User $user
* @param \App\Repositories\Backend\Access\Permission\PermissionRepository $permissions
*/
public function __construct($user)
public function __construct($permissions)
{
$this->user = $user;
$this->permissions = $permissions;
}
/**
......@@ -28,6 +28,7 @@ class ShowResponse implements Responsable
*/
public function toResponse($request)
{
return view('backend.access.users.show')->withUser($this->user);
return view('backend.access.permissions.create')
->withPermissionCount($this->permissions->getCount());
}
}
<?php
namespace App\Http\Responses\Backend\Access\Permission;
use Illuminate\Contracts\Support\Responsable;
class EditResponse implements Responsable
{
/**
* @var \App\Models\Access\Permission\Permission
*/
protected $permission;
/**
* @param \App\Models\Access\Permission\Permission $permission
*/
public function __construct($permission)
{
$this->permission = $permission;
}
/**
* toReponse
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function toResponse($request)
{
return view('backend.access.permissions.edit')
->withPermission($this->permission);
}
}
<?php
namespace App\Http\Responses\Backend\Menu;
use Illuminate\Contracts\Support\Responsable;
class EditResponse implements Responsable
{
/**
* @var \App\Models\BlogCategories\BlogCategory
*/
protected $blogCategory;
/**
* @param \App\Models\BlogCategories\BlogCategory $blogCategory
*/
public function __construct($blogCategory, $types, $modules)
{
$this->blogCategory = $blogCategory;
}
/**
* toReponse
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function toResponse($request)
{
return view('backend.blogcategories.edit')
->with('blogcategory', $this->blogCategory);
}
}
<?php
namespace App\Http\Responses\Backend\BlogTag;
use Illuminate\Contracts\Support\Responsable;
class EditResponse implements Responsable
{
/**
* @var \App\Models\BlogTags\BlogTag
*/
protected $blogTag;
/**
* @param \App\Models\BlogTags\BlogTag $blogTag
*/
public function __construct($blogTag)
{
$this->blogTag = $blogTag;
}
/**
* toReponse
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function toResponse($request)
{
return view('backend.blogtags.edit')
->with('blogtag', $this->blogTag);
}
}
<?php
namespace App\Http\Responses\Backend\Faq;
use Illuminate\Contracts\Support\Responsable;
class EditResponse implements Responsable
{
/**
* @var \App\Models\Faqs\Faq
*/
protected $faq;
/**
* @param \App\Models\Faqs\Faq $faq
*/
public function __construct($faq)
{
$this->faq = $faq;
}
/**
* toReponse
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function toResponse($request)
{
return view('backend.faqs.edit')
->with('faq', $this->faq);
}
}
<?php
namespace App\Http\Responses\Backend\Menu;
use Illuminate\Contracts\Support\Responsable;
class CreateResponse implements Responsable
{
/**
* @var Array
*/
protected $types;
/**
* @var \Bvipul\Generator\Module
*/
protected $modules;
/**
* @param Array $types
* @param \Bvipul\Generator\Module $modules
*/
public function __construct($types, $modules)
{
$this->types = $types;
$this->modules = $modules;
}
/**
* In Response.
*
* @param \App\Http\Requests\Request $request
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function toResponse($request)
{
return view('backend.menus.create')
->withTypes($this->types)
->withModules($this->modules->all());
}
}
<?php
namespace App\Http\Responses\Backend\Menu;
use Illuminate\Contracts\Support\Responsable;
class EditResponse implements Responsable
{
/**
* @var Array
*/
protected $types;
/**
* @var \Bvipul\Generator\Module
*/
protected $modules;
/**
* @var \App\Models\Menu\Menu
*/
protected $menu;
/**
* @param \App\Models\Menu\Menu $menu
* @param Array $types
* @param \Bvipul\Generator\Module $modules
*/
public function __construct($menu, $types, $modules)
{
$this->menu = $menu;
$this->types = $types;
$this->modules = $modules;
}
/**
* toReponse
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function toResponse($request)
{
return view('backend.menus.edit')
->with('types', $this->types)
->with('menu', $this->menu)
->with('modules', $this->modules->all());
}
}
<?php
namespace App\Http\Responses\Backend\Page;
use Illuminate\Contracts\Support\Responsable;
class EditResponse implements Responsable
{
/**
* @var \App\Models\Page\Page
*/
protected $page;
/**
* @param \App\Models\Page\Page $page
*/
public function __construct($page)
{
$this->page = $page;
}
/**
* toReponse
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function toResponse($request)
{
return view('backend.pages.edit')
->withPage($this->page);
}
}
<?php
namespace App\Http\Responses\Backend\Setting;
use Illuminate\Contracts\Support\Responsable;
class EditResponse implements Responsable
{
/**
* @var \App\Models\Settings\Setting
*/
protected $setting;
/**
* @param \App\Models\Settings\Setting $setting
*/
public function __construct($setting)
{
$this->setting = $setting;
}
/**
* toReponse
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function toResponse($request)
{
return view('backend.settings.edit')
->withSetting($this->setting);
}
}
......@@ -18,7 +18,7 @@ class RedirectResponse implements Responsable
public function toResponse($request)
{
return redirect()
->route($this->route)
->to($this->route)
->with($this->message);
}
}
......@@ -748,7 +748,7 @@ var Backend = {}; // common variable used in all the files of the backend
setSelectors: function () {
this.selector.searchInput = document.querySelector("div.dataTables_filter input");
this.selector.columnSearchInput = document.querySelectorAll(".search-input-text");
this.selector.columnSelectInput = document.querySelectorAll('search-input-select');
this.selector.columnSelectInput = document.querySelectorAll(".search-input-select");
this.selector.restButton = document.querySelectorAll('.reset-data');
this.setSelectors.copyButton = document.getElementById("copyButton");
this.setSelectors.csvButton = document.getElementById("csvButton");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment