Commit 43902b10 authored by Vipul Basapati's avatar Vipul Basapati

Added Menu Module

parent 7a2f2dcb
......@@ -15,4 +15,5 @@ require __DIR__.'/Blog_Category.php';
require __DIR__.'/Blog_Tag.php';
require __DIR__.'/Blog_Management.php';
require __DIR__.'/Faqs.php';
require __DIR__.'/Menu.php';
require __DIR__.'/LogViewer.php';
<?php
Breadcrumbs::register('admin.menus.index', function ($breadcrumbs) {
$breadcrumbs->parent('admin.dashboard');
$breadcrumbs->push(trans('menus.backend.menus.management'), route('admin.menus.index'));
});
Breadcrumbs::register('admin.menus.create', function ($breadcrumbs) {
$breadcrumbs->parent('admin.menus.index');
$breadcrumbs->push(trans('menus.backend.menus.create'), route('admin.menus.create'));
});
Breadcrumbs::register('admin.menus.edit', function ($breadcrumbs, $id) {
$breadcrumbs->parent('admin.menus.index');
$breadcrumbs->push(trans('menus.backend.menus.edit'), route('admin.menus.edit', $id));
});
<?php
namespace App\Http\Controllers\Backend\Menu;
use App\Models\Menu\Menu;
use Illuminate\Http\Request;
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\EditMenuRequest;
use App\Http\Requests\Backend\Menu\DeleteMenuRequest;
use App\Http\Requests\Backend\Menu\UpdateMenuRequest;
use Illuminate\Support\Facades\DB;
class MenuController extends Controller
{
protected $menu;
/**
* @param \App\Repositories\Backend\Menu\MenuRepository $menu
*/
public function __construct(MenuRepository $menu)
{
$this->menu = $menu;
}
/**
* Display a listing of the resource.
* @param \App\Http\Requests\Backend\Menu\ManageMenuRequest $request
*
* @return \Illuminate\Http\Response
*/
public function index(ManageMenuRequest $request)
{
return view('backend.menus.index');
}
/**
* Show the form for creating a new resource.
* @param \App\Http\Requests\Backend\Menu\CreateMenuRequest $request
*
* @return \Illuminate\Http\Response
*/
public function create(CreateMenuRequest $request)
{
$types = [
"backend" => "Backend",
"frontend" => "Frontend"
];
$modules = DB::table('modules')->get();
return view('backend.menus.create')->withTypes($types)->withModules($modules);
}
/**
* Store a newly created resource in storage.
* @param \App\Http\Requests\Backend\Menu\StoreMenuRequest $request
*
* @return \Illuminate\Http\Response
*/
public function store(StoreMenuRequest $request)
{
$this->menu->create($request->except('_token'));
return redirect()->route('admin.menus.index')->withFlashSuccess(trans('alerts.backend.menus.created'));
}
/**
* Show the form for editing the specified resource.
* @param \App\Models\Menu\Menu $menu
* @param \App\Http\Requests\Backend\Menu\EditMenuRequest $request
* @return \Illuminate\Http\Response
*/
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);
}
/**
* Update the specified resource in storage.
*
* @param \App\Models\Menu\Menu $menu
* @param \App\Http\Requests\Backend\Menu\UpdateMenuRequest $request
*
* @return \Illuminate\Http\Response
*/
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'));
}
/**
* Remove the specified resource from storage.
* @param \App\Models\Menu\Menu $menu
* @param \App\Http\Requests\Backend\Menu\DeleteMenuRequest $request
* @return \Illuminate\Http\Response
*/
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'));
}
}
<?php
namespace App\Http\Controllers\Backend\Menu;
use App\Http\Controllers\Controller;
use App\Http\Requests\Backend\Menu\CreateMenuRequest;
class MenuFormController extends Controller
{
/**
* Get the form for modal popup.
* @param string $formName
* @param \App\Http\Requests\Backend\Menu\CreateMenuRequest
*
* @return \Illuminate\Http\Response
*/
public function create($formName, CreateMenuRequest $request)
{
if(in_array($formName, ['_add_custom_url_form']))
{
return view('backend.menus.'.$formName);
}
return abort(404);
}
}
\ No newline at end of file
<?php
namespace App\Http\Controllers\Backend\Menu;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Yajra\DataTables\Facades\DataTables;
use App\Repositories\Backend\Menu\MenuRepository;
use App\Http\Requests\Backend\Menu\ManageMenuRequest;
use Carbon\Carbon;
/**
* Class MenuTableController.
*/
class MenuTableController extends Controller
{
protected $menus;
/**
* @param \App\Repositories\Backend\Menu\MenuRepository $menus
*/
public function __construct(MenuRepository $menus)
{
$this->menus = $menus;
}
/**
* @param \App\Http\Requests\Backend\Menu\ManageMenuRequest $request
*
* @return mixed
*/
public function __invoke(ManageMenuRequest $request)
{
return Datatables::of($this->menus->getForDataTable())
->escapeColumns(['name'])
->addColumn('type', function ($menus) {
return ucwords($menus->type);
})
->addColumn('created_at', function ($menus) {
return Carbon::parse($menus->created_at)->toDateTimeString();
})
->addColumn('updated_at', function ($menus) {
return Carbon::parse($menus->updated_at)->toDateTimeString();
})
->addColumn('actions', function ($menus) {
return $menus->action_buttons;
})
->make(true);
}
}
<?php
namespace App\Http\Requests\Backend\Menu;
use App\Http\Requests\Request;
/**
* Class CreateMenuRequest
*/
class CreateMenuRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return access()->allow('create-menu');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}
<?php
namespace App\Http\Requests\Backend\Menu;
use App\Http\Requests\Request;
/**
* Class DeleteMenuRequest
*/
class DeleteMenuRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return access()->allow('delete-menu');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}
<?php
namespace App\Http\Requests\Backend\Menu;
use App\Http\Requests\Request;
/**
* Class EditMenuRequest
*/
class EditMenuRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return access()->allow('edit-menu');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}
<?php
namespace App\Http\Requests\Backend\Menu;
use App\Http\Requests\Request;
/**
* Class ManageMenuRequest.
*/
class ManageMenuRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return access()->allow('view-menu');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}
<?php
namespace App\Http\Requests\Backend\Menu;
use App\Http\Requests\Request;
/**
* Class StoreMenuRequest.
*/
class StoreMenuRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return access()->allow('create-menu');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required',
'type' => 'required',
];
}
}
<?php
namespace App\Http\Requests\Backend\Menu;
use App\Http\Requests\Request;
/**
* Class UpdateMenuRequest.
*/
class UpdateMenuRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return access()->allow('edit-menu');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required',
'type' => 'required',
];
}
}
<?php
namespace App\Models\Menu;
use Illuminate\Database\Eloquent\Model;
use App\Models\ModelTrait;
use App\Models\Menu\Traits\Attribute\MenuAttribute;
use Illuminate\Database\Eloquent\SoftDeletes;
class Menu extends Model
{
use ModelTrait,
MenuAttribute,
SoftDeletes{
// MenuAttribute::getEditButtonAttribute insteadof ModelTrait;
}
/**
* The database table used by the model.
*
* @var string
*/
protected $table;
protected $fillable = [
'name',
'type',
'items'
];
public function __construct(array $attributes = [])
{
parent::__construct($attributes);
$this->table = config("access.menus_table");
}
}
<?php
namespace App\Models\Menu\Traits\Attribute;
/**
* Class MenuAttribute.
*/
trait MenuAttribute
{
/**
* @return string
*/
public function getActionButtonsAttribute()
{
return '<div class="btn-group action-btn">
' .$this->getEditButtonAttribute('edit-menu', 'admin.menus.edit'). '
' .$this->getDeleteButtonAttribute('delete-menu', 'admin.menus.destroy'). '
</div>';
}
}
<?php
namespace App\Repositories\Backend\Menu;
use App\Repositories\BaseRepository;
use App\Exceptions\GeneralException;
use App\Models\Menu\Menu;
use Illuminate\Database\Eloquent\Model;
use DB;
/**
* Class MenuRepository.
*/
class MenuRepository extends BaseRepository
{
/**
* Associated Repository Model.
*/
const MODEL = Menu::class;
/**
* @return mixed
*/
public function getForDataTable()
{
return $this->query()
->select([
config('access.menus_table').'.id',
config('access.menus_table').'.name',
config('access.menus_table').'.type',
config('access.menus_table').'.created_at',
config('access.menus_table').'.updated_at',
]);
}
/**
* @param array $input
*
* @throws \App\Exceptions\GeneralException
*
* @return bool
*/
public function create(array $input)
{
if ($this->query()->where('name', $input['name'])->first()) {
throw new GeneralException(trans('exceptions.backend.menus.already_exists'));
}
$input['created_by'] = access()->user()->id;
if (Menu::create($input)) {
return true;
}
throw new GeneralException(trans('exceptions.backend.menus.create_error'));
}
/**
* @param \App\Models\Menu\Menu $menu
* @param $input
*
* @throws \App\Exceptions\GeneralException
*
* return bool
*/
public function update(Menu $menu, array $input)
{
if ($this->query()->where('name', $input['name'])->where("id", '!=', $menu->id)->first()) {
throw new GeneralException(trans('exceptions.backend.menus.already_exists'));
}
$input['updated_by'] = access()->user()->id;
if ($menu->update($input)) {
return true;
}
throw new GeneralException(trans('exceptions.backend.menus.update_error'));
}
/**
* @param \App\Models\Menu\Menu $menu
*
* @throws \App\Exceptions\GeneralException
*
* @return bool
*/
public function delete(Menu $menu)
{
if ($menu->delete()) {
return true;
}
throw new GeneralException(trans('exceptions.backend.menus.delete_error'));
}
}
\ No newline at end of file
......@@ -51,8 +51,7 @@
"Tests\\": "tests/"
},
"classmap": [
"tests/TestCase.php",
"tests/BrowserKitTestCase.php"
"tests/TestCase.php"
]
},
"scripts": {
......
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateMenusTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('menus', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->enum('type', ['backend', 'frontend']);
$table->string('name');
$table->text('items')->nullable();
$table->integer('created_by')->unsigned();
$table->integer('updated_by')->unsigned()->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('menus');
}
}
<?php
use Carbon\Carbon;
use Database\TruncateTable;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class MenuTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table(config('access.menus_table'))->truncate();
$menu = [
'id' => 1,
'type' => 'backend',
'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"}]',
'created_by' => 1,
'created_at' => Carbon::now()
];
DB::table(config('access.menus_table'))->insert($menu);
}
}
<?php
use Carbon\Carbon;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class ModulesTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('modules')->truncate();
$modules = [
[
'name' => trans('menus.backend.access.title'),
'url' => null,
'view_permission_id' => 'view-access-management',
'created_by' => 1,
'created_at' => Carbon::now()
],
[
'name' => trans('labels.backend.access.users.management'),
'url' => 'admin.access.user.index',
'view_permission_id' => 'view-user-management',
'created_by' => 1,
'created_at' => Carbon::now()
],
[
'name' => trans('labels.backend.access.roles.management'),
'url' => 'admin.access.role.index',
'view_permission_id' => 'view-role-management',
'created_by' => 1,
'created_at' => Carbon::now()
],
[
'name' => trans('labels.backend.access.permissions.management'),
'url' => 'admin.access.permission.index',
'view_permission_id' => 'view-permission-management',
'created_by' => 1,
'created_at' => Carbon::now()
],
[
'name' => trans('labels.backend.menus.title'),
'url' => 'admin.menus.index',
'view_permission_id' => 'view-menu',
'created_by' => 1,
'created_at' => Carbon::now()
],
[
'name' => trans('labels.backend.modules.title'),
'url' => 'admin.modules.index',
'view_permission_id' => 'view-module',
'created_by' => 1,
'created_at' => Carbon::now()
],
[
'name' => trans('labels.backend.pages.title'),
'url' => 'admin.pages.index',
'view_permission_id' => 'view-page',
'created_by' => 1,
'created_at' => Carbon::now()
],
[
'name' => trans('labels.backend.emailtemplates.title'),
'url' => 'admin.emailtemplates.index',
'view_permission_id' => 'view-email-template',
'created_by' => 1,
'created_at' => Carbon::now()
],
[
'name' => trans('labels.backend.settings.title'),
'url' => 'admin.settings.edit',
'view_permission_id' => 'edit-settings',
'created_by' => 1,
'created_at' => Carbon::now()
],
[
'name' => trans('menus.backend.blog.management'),
'url' => null,
'view_permission_id' => 'view-blog',
'created_by' => 1,
'created_at' => Carbon::now()
],
[
'name' => trans('menus.backend.blogcategories.management'),
'url' => 'admin.blogcategories.index',
'view_permission_id' => 'view-blog-category',
'created_by' => 1,
'created_at' => Carbon::now()
],
[
'name' => trans('menus.backend.blogtags.management'),
'url' => 'admin.blogtags.index',
'view_permission_id' => 'view-blog-tag',
'created_by' => 1,
'created_at' => Carbon::now()
],
[
'name' => trans('menus.backend.blog.management'),
'url' => 'admin.blogs.index',
'view_permission_id' => 'view-blog',
'created_by' => 1,
'created_at' => Carbon::now()
],
[
'name' => trans('menus.backend.faqs.management'),
'url' => 'admin.faqs.index',
'view_permission_id' => 'view-faq',
'created_by' => 1,
'created_at' => Carbon::now()
],
];
DB::table('modules')->insert($modules);
}
}
......@@ -46,7 +46,7 @@
<div class="wrapper">
@include('backend.includes.header')
@include('backend.includes.sidebar')
@include('backend.includes.sidebar-dynamic')
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
......
{{ Form::open(['class' => 'form-horizontal hidden', 'role' => 'form', 'method' => 'post', 'id' => 'menu-add-custom-url']) }}
<div class="form-group">
{{ Form::label('name', trans('labels.backend.menus.field.name'), ['class' => 'col-lg-3 col-md-3 col-sm-3 control-label required']) }}
<div class="col-lg-9 col-md-9 col-sm-9">
{{ Form::text('name', null, ['class' => 'form-control box-size mi-name', 'id' => '', 'placeholder' => trans('labels.backend.menus.field.name'), 'required' => 'required']) }}
</div>
</div>
<div class="form-group">
{{ Form::label('url', trans('labels.backend.menus.field.url'), ['class' => 'col-lg-3 col-md-3 col-sm-3 control-label']) }}
<div class="col-lg-9 col-md-9 col-sm-9">
{{ Form::text('url', null, ['class' => 'form-control box-size mi-url', 'placeholder' => trans('labels.backend.menus.field.url')]) }}
</div>
</div>
<div class="form-group">
{{ Form::label('url', trans('labels.backend.menus.field.url_type'), ['class' => 'col-lg-3 col-md-3 col-sm-3 control-label']) }}
<div class="col-lg-9 col-md-9 col-sm-9 ">
<div class="radio">
<label class="radio-inline">{{ Form::radio('url_type', 'route', null, ['class' => 'mi-url_type_route']) }} {{ trans('labels.backend.menus.field.url_types.route') }}</label>
<label class="radio-inline">{{ Form::radio('url_type', 'static', true, ['class' => 'mi-url_type_static']) }} {{ trans('labels.backend.menus.field.url_types.static') }}</label>
</div>
<div class="checkbox">
{{ Form::hidden('open_in_new_tab', 0) }}
<label>
{{ Form::checkbox('open_in_new_tab', 1, false, ['class' => 'mi-open_in_new_tab']) }} {{ trans('labels.backend.menus.field.open_in_new_tab') }}
</label>
</div>
</div>
</div>
<div class="form-group">
{{ Form::label('icon', trans('labels.backend.menus.field.icon'), ['class' => 'col-lg-3 col-md-3 col-sm-3 control-label', 'title' => trans('labels.backend.menus.field.icon_title')]) }}
<div class="col-lg-9 col-md-9 col-sm-9">
{{ Form::text('icon', null, ['class' => 'form-control box-size mi-icon', 'placeholder' => trans('labels.backend.menus.field.icon_title')]) }}
</div>
</div>
<div class="form-group view-permission-block">
{{ Form::label('view_permission_id', trans('labels.backend.menus.field.view_permission_id'), ['class' => 'col-lg-3 col-md-3 col-sm-3 control-label']) }}
<div class="col-lg-9 col-md-9 col-sm-9">
{{ Form::text('view_permission_id', null, ['class' => 'form-control box-size mi-view_permission_id', 'placeholder' => trans('labels.backend.menus.field.view_permission_id')]) }}
</div>
</div>
{{ Form::hidden('id', null, ['class' => 'mi-id']) }}
<div class="box-body">
<div class="form-group">
<div class="edit-form-btn">
{{ Form::reset(trans('buttons.general.cancel'), ['class' => 'btn btn-default btn-md', 'data-dismiss' => 'modal']) }}
{{ Form::submit(trans('buttons.general.save'), ['class' => 'btn btn-primary btn-md']) }}
<div class="clearfix"></div>
</div>
</div>
</div>
{{ Form::close() }}
@extends ('backend.layouts.app')
@section ('title', trans('labels.backend.menus.management') . ' | ' . trans('labels.backend.menus.create'))
@section('page-header')
<h1>
{{ trans('labels.backend.menus.management') }}
<small>{{ trans('labels.backend.menus.create') }}</small>
</h1>
@endsection
@section('content')
{{ Form::open(['route' => 'admin.menus.store', 'class' => 'form-horizontal', 'role' => 'form', 'method' => 'post', 'id' => 'create-menu', 'files' => false]) }}
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">{{ trans('labels.backend.menus.create') }}</h3>
<div class="box-tools pull-right">
@include('backend.menus.partials.header-buttons')
</div><!--box-tools pull-right-->
</div><!-- /.box-header -->
{{-- Including Form blade file --}}
<div class="box-body">
<div class="form-group">
@include("backend.menus.form")
<div class="edit-form-btn">
{{ link_to_route('admin.menus.index', trans('buttons.general.cancel'), [], ['class' => 'btn btn-danger btn-md']) }}
{{ Form::submit(trans('buttons.general.crud.create'), ['class' => 'btn btn-primary btn-md']) }}
<div class="clearfix"></div>
</div>
</div>
</div><!--box-->
</div>
{{ Form::close() }}
@include("backend.menus.partials.modal")
@endsection
@extends ('backend.layouts.app')
@section ('title', trans('labels.backend.menus.management') . ' | ' . trans('labels.backend.menus.edit'))
@section('page-header')
<h1>
{{ trans('labels.backend.menus.management') }}
<small>{{ trans('labels.backend.menus.edit') }}</small>
</h1>
@endsection
@section('content')
{{ Form::model($menu, ['route' => ['admin.menus.update', $menu], 'class' => 'form-horizontal', 'role' => 'form', 'method' => 'PATCH', 'id' => 'edit-role', 'files' => true]) }}
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">{{ trans('labels.backend.menus.edit') }}</h3>
<div class="box-tools pull-right">
@include('backend.menus.partials.header-buttons')
</div><!--box-tools pull-right-->
</div><!-- /.box-header -->
{{-- Including Form blade file --}}
<div class="box-body">
<div class="form-group">
@include("backend.menus.form")
<div class="edit-form-btn">
{{ link_to_route('admin.menus.index', trans('buttons.general.cancel'), [], ['class' => 'btn btn-danger btn-md']) }}
{{ Form::submit(trans('buttons.general.crud.update'), ['class' => 'btn btn-primary btn-md']) }}
<div class="clearfix"></div>
</div>
</div>
</div><!--box-->
</div>
{{ Form::close() }}
@include("backend.menus.partials.modal")
@endsection
\ No newline at end of file
This diff is collapsed.
@extends ('backend.layouts.app')
@section ('title', trans('labels.backend.menus.management'))
@section('after-styles')
{{ Html::style("css/backend/plugin/datatables/dataTables.bootstrap.min.css") }}
@endsection
@section('page-header')
<h1>{{ trans('labels.backend.menus.management') }}</h1>
@endsection
@section('content')
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">{{ trans('labels.backend.menus.management') }}</h3>
<div class="box-tools pull-right">
@include('backend.menus.partials.header-buttons')
</div>
</div><!-- /.box-header -->
<div class="box-body">
<div class="table-responsive data-table-wrapper">
<table id="menus-table" class="table table-condensed table-hover table-bordered">
<thead>
<tr>
<th>{{ trans('labels.backend.menus.table.name') }}</th>
<th>{{ trans('labels.backend.menus.table.type') }}</th>
<th>{{ trans('labels.backend.menus.table.createdat') }}</th>
<th>{{ trans('labels.general.actions') }}</th>
</tr>
</thead>
<thead class="transparent-bg">
<tr>
<th>
{!! Form::text('first_name', null, ["class" => "search-input-text form-control", "data-column" => 0, "placeholder" => trans('labels.backend.menus.table.name')]) !!}
<a class="reset-data" href="javascript:void(0)"><i class="fa fa-times"></i></a>
</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
</table>
</div><!--table-responsive-->
</div><!-- /.box-body -->
</div><!--box-->
<!--<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">{{ trans('history.backend.recent_history') }}</h3>
<div class="box-tools pull-right">
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
</div><!-- /.box tools -->
</div><!-- /.box-header -->
<div class="box-body">
{{-- {!! history()->renderType('Blog') !!} --}}
</div><!-- /.box-body -->
</div><!--box box-success-->
@endsection
@section('after-scripts')
{{-- For DataTables --}}
@include('includes.datatables')
<script>
$(function() {
var dataTable = $('#menus-table').dataTable({
processing: true,
serverSide: true,
ajax: {
url: '{{ route("admin.menus.get") }}',
type: 'post'
},
columns: [
{data: 'name', name: '{{config('access.menus_table')}}.name'},
{data: 'type', name: '{{config('access.menus_table')}}.type'},
{data: 'created_at', name: '{{config('access.menus_table')}}.created_at'},
{data: 'actions', name: 'actions', searchable: false, sortable: false}
],
order: [[3, "asc"]],
searchDelay: 500,
dom: 'lBfrtip',
buttons: {
buttons: [
{ extend: 'copy', className: 'copyButton', exportOptions: {columns: [ 0, 1, 2, 3, 4 ] }},
{ extend: 'csv', className: 'csvButton', exportOptions: {columns: [ 0, 1, 2, 3, 4 ] }},
{ extend: 'excel', className: 'excelButton', exportOptions: {columns: [ 0, 1, 2, 3, 4 ] }},
{ extend: 'pdf', className: 'pdfButton', exportOptions: {columns: [ 0, 1, 2, 3, 4 ] }},
{ extend: 'print', className: 'printButton', exportOptions: {columns: [ 0, 1, 2, 3, 4 ] }}
]
}
});
FinBuilders.DataTableSearch.init(dataTable);
});
</script>
@endsection
\ No newline at end of file
<!--Action Button-->
@if(Active::checkUriPattern('admin/menus'))
<div class="btn-group">
<button type="button" class="btn btn-warning btn-flat dropdown-toggle" data-toggle="dropdown">Export
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
<li id="copyButton"><a href="#"><i class="fa fa-clone"></i> Copy</a></li>
<li id="csvButton"><a href="#"><i class="fa fa-file-text-o"></i> CSV</a></li>
<li id="excelButton"><a href="#"><i class="fa fa-file-excel-o"></i> Excel</a></li>
<li id="pdfButton"><a href="#"><i class="fa fa-file-pdf-o"></i> PDF</a></li>
<li id="printButton"><a href="#"><i class="fa fa-print"></i> Print</a></li>
</ul>
</div>
@endif
<!--Action Button-->
<div class="btn-group">
<button type="button" class="btn btn-primary btn-flat dropdown-toggle" data-toggle="dropdown">Action
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="{{route('admin.menus.index')}}"><i class="fa fa-list-ul"></i> {{trans('menus.backend.menus.all')}}</a></li>
@permission('create-menu')
<li><a href="{{route('admin.menus.create')}}"><i class="fa fa-plus"></i> {{trans('menus.backend.menus.create')}}</a></li>
@endauth
</ul>
</div>
<div class="clearfix"></div>
\ No newline at end of file
<div id="showMenuModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title"></h4>
</div>
<div class="modal-body">
<p>Something went wrong! Please try again later.</p>
</div>
</div>
</div>
</div>
\ No newline at end of file
......@@ -12,7 +12,7 @@
@section('content')
{{ Form::open(['route' => 'admin.modules.store', 'class' => 'form-horizontal', 'role' => 'form', 'method' => 'post', 'id' => 'create-module', 'files' => true]) }}
<div class="box box-success">
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">{{ trans('generator::labels.modules.create') }}</h3>
......
......@@ -12,7 +12,7 @@
@section('content')
{{ Form::model($module, ['route' => ['admin.modules.update', $module], 'class' => 'form-horizontal', 'role' => 'form', 'method' => 'PATCH', 'id' => 'edit-module', 'files' => true]) }}
<div class="box box-success">
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">{{ trans('generator::labels.modules.edit') }}</h3>
......
......@@ -7,7 +7,7 @@
@endsection
@section('content')
<div class="box box-success">
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">{{ trans('labels.backend.modules.management') }}</h3>
......
<?php
/**
* Menu Management
*/
Route::group(['namespace' => 'Menu'], function () {
Route::resource('menus', 'MenuController', ['except' => []]);
//For DataTables
Route::post('menus/get', 'MenuTableController')->name('menus.get');
// for Model Forms
Route::get('menus/get-form/{name?}', 'MenuFormController@create')->name('menus.getform');
});
\ No newline at end of file
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