Commit f4b39202 authored by Nicolas Widart's avatar Nicolas Widart

Adding rol create and edit view

parent b01df84f
......@@ -13,6 +13,7 @@ class RolesController extends AdminBaseController
parent::__construct();
$this->roles = Sentinel::getRoleRepository()->createModel();
}
/**
* Display a listing of the resource.
*
......@@ -32,7 +33,7 @@ class RolesController extends AdminBaseController
*/
public function create()
{
return \View::make('user::admin.roles.create');
return View::make('user::admin.roles.create');
}
/**
......@@ -53,7 +54,6 @@ class RolesController extends AdminBaseController
*/
public function show($id)
{
return \View::make('user::admin.roles.show');
}
/**
......@@ -64,7 +64,11 @@ class RolesController extends AdminBaseController
*/
public function edit($id)
{
return \View::make('user::admin.roles.edit');
if (!$role = $this->roles->find($id)) {
return Redirect::to('user::admin.roles.index');
}
return View::make('user::admin.roles.edit', compact('role'));
}
/**
......
......@@ -6,7 +6,7 @@
</h1>
<ol class="breadcrumb">
<li><a href="{{ URL::route('dashboard.index') }}"><i class="fa fa-dashboard"></i> Home</a></li>
<li class=""><a href="{{ URL::route('dashboard.user.index') }}">Users</a></li>
<li class=""><a href="{{ URL::route('dashboard.role.index') }}">Roles</a></li>
<li class="active">New</li>
</ol>
@stop
......@@ -15,54 +15,31 @@
<div class="row">
<div class="col-md-12">
<div class="box box-<?php echo $errors->first() ? 'danger' : 'info'; ?>">
{!! Form::open(['route' => 'dashboard.user.store', 'method' => 'post']) !!}
{!! Form::open(['route' => 'dashboard.role.store', 'method' => 'post']) !!}
<div class="box-body">
<div class="row">
@include('flash::message')
</div>
<div class="row">
<div class="col-sm-4">
<div class="form-group{{ $errors->has('first_name') ? ' has-error' : '' }}">
{!! Form::label('first_name', 'First name:') !!}
{!! Form::text('first_name', Input::old('first_name'), ['class' => 'form-control', 'placeholder' => 'First name']) !!}
{!! $errors->first('first_name', '<span class="help-block">:message</span>') !!}
</div>
</div>
<div class="col-sm-4">
<div class="form-group{{ $errors->has('last_name') ? ' has-error' : '' }}">
{!! Form::label('last_name', 'Last name:') !!}
{!! Form::text('last_name', Input::old('last_name'), ['class' => 'form-control', 'placeholder' => 'Last name']) !!}
{!! $errors->first('last_name', '<span class="help-block">:message</span>') !!}
</div>
</div>
<div class="col-sm-4">
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
{!! Form::label('email', 'Email:') !!}
{!! Form::email('email', Input::old('email'), ['class' => 'form-control', 'placeholder' => 'Email address']) !!}
{!! $errors->first('email', '<span class="help-block">:message</span>') !!}
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
{!! Form::label('password', 'Password:') !!}
{!! Form::password('password', ['class' => 'form-control']) !!}
{!! $errors->first('password', '<span class="help-block">:message</span>') !!}
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
{!! Form::label('name', 'Role name:') !!}
{!! Form::text('name', Input::old('name'), ['class' => 'form-control', 'placeholder' => 'First name']) !!}
{!! $errors->first('name', '<span class="help-block">:message</span>') !!}
</div>
</div>
<div class="col-sm-6">
<div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
{!! Form::label('password_confirmation', 'Password confirmation:') !!}
{!! Form::password('password_confirmation', ['class' => 'form-control']) !!}
{!! $errors->first('password_confirmation', '<span class="help-block">:message</span>') !!}
<div class="form-group{{ $errors->has('slug') ? ' has-error' : '' }}">
{!! Form::label('slug', 'Role slug:') !!}
{!! Form::text('slug', Input::old('slug'), ['class' => 'form-control', 'placeholder' => 'Last name']) !!}
{!! $errors->first('slug', '<span class="help-block">:message</span>') !!}
</div>
</div>
</div>
</div>
<div class="box-footer">
<button type="submit" class="btn btn-primary btn-flat">Create</button>
<a class="btn btn-danger pull-right btn-flat" href="{{ URL::route('dashboard.user.index')}}"><i class="fa fa-times"></i> Cancel</a>
<a class="btn btn-danger pull-right btn-flat" href="{{ URL::route('dashboard.role.index')}}"><i class="fa fa-times"></i> Cancel</a>
</div>
{!! Form::close() !!}
</div>
......
@extends('core::layouts.master')
@section('content-header')
<h1>
Updating Role <small>{{ $role->name }}</small>
</h1>
<ol class="breadcrumb">
<li><a href="{{ URL::route('dashboard.index') }}"><i class="fa fa-dashboard"></i> Home</a></li>
<li class=""><a href="{{ URL::route('dashboard.role.index') }}">Roles</a></li>
<li class="active">Update</li>
</ol>
@stop
@section('content')
<div class="row">
<div class="col-md-12">
<div class="box box-<?php echo $errors->first() ? 'danger' : 'info'; ?>">
{!! Form::open(['route' => ['dashboard.role.update', $role->id], 'method' => 'put']) !!}
<div class="box-body">
<div class="row">
@include('flash::message')
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
{!! Form::label('name', 'Role name:') !!}
{!! Form::text('name', Input::old('name', $role->name), ['class' => 'form-control', 'placeholder' => 'First name']) !!}
{!! $errors->first('name', '<span class="help-block">:message</span>') !!}
</div>
</div>
<div class="col-sm-6">
<div class="form-group{{ $errors->has('slug') ? ' has-error' : '' }}">
{!! Form::label('slug', 'Role slug:') !!}
{!! Form::text('slug', Input::old('slug', $role->slug), ['class' => 'form-control', 'placeholder' => 'Last name']) !!}
{!! $errors->first('slug', '<span class="help-block">:message</span>') !!}
</div>
</div>
</div>
</div>
<div class="box-footer">
<button type="submit" class="btn btn-primary btn-flat">Update</button>
<a class="btn btn-danger pull-right btn-flat" href="{{ URL::route('dashboard.role.index')}}"><i class="fa fa-times"></i> Cancel</a>
</div>
{!! Form::close() !!}
</div>
</div>
</div>
@stop
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