Skip to content
Permalink
Browse files

Manage Roles

  • Loading branch information...
bpocallaghan committed Jul 4, 2017
1 parent b717313 commit 8552c56f746094fb2ba8819accaa755a4526efee
@@ -0,0 +1,101 @@
<?php
namespace App\Http\Controllers\Admin\Settings;
use Redirect;
use App\Http\Requests;
use App\Models\Role;
use Illuminate\Http\Request;
use App\Http\Controllers\Admin\AdminController;
class RolesController extends AdminController
{
/**
* Display a listing of role.
*
* @return Response
*/
public function index()
{
save_resource_url();
return $this->view('settings.roles.index')->with('items', Role::all());
}
/**
* Show the form for creating a new role.
*
* @return Response
*/
public function create()
{
return $this->view('settings.roles.add_edit');
}
/**
* Store a newly created role in storage.
*
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
$this->validate($request, Role::$rules, Role::$messages);
$this->createEntry(Role::class, $request->all());
return redirect_to_resource();
}
/**
* Display the specified role.
*
* @param Role $role
* @return Response
*/
public function show(Role $role)
{
return $this->view('settings.roles.show')->with('item', $role);
}
/**
* Show the form for editing the specified role.
*
* @param Role $role
* @return Response
*/
public function edit(Role $role)
{
return $this->view('settings.roles.add_edit')->with('item', $role);
}
/**
* Update the specified role in storage.
*
* @param Role $role
* @param Request $request
* @return Response
*/
public function update(Role $role, Request $request)
{
$this->validate($request, Role::$rules, Role::$messages);
$this->updateEntry($role, $request->all());
return redirect_to_resource();
}
/**
* Remove the specified role from storage.
*
* @param Role $role
* @param Request $request
* @return Response
*/
public function destroy(Role $role, Request $request)
{
$this->deleteEntry($role, $request);
return redirect_to_resource();
}
}
@@ -18,7 +18,7 @@
</div>

<div class="box-body">
<table id="tbl-list-activities" data-server="false" class="table table-striped table-bordered" cellspacing="0" width="100%">
<table id="tbl-list-activities" data-order-by="0|desc" data-server="false" class="table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<th>ID</th>
@@ -0,0 +1,72 @@
@extends('layouts.admin')

@section('content')
<div class="row">
<div class="col-xs-12">
<div class="box box-primary box-solid">
<div class="box-header with-border">
<h3 class="box-title">
<span><i class="fa fa-edit"></i></span>
<span>{{ isset($item)? 'Edit the ' . $item->title . ' entry': 'Create a new Role' }}</span>
</h3>
</div>

<div class="box-body no-padding">

@include('admin.partials.info')

<form method="POST" action="{{$selectedNavigation->url . (isset($item)? "/{$item->id}" : '')}}" accept-charset="UTF-8">
<input name="_token" type="hidden" value="{{ csrf_token() }}">
<input name="_method" type="hidden" value="{{isset($item)? 'PUT':'POST'}}">

<fieldset>
<div class="row">
<div class="col-md-6">
<section class="form-group {{ form_error_class('title', $errors) }}">
<label for="id-title">Title</label>
<input type="text" class="form-control input-generate-slug" id="id-title" name="title" placeholder="Please insert the Title" value="{{ ($errors && $errors->any()? old('title') : (isset($item)? $item->title : '')) }}">
{!! form_error_message('title', $errors) !!}
</section>
</div>

<div class="col-md-6">
<div class="form-group {{ form_error_class('slug', $errors) }}">
<label for="id-slug">Slug</label>
<div class="input-group">
<input type="text" class="form-control" id="id-slug" name="slug" placeholder="Please insert the Slug" value="{{ ($errors && $errors->any()? old('slug') : (isset($item)? $item->slug : '')) }}">
<span class="input-group-addon"><i class="fa fa-link"></i></span>
</div>
{!! form_error_message('slug', $errors) !!}
</div>
</div>
</div>

<div class="row">
<div class="col-md-6">
<div class="form-group {{ form_error_class('icon', $errors) }}">
<label for="icon">Icon</label>
<div class="input-group">
<span class="input-group-addon">fa fa-</span>
<input type="text" class="form-control" id="icon" name="icon" placeholder="Please insert the Icon" value="{{ ($errors && $errors->any()? old('icon') : (isset($item)? $item->icon : '')) }}">
</div>
{!! form_error_message('icon', $errors) !!}
</div>
</div>

<div class="col-md-6">
<div class="form-group {{ form_error_class('keyword', $errors) }}">
<label for="keyword">Keyword</label>
<input type="text" class="form-control" id="keyword" name="keyword" placeholder="Please insert the Keyword" value="{{ ($errors && $errors->any()? old('keyword') : (isset($item)? $item->keyword : '')) }}">
{!! form_error_message('keyword', $errors) !!}
</div>
</div>
</div>
</fieldset>

@include('admin.partials.form_footer')
</form>
</div>
</div>
</div>
</div>
@endsection
@@ -0,0 +1,44 @@
@extends('layouts.admin')

@section('content')
<div class="row">
<div class="col-xs-12">
<div class="box box-primary box-solid">
<div class="box-header with-border">
<h3 class="box-title">
<span><i class="fa fa-table"></i></span>
<span>List All Roles</span>
</h3>
</div>

<div class="box-body">

@include('admin.partials.info')

@include('admin.partials.toolbar')

<table id="tbl-list" data-server="false" class="dt-table table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<th>Title</th>
<th>Slug</th>
<th>Keyword</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach ($items as $item)
<tr>
<td><i class="fa fa-{{ $item->icon }}"></i> {{ $item->title }}</td>
<td>{{ $item->slug }}</td>
<td>{{ $item->keyword }}</td>
<td>{!! action_row($selectedNavigation->url, $item->id, $item->title, ['edit', 'delete']) !!}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection
@@ -49,7 +49,8 @@
Route::get('register/confirm/{token}', 'RegisterController@confirmRegister');
// password reset
Route::get('password/forgot', 'ForgotPasswordController@showLinkRequestForm')->name('forgot-password');
Route::get('password/forgot', 'ForgotPasswordController@showLinkRequestForm')
->name('forgot-password');
Route::post('password/email', 'ForgotPasswordController@sendResetLinkEmail');
Route::get('password/reset/{token}', 'ResetPasswordController@showResetForm')
->name('password.reset');
@@ -112,9 +113,11 @@ function () {
Route::get('contact-us/datatable', 'ContactUsController@getTableData');
});
// settings / website
Route::group(['prefix' => 'settings/website', 'namespace' => 'Settings\Website'],
function () {
Route::group(['prefix' => 'settings', 'namespace' => 'Settings'], function () {
Route::resource('roles', 'RolesController');
// settings / website
Route::group(['prefix' => 'website', 'namespace' => 'Website'], function () {
// navigation
Route::group(['prefix' => 'navigation/order'], function () {
Route::get('{type?}', 'NavigationOrderController@index');
@@ -126,18 +129,19 @@ function () {
Route::resource('changelogs', 'ChangelogsController');
});
// settings / admin
Route::group(['prefix' => 'settings/admin', 'namespace' => 'Settings\Admin'], function () {
// users
Route::get('users', 'AdministratorsController@index');
Route::get('users/invites', 'AdministratorsController@showInvites');
Route::post('users/invites', 'AdministratorsController@postInvite');
// navigation
Route::get('navigation/order', 'NavigationOrderController@index');
Route::post('navigation/order', 'NavigationOrderController@updateOrder');
Route::get('navigation/datatable', 'NavigationController@getTableData');
Route::resource('navigation', 'NavigationController');
// settings / admin
Route::group(['prefix' => 'admin', 'namespace' => 'Admin'], function () {
// users
Route::get('users', 'AdministratorsController@index');
Route::get('users/invites', 'AdministratorsController@showInvites');
Route::post('users/invites', 'AdministratorsController@postInvite');
// navigation
Route::get('navigation/order', 'NavigationOrderController@index');
Route::post('navigation/order', 'NavigationOrderController@updateOrder');
Route::get('navigation/datatable', 'NavigationController@getTableData');
Route::resource('navigation', 'NavigationController');
});
});
});

0 comments on commit 8552c56

Please sign in to comment.
You can’t perform that action at this time.