Commit e8bd9d7d authored by Vipul Basapati's avatar Vipul Basapati Committed by StyleCI Bot

Apply fixes from StyleCI

parent bf7ae98d
...@@ -2,16 +2,15 @@ ...@@ -2,16 +2,15 @@
namespace App\Http\Controllers\Backend\Menu; namespace App\Http\Controllers\Backend\Menu;
use App\Models\Menu\Menu;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Repositories\Backend\Menu\MenuRepository;
use App\Http\Requests\Backend\Menu\StoreMenuRequest;
use App\Http\Requests\Backend\Menu\ManageMenuRequest;
use App\Http\Requests\Backend\Menu\CreateMenuRequest; use App\Http\Requests\Backend\Menu\CreateMenuRequest;
use App\Http\Requests\Backend\Menu\EditMenuRequest;
use App\Http\Requests\Backend\Menu\DeleteMenuRequest; 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\Http\Requests\Backend\Menu\UpdateMenuRequest;
use App\Models\Menu\Menu;
use App\Repositories\Backend\Menu\MenuRepository;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
class MenuController extends Controller class MenuController extends Controller
...@@ -28,6 +27,7 @@ class MenuController extends Controller ...@@ -28,6 +27,7 @@ class MenuController extends Controller
/** /**
* Display a listing of the resource. * Display a listing of the resource.
*
* @param \App\Http\Requests\Backend\Menu\ManageMenuRequest $request * @param \App\Http\Requests\Backend\Menu\ManageMenuRequest $request
* *
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
...@@ -39,6 +39,7 @@ class MenuController extends Controller ...@@ -39,6 +39,7 @@ class MenuController extends Controller
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
*
* @param \App\Http\Requests\Backend\Menu\CreateMenuRequest $request * @param \App\Http\Requests\Backend\Menu\CreateMenuRequest $request
* *
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
...@@ -46,15 +47,17 @@ class MenuController extends Controller ...@@ -46,15 +47,17 @@ class MenuController extends Controller
public function create(CreateMenuRequest $request) public function create(CreateMenuRequest $request)
{ {
$types = [ $types = [
"backend" => "Backend", 'backend' => 'Backend',
"frontend" => "Frontend" 'frontend' => 'Frontend',
]; ];
$modules = DB::table('modules')->get(); $modules = DB::table('modules')->get();
return view('backend.menus.create')->withTypes($types)->withModules($modules); return view('backend.menus.create')->withTypes($types)->withModules($modules);
} }
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
*
* @param \App\Http\Requests\Backend\Menu\StoreMenuRequest $request * @param \App\Http\Requests\Backend\Menu\StoreMenuRequest $request
* *
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
...@@ -68,15 +71,17 @@ class MenuController extends Controller ...@@ -68,15 +71,17 @@ class MenuController extends Controller
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.
*
* @param \App\Models\Menu\Menu $menu * @param \App\Models\Menu\Menu $menu
* @param \App\Http\Requests\Backend\Menu\EditMenuRequest $request * @param \App\Http\Requests\Backend\Menu\EditMenuRequest $request
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function edit(Menu $menu, EditMenuRequest $request) public function edit(Menu $menu, EditMenuRequest $request)
{ {
$types = [ $types = [
"backend" => "Backend", 'backend' => 'Backend',
"frontend" => "Frontend" 'frontend' => 'Frontend',
]; ];
$modules = DB::table('modules')->get(); $modules = DB::table('modules')->get();
...@@ -106,8 +111,10 @@ class MenuController extends Controller ...@@ -106,8 +111,10 @@ class MenuController extends Controller
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
*
* @param \App\Models\Menu\Menu $menu * @param \App\Models\Menu\Menu $menu
* @param \App\Http\Requests\Backend\Menu\DeleteMenuRequest $request * @param \App\Http\Requests\Backend\Menu\DeleteMenuRequest $request
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function destroy(Menu $menu, DeleteMenuRequest $request) public function destroy(Menu $menu, DeleteMenuRequest $request)
......
...@@ -9,6 +9,7 @@ class MenuFormController extends Controller ...@@ -9,6 +9,7 @@ class MenuFormController extends Controller
{ {
/** /**
* Get the form for modal popup. * Get the form for modal popup.
*
* @param string $formName * @param string $formName
* @param \App\Http\Requests\Backend\Menu\CreateMenuRequest * @param \App\Http\Requests\Backend\Menu\CreateMenuRequest
* *
...@@ -16,10 +17,10 @@ class MenuFormController extends Controller ...@@ -16,10 +17,10 @@ class MenuFormController extends Controller
*/ */
public function create($formName, CreateMenuRequest $request) public function create($formName, CreateMenuRequest $request)
{ {
if(in_array($formName, ['_add_custom_url_form'])) if (in_array($formName, ['_add_custom_url_form'])) {
{
return view('backend.menus.'.$formName); return view('backend.menus.'.$formName);
} }
return abort(404); return abort(404);
} }
} }
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
namespace App\Http\Controllers\Backend\Menu; namespace App\Http\Controllers\Backend\Menu;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Yajra\DataTables\Facades\DataTables;
use App\Repositories\Backend\Menu\MenuRepository;
use App\Http\Requests\Backend\Menu\ManageMenuRequest; use App\Http\Requests\Backend\Menu\ManageMenuRequest;
use App\Repositories\Backend\Menu\MenuRepository;
use Carbon\Carbon; use Carbon\Carbon;
use Yajra\DataTables\Facades\DataTables;
/** /**
* Class MenuTableController. * Class MenuTableController.
......
...@@ -5,7 +5,7 @@ namespace App\Http\Requests\Backend\Menu; ...@@ -5,7 +5,7 @@ namespace App\Http\Requests\Backend\Menu;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* Class CreateMenuRequest * Class CreateMenuRequest.
*/ */
class CreateMenuRequest extends Request class CreateMenuRequest extends Request
{ {
......
...@@ -5,7 +5,7 @@ namespace App\Http\Requests\Backend\Menu; ...@@ -5,7 +5,7 @@ namespace App\Http\Requests\Backend\Menu;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* Class DeleteMenuRequest * Class DeleteMenuRequest.
*/ */
class DeleteMenuRequest extends Request class DeleteMenuRequest extends Request
{ {
......
...@@ -5,7 +5,7 @@ namespace App\Http\Requests\Backend\Menu; ...@@ -5,7 +5,7 @@ namespace App\Http\Requests\Backend\Menu;
use App\Http\Requests\Request; use App\Http\Requests\Request;
/** /**
* Class EditMenuRequest * Class EditMenuRequest.
*/ */
class EditMenuRequest extends Request class EditMenuRequest extends Request
{ {
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
namespace App\Models\Menu; namespace App\Models\Menu;
use Illuminate\Database\Eloquent\Model;
use App\Models\ModelTrait;
use App\Models\Menu\Traits\Attribute\MenuAttribute; use App\Models\Menu\Traits\Attribute\MenuAttribute;
use App\Models\ModelTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
class Menu extends Model class Menu extends Model
...@@ -25,12 +25,12 @@ class Menu extends Model ...@@ -25,12 +25,12 @@ class Menu extends Model
protected $fillable = [ protected $fillable = [
'name', 'name',
'type', 'type',
'items' 'items',
]; ];
public function __construct(array $attributes = []) public function __construct(array $attributes = [])
{ {
parent::__construct($attributes); parent::__construct($attributes);
$this->table = config("access.menus_table"); $this->table = config('access.menus_table');
} }
} }
...@@ -13,8 +13,8 @@ trait MenuAttribute ...@@ -13,8 +13,8 @@ trait MenuAttribute
public function getActionButtonsAttribute() public function getActionButtonsAttribute()
{ {
return '<div class="btn-group action-btn"> return '<div class="btn-group action-btn">
' .$this->getEditButtonAttribute('edit-menu', 'admin.menus.edit'). ' '.$this->getEditButtonAttribute('edit-menu', 'admin.menus.edit').'
' .$this->getDeleteButtonAttribute('delete-menu', 'admin.menus.destroy'). ' '.$this->getDeleteButtonAttribute('delete-menu', 'admin.menus.destroy').'
</div>'; </div>';
} }
} }
...@@ -2,11 +2,10 @@ ...@@ -2,11 +2,10 @@
namespace App\Repositories\Backend\Menu; namespace App\Repositories\Backend\Menu;
use App\Repositories\BaseRepository;
use App\Exceptions\GeneralException; use App\Exceptions\GeneralException;
use App\Models\Menu\Menu; use App\Models\Menu\Menu;
use App\Repositories\BaseRepository;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use DB;
/** /**
* Class MenuRepository. * Class MenuRepository.
...@@ -63,10 +62,9 @@ class MenuRepository extends BaseRepository ...@@ -63,10 +62,9 @@ class MenuRepository extends BaseRepository
* *
* return bool * return bool
*/ */
public function update(Menu $menu, array $input) public function update(Menu $menu, array $input)
{ {
if ($this->query()->where('name', $input['name'])->where("id", '!=', $menu->id)->first()) { if ($this->query()->where('name', $input['name'])->where('id', '!=', $menu->id)->first()) {
throw new GeneralException(trans('exceptions.backend.menus.already_exists')); throw new GeneralException(trans('exceptions.backend.menus.already_exists'));
} }
...@@ -77,7 +75,6 @@ class MenuRepository extends BaseRepository ...@@ -77,7 +75,6 @@ class MenuRepository extends BaseRepository
} }
throw new GeneralException(trans('exceptions.backend.menus.update_error')); throw new GeneralException(trans('exceptions.backend.menus.update_error'));
} }
/** /**
......
<?php <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateMenusTable extends Migration class CreateMenusTable extends Migration
{ {
......
<?php <?php
use Carbon\Carbon; use Carbon\Carbon;
use Database\TruncateTable;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
...@@ -18,10 +17,10 @@ class MenuTableSeeder extends Seeder ...@@ -18,10 +17,10 @@ class MenuTableSeeder extends Seeder
$menu = [ $menu = [
'id' => 1, 'id' => 1,
'type' => 'backend', 'type' => 'backend',
'name' => "Backend Sidebar Menu", 'name' => 'Backend Sidebar Menu',
'items' => '[{"view_permission_id":"view-access-management","icon":"fa-users","open_in_new_tab":0,"url_type":"route","url":"","name":"Access Management","id":11,"content":"Access Management","children":[{"view_permission_id":"view-user-management","open_in_new_tab":0,"url_type":"route","url":"admin.access.user.index","name":"User Management","id":12,"content":"User Management"},{"view_permission_id":"view-role-management","open_in_new_tab":0,"url_type":"route","url":"admin.access.role.index","name":"Role Management","id":13,"content":"Role Management"},{"view_permission_id":"view-permission-management","open_in_new_tab":0,"url_type":"route","url":"admin.access.permission.index","name":"Permission Management","id":14,"content":"Permission Management"}]},{"view_permission_id":"view-module","icon":"fa-wrench","open_in_new_tab":0,"url_type":"route","url":"admin.modules.index","name":"Module","id":1,"content":"Module"},{"view_permission_id":"view-menu","icon":"fa-bars","open_in_new_tab":0,"url_type":"route","url":"admin.menus.index","name":"Menus","id":3,"content":"Menus"},{"view_permission_id":"view-page","icon":"fa-file-text","open_in_new_tab":0,"url_type":"route","url":"admin.pages.index","name":"Pages","id":2,"content":"Pages"},{"view_permission_id":"view-email-template","icon":"fa-envelope","open_in_new_tab":0,"url_type":"route","url":"admin.emailtemplates.index","name":"Email Templates","id":8,"content":"Email Templates"},{"view_permission_id":"edit-settings","icon":"fa-gear","open_in_new_tab":0,"url_type":"route","url":"admin.settings.edit?id=1","name":"Settings","id":9,"content":"Settings"},{"view_permission_id":"view-blog","icon":"fa-commenting","open_in_new_tab":0,"url_type":"route","url":"","name":"Blog Management","id":15,"content":"Blog Management","children":[{"view_permission_id":"view-blog-category","open_in_new_tab":0,"url_type":"route","url":"admin.blogcategories.index","name":"Blog Category Management","id":16,"content":"Blog Category Management"},{"view_permission_id":"view-blog-tag","open_in_new_tab":0,"url_type":"route","url":"admin.blogtags.index","name":"Blog Tag Management","id":17,"content":"Blog Tag Management"},{"view_permission_id":"view-blog","open_in_new_tab":0,"url_type":"route","url":"admin.blogs.index","name":"Blog Management","id":18,"content":"Blog Management"}]},{"view_permission_id":"view-faq","icon":"fa-question-circle","open_in_new_tab":0,"url_type":"route","url":"admin.faqs.index","name":"Faq Management","id":19,"content":"Faq Management"}]', 'items' => '[{"view_permission_id":"view-access-management","icon":"fa-users","open_in_new_tab":0,"url_type":"route","url":"","name":"Access Management","id":11,"content":"Access Management","children":[{"view_permission_id":"view-user-management","open_in_new_tab":0,"url_type":"route","url":"admin.access.user.index","name":"User Management","id":12,"content":"User Management"},{"view_permission_id":"view-role-management","open_in_new_tab":0,"url_type":"route","url":"admin.access.role.index","name":"Role Management","id":13,"content":"Role Management"},{"view_permission_id":"view-permission-management","open_in_new_tab":0,"url_type":"route","url":"admin.access.permission.index","name":"Permission Management","id":14,"content":"Permission Management"}]},{"view_permission_id":"view-module","icon":"fa-wrench","open_in_new_tab":0,"url_type":"route","url":"admin.modules.index","name":"Module","id":1,"content":"Module"},{"view_permission_id":"view-menu","icon":"fa-bars","open_in_new_tab":0,"url_type":"route","url":"admin.menus.index","name":"Menus","id":3,"content":"Menus"},{"view_permission_id":"view-page","icon":"fa-file-text","open_in_new_tab":0,"url_type":"route","url":"admin.pages.index","name":"Pages","id":2,"content":"Pages"},{"view_permission_id":"view-email-template","icon":"fa-envelope","open_in_new_tab":0,"url_type":"route","url":"admin.emailtemplates.index","name":"Email Templates","id":8,"content":"Email Templates"},{"view_permission_id":"edit-settings","icon":"fa-gear","open_in_new_tab":0,"url_type":"route","url":"admin.settings.edit?id=1","name":"Settings","id":9,"content":"Settings"},{"view_permission_id":"view-blog","icon":"fa-commenting","open_in_new_tab":0,"url_type":"route","url":"","name":"Blog Management","id":15,"content":"Blog Management","children":[{"view_permission_id":"view-blog-category","open_in_new_tab":0,"url_type":"route","url":"admin.blogcategories.index","name":"Blog Category Management","id":16,"content":"Blog Category Management"},{"view_permission_id":"view-blog-tag","open_in_new_tab":0,"url_type":"route","url":"admin.blogtags.index","name":"Blog Tag Management","id":17,"content":"Blog Tag Management"},{"view_permission_id":"view-blog","open_in_new_tab":0,"url_type":"route","url":"admin.blogs.index","name":"Blog Management","id":18,"content":"Blog Management"}]},{"view_permission_id":"view-faq","icon":"fa-question-circle","open_in_new_tab":0,"url_type":"route","url":"admin.faqs.index","name":"Faq Management","id":19,"content":"Faq Management"}]',
'created_by' => 1, 'created_by' => 1,
'created_at' => Carbon::now() 'created_at' => Carbon::now(),
]; ];
DB::table(config('access.menus_table'))->insert($menu); DB::table(config('access.menus_table'))->insert($menu);
......
...@@ -6,7 +6,6 @@ use Illuminate\Support\Facades\DB; ...@@ -6,7 +6,6 @@ use Illuminate\Support\Facades\DB;
class ModulesTableSeeder extends Seeder class ModulesTableSeeder extends Seeder
{ {
/** /**
* Run the database seeds. * Run the database seeds.
* *
...@@ -22,98 +21,98 @@ class ModulesTableSeeder extends Seeder ...@@ -22,98 +21,98 @@ class ModulesTableSeeder extends Seeder
'url' => null, 'url' => null,
'view_permission_id' => 'view-access-management', 'view_permission_id' => 'view-access-management',
'created_by' => 1, 'created_by' => 1,
'created_at' => Carbon::now() 'created_at' => Carbon::now(),
], ],
[ [
'name' => trans('labels.backend.access.users.management'), 'name' => trans('labels.backend.access.users.management'),
'url' => 'admin.access.user.index', 'url' => 'admin.access.user.index',
'view_permission_id' => 'view-user-management', 'view_permission_id' => 'view-user-management',
'created_by' => 1, 'created_by' => 1,
'created_at' => Carbon::now() 'created_at' => Carbon::now(),
], ],
[ [
'name' => trans('labels.backend.access.roles.management'), 'name' => trans('labels.backend.access.roles.management'),
'url' => 'admin.access.role.index', 'url' => 'admin.access.role.index',
'view_permission_id' => 'view-role-management', 'view_permission_id' => 'view-role-management',
'created_by' => 1, 'created_by' => 1,
'created_at' => Carbon::now() 'created_at' => Carbon::now(),
], ],
[ [
'name' => trans('labels.backend.access.permissions.management'), 'name' => trans('labels.backend.access.permissions.management'),
'url' => 'admin.access.permission.index', 'url' => 'admin.access.permission.index',
'view_permission_id' => 'view-permission-management', 'view_permission_id' => 'view-permission-management',
'created_by' => 1, 'created_by' => 1,
'created_at' => Carbon::now() 'created_at' => Carbon::now(),
], ],
[ [
'name' => trans('labels.backend.menus.title'), 'name' => trans('labels.backend.menus.title'),
'url' => 'admin.menus.index', 'url' => 'admin.menus.index',
'view_permission_id' => 'view-menu', 'view_permission_id' => 'view-menu',
'created_by' => 1, 'created_by' => 1,
'created_at' => Carbon::now() 'created_at' => Carbon::now(),
], ],
[ [
'name' => trans('labels.backend.modules.title'), 'name' => trans('labels.backend.modules.title'),
'url' => 'admin.modules.index', 'url' => 'admin.modules.index',
'view_permission_id' => 'view-module', 'view_permission_id' => 'view-module',
'created_by' => 1, 'created_by' => 1,
'created_at' => Carbon::now() 'created_at' => Carbon::now(),
], ],
[ [
'name' => trans('labels.backend.pages.title'), 'name' => trans('labels.backend.pages.title'),
'url' => 'admin.pages.index', 'url' => 'admin.pages.index',
'view_permission_id' => 'view-page', 'view_permission_id' => 'view-page',
'created_by' => 1, 'created_by' => 1,
'created_at' => Carbon::now() 'created_at' => Carbon::now(),
], ],
[ [
'name' => trans('labels.backend.emailtemplates.title'), 'name' => trans('labels.backend.emailtemplates.title'),
'url' => 'admin.emailtemplates.index', 'url' => 'admin.emailtemplates.index',
'view_permission_id' => 'view-email-template', 'view_permission_id' => 'view-email-template',
'created_by' => 1, 'created_by' => 1,
'created_at' => Carbon::now() 'created_at' => Carbon::now(),
], ],
[ [
'name' => trans('labels.backend.settings.title'), 'name' => trans('labels.backend.settings.title'),
'url' => 'admin.settings.edit', 'url' => 'admin.settings.edit',
'view_permission_id' => 'edit-settings', 'view_permission_id' => 'edit-settings',
'created_by' => 1, 'created_by' => 1,
'created_at' => Carbon::now() 'created_at' => Carbon::now(),
], ],
[ [
'name' => trans('menus.backend.blog.management'), 'name' => trans('menus.backend.blog.management'),
'url' => null, 'url' => null,
'view_permission_id' => 'view-blog', 'view_permission_id' => 'view-blog',
'created_by' => 1, 'created_by' => 1,
'created_at' => Carbon::now() 'created_at' => Carbon::now(),
], ],
[ [
'name' => trans('menus.backend.blogcategories.management'), 'name' => trans('menus.backend.blogcategories.management'),
'url' => 'admin.blogcategories.index', 'url' => 'admin.blogcategories.index',
'view_permission_id' => 'view-blog-category', 'view_permission_id' => 'view-blog-category',
'created_by' => 1, 'created_by' => 1,
'created_at' => Carbon::now() 'created_at' => Carbon::now(),
], ],
[ [
'name' => trans('menus.backend.blogtags.management'), 'name' => trans('menus.backend.blogtags.management'),
'url' => 'admin.blogtags.index', 'url' => 'admin.blogtags.index',
'view_permission_id' => 'view-blog-tag', 'view_permission_id' => 'view-blog-tag',
'created_by' => 1, 'created_by' => 1,
'created_at' => Carbon::now() 'created_at' => Carbon::now(),
], ],
[ [
'name' => trans('menus.backend.blog.management'), 'name' => trans('menus.backend.blog.management'),
'url' => 'admin.blogs.index', 'url' => 'admin.blogs.index',
'view_permission_id' => 'view-blog', 'view_permission_id' => 'view-blog',
'created_by' => 1, 'created_by' => 1,
'created_at' => Carbon::now() 'created_at' => Carbon::now(),
], ],
[ [
'name' => trans('menus.backend.faqs.management'), 'name' => trans('menus.backend.faqs.management'),
'url' => 'admin.faqs.index', 'url' => 'admin.faqs.index',
'view_permission_id' => 'view-faq', 'view_permission_id' => 'view-faq',
'created_by' => 1, 'created_by' => 1,
'created_at' => Carbon::now() 'created_at' => Carbon::now(),
], ],
]; ];
......
<?php <?php
/** /**
* Menu Management * Menu Management.
*/ */
Route::group(['namespace' => 'Menu'], function () { Route::group(['namespace' => 'Menu'], function () {
Route::resource('menus', 'MenuController', ['except' => []]); Route::resource('menus', 'MenuController', ['except' => []]);
......
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