Skip to content

Instantly share code, notes, and snippets.

@ubiratanlima
Created September 25, 2017 08:52
Show Gist options
  • Save ubiratanlima/f191c91151b8aa80e94efe68cf776773 to your computer and use it in GitHub Desktop.
Save ubiratanlima/f191c91151b8aa80e94efe68cf776773 to your computer and use it in GitHub Desktop.
GES-SONEdu
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title>
<!-- Styles -->
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
</head>
<body>
@php
@endphp
<div id="app">
@php
if (Auth::check()){
$navbar = Navbar::withBrand(config('app.name'), route('admin.dashboard'));
$arrayLinks = [
['link' => route('admin.users.index'), 'title' => 'Usuários']
];
$arrayLinksRight = [
[
Auth::user()->name,
[
[
'link' => route('logout'),
'title' => 'Sair',
'linkAttributes' => [
'onclick' => "event.preventDefault();document.getElementById(\"form-logout\").submit();"
]
]
]
]
];
$navbar->withContent(Navigation::links($arrayLinks))
->withContent(Navigation::links($arrayLinksRight)->right());
$formLogout = FormBuilder::plain([
'id' => 'form-logout',
'url' => route('logout'),
'method' => 'POST',
'style' => 'display:none'
]);
}
@endphp
{!! $navbar !!}
{!! form($formLogout) !!}
@yield('content')
</div>
<!-- Scripts -->
<script src="{{ asset('js/app.js') }}"></script>
</body>
</html>
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row">
@php
$linkCancel = route('admin.users.index');
@endphp
<h3>Novo Usuário</h3>
{!!
form($form->add('insert','submit',[
'attr' => ['class' => 'btn btn-primary btn-block'],
'label' => Icon::create('floppy-disk').' Gravar'
]))
!!}
{!! Button::warning(Icon::create('arrow-left').' Voltar')->asLinkTo($linkCancel) !!}
</div>
</div>
@endsection
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row">
@php
$linkCancel = route('admin.users.index');
@endphp
<h3>Editar Usuário</h3>
{!! form($form->add('Edit','submit',[
'attr' => ['class' => 'btn btn-success btn-block'],
'label' => Icon::create('floppy-disk').' Gravar'
])) !!}
{!!
Button::warning(Icon::create('arrow-left').' Voltar')
->asLinkTo($linkCancel)
!!}
</div>
</div>
@endsection
Whoops, looks like something went wrong.
(3/3) ErrorException
Undefined variable: navbar (View: C:\Users\Ubiratan Lima\DEV\Gestao-Escolar\resources\views\layouts\app.blade.php) (View: C:\Users\Ubiratan Lima\DEV\Gestao-Escolar\resources\views\layouts\app.blade.php)
in 6933f8833b9ac9e81a2df8a18c23bf58c81de27a.php (line 55)
at CompilerEngine->handleViewException(object(ErrorException), 1)in PhpEngine.php (line 44)
at PhpEngine->evaluatePath('C:\\Users\\Ubiratan Lima\\DEV\\Gestao-Escolar\\storage\\framework\\views/e1b1fc6885e0d110c4997c33f3c4a527536811b4.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag)))in CompilerEngine.php (line 59)
at CompilerEngine->get('C:\\Users\\Ubiratan Lima\\DEV\\Gestao-Escolar\\resources\\views/auth/login.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag)))in View.php (line 137)
at View->getContents()in View.php (line 120)
at View->renderContents()in View.php (line 85)
at View->render()in Response.php (line 38)
at Response->setContent(object(View))in Response.php (line 201)
at Response->__construct(object(View))in Router.php (line 615)
at Router->prepareResponse(object(Request), object(View))in Router.php (line 572)
at Router->Illuminate\Routing\{closure}(object(Request))in Pipeline.php (line 30)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in RedirectIfAuthenticated.php (line 24)
at RedirectIfAuthenticated->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in SubstituteBindings.php (line 41)
at SubstituteBindings->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in VerifyCsrfToken.php (line 65)
at VerifyCsrfToken->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in ShareErrorsFromSession.php (line 49)
at ShareErrorsFromSession->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in StartSession.php (line 64)
at StartSession->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in AddQueuedCookiesToResponse.php (line 37)
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in EncryptCookies.php (line 59)
at EncryptCookies->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in Pipeline.php (line 102)
at Pipeline->then(object(Closure))in Router.php (line 574)
at Router->runRouteWithinStack(object(Route), object(Request))in Router.php (line 533)
at Router->dispatchToRoute(object(Request))in Router.php (line 511)
at Router->dispatch(object(Request))in Kernel.php (line 176)
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))in Pipeline.php (line 30)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in TransformsRequest.php (line 30)
at TransformsRequest->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in TransformsRequest.php (line 30)
at TransformsRequest->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in ValidatePostSize.php (line 27)
at ValidatePostSize->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in CheckForMaintenanceMode.php (line 46)
at CheckForMaintenanceMode->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in Pipeline.php (line 102)
at Pipeline->then(object(Closure))in Kernel.php (line 151)
at Kernel->sendRequestThroughRouter(object(Request))in Kernel.php (line 116)
at Kernel->handle(object(Request))in index.php (line 53)
at require_once('C:\\Users\\Ubiratan Lima\\DEV\\Gestao-Escolar\\public\\index.php')in server.php (line 21)
(2/3) ErrorException
Undefined variable: navbar (View: C:\Users\Ubiratan Lima\DEV\Gestao-Escolar\resources\views\layouts\app.blade.php)
in 6933f8833b9ac9e81a2df8a18c23bf58c81de27a.php (line 55)
at CompilerEngine->handleViewException(object(ErrorException), 2)in PhpEngine.php (line 44)
at PhpEngine->evaluatePath('C:\\Users\\Ubiratan Lima\\DEV\\Gestao-Escolar\\storage\\framework\\views/6933f8833b9ac9e81a2df8a18c23bf58c81de27a.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'obLevel' => 1))in CompilerEngine.php (line 59)
at CompilerEngine->get('C:\\Users\\Ubiratan Lima\\DEV\\Gestao-Escolar\\resources\\views/layouts/app.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'obLevel' => 1))in View.php (line 137)
at View->getContents()in View.php (line 120)
at View->renderContents()in View.php (line 85)
at View->render()in e1b1fc6885e0d110c4997c33f3c4a527536811b4.php (line 70)
at include('C:\\Users\\Ubiratan Lima\\DEV\\Gestao-Escolar\\storage\\framework\\views\\e1b1fc6885e0d110c4997c33f3c4a527536811b4.php')in PhpEngine.php (line 42)
at PhpEngine->evaluatePath('C:\\Users\\Ubiratan Lima\\DEV\\Gestao-Escolar\\storage\\framework\\views/e1b1fc6885e0d110c4997c33f3c4a527536811b4.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag)))in CompilerEngine.php (line 59)
at CompilerEngine->get('C:\\Users\\Ubiratan Lima\\DEV\\Gestao-Escolar\\resources\\views/auth/login.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag)))in View.php (line 137)
at View->getContents()in View.php (line 120)
at View->renderContents()in View.php (line 85)
at View->render()in Response.php (line 38)
at Response->setContent(object(View))in Response.php (line 201)
at Response->__construct(object(View))in Router.php (line 615)
at Router->prepareResponse(object(Request), object(View))in Router.php (line 572)
at Router->Illuminate\Routing\{closure}(object(Request))in Pipeline.php (line 30)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in RedirectIfAuthenticated.php (line 24)
at RedirectIfAuthenticated->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in SubstituteBindings.php (line 41)
at SubstituteBindings->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in VerifyCsrfToken.php (line 65)
at VerifyCsrfToken->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in ShareErrorsFromSession.php (line 49)
at ShareErrorsFromSession->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in StartSession.php (line 64)
at StartSession->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in AddQueuedCookiesToResponse.php (line 37)
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in EncryptCookies.php (line 59)
at EncryptCookies->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in Pipeline.php (line 102)
at Pipeline->then(object(Closure))in Router.php (line 574)
at Router->runRouteWithinStack(object(Route), object(Request))in Router.php (line 533)
at Router->dispatchToRoute(object(Request))in Router.php (line 511)
at Router->dispatch(object(Request))in Kernel.php (line 176)
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))in Pipeline.php (line 30)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in TransformsRequest.php (line 30)
at TransformsRequest->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in TransformsRequest.php (line 30)
at TransformsRequest->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in ValidatePostSize.php (line 27)
at ValidatePostSize->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in CheckForMaintenanceMode.php (line 46)
at CheckForMaintenanceMode->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in Pipeline.php (line 102)
at Pipeline->then(object(Closure))in Kernel.php (line 151)
at Kernel->sendRequestThroughRouter(object(Request))in Kernel.php (line 116)
at Kernel->handle(object(Request))in index.php (line 53)
at require_once('C:\\Users\\Ubiratan Lima\\DEV\\Gestao-Escolar\\public\\index.php')in server.php (line 21)
(1/3) ErrorException
Undefined variable: navbar
in 6933f8833b9ac9e81a2df8a18c23bf58c81de27a.php (line 55)
at HandleExceptions->handleError(8, 'Undefined variable: navbar', 'C:\\Users\\Ubiratan Lima\\DEV\\Gestao-Escolar\\storage\\framework\\views\\6933f8833b9ac9e81a2df8a18c23bf58c81de27a.php', 55, array('__path' => 'C:\\Users\\Ubiratan Lima\\DEV\\Gestao-Escolar\\storage\\framework\\views/6933f8833b9ac9e81a2df8a18c23bf58c81de27a.php', '__data' => array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'obLevel' => 1), 'obLevel' => 2, '__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag)))in 6933f8833b9ac9e81a2df8a18c23bf58c81de27a.php (line 55)
at include('C:\\Users\\Ubiratan Lima\\DEV\\Gestao-Escolar\\storage\\framework\\views\\6933f8833b9ac9e81a2df8a18c23bf58c81de27a.php')in PhpEngine.php (line 42)
at PhpEngine->evaluatePath('C:\\Users\\Ubiratan Lima\\DEV\\Gestao-Escolar\\storage\\framework\\views/6933f8833b9ac9e81a2df8a18c23bf58c81de27a.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'obLevel' => 1))in CompilerEngine.php (line 59)
at CompilerEngine->get('C:\\Users\\Ubiratan Lima\\DEV\\Gestao-Escolar\\resources\\views/layouts/app.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'obLevel' => 1))in View.php (line 137)
at View->getContents()in View.php (line 120)
at View->renderContents()in View.php (line 85)
at View->render()in e1b1fc6885e0d110c4997c33f3c4a527536811b4.php (line 70)
at include('C:\\Users\\Ubiratan Lima\\DEV\\Gestao-Escolar\\storage\\framework\\views\\e1b1fc6885e0d110c4997c33f3c4a527536811b4.php')in PhpEngine.php (line 42)
at PhpEngine->evaluatePath('C:\\Users\\Ubiratan Lima\\DEV\\Gestao-Escolar\\storage\\framework\\views/e1b1fc6885e0d110c4997c33f3c4a527536811b4.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag)))in CompilerEngine.php (line 59)
at CompilerEngine->get('C:\\Users\\Ubiratan Lima\\DEV\\Gestao-Escolar\\resources\\views/auth/login.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag)))in View.php (line 137)
at View->getContents()in View.php (line 120)
at View->renderContents()in View.php (line 85)
at View->render()in Response.php (line 38)
at Response->setContent(object(View))in Response.php (line 201)
at Response->__construct(object(View))in Router.php (line 615)
at Router->prepareResponse(object(Request), object(View))in Router.php (line 572)
at Router->Illuminate\Routing\{closure}(object(Request))in Pipeline.php (line 30)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in RedirectIfAuthenticated.php (line 24)
at RedirectIfAuthenticated->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in SubstituteBindings.php (line 41)
at SubstituteBindings->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in VerifyCsrfToken.php (line 65)
at VerifyCsrfToken->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in ShareErrorsFromSession.php (line 49)
at ShareErrorsFromSession->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in StartSession.php (line 64)
at StartSession->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in AddQueuedCookiesToResponse.php (line 37)
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in EncryptCookies.php (line 59)
at EncryptCookies->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in Pipeline.php (line 102)
at Pipeline->then(object(Closure))in Router.php (line 574)
at Router->runRouteWithinStack(object(Route), object(Request))in Router.php (line 533)
at Router->dispatchToRoute(object(Request))in Router.php (line 511)
at Router->dispatch(object(Request))in Kernel.php (line 176)
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))in Pipeline.php (line 30)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in TransformsRequest.php (line 30)
at TransformsRequest->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in TransformsRequest.php (line 30)
at TransformsRequest->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in ValidatePostSize.php (line 27)
at ValidatePostSize->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in CheckForMaintenanceMode.php (line 46)
at CheckForMaintenanceMode->handle(object(Request), object(Closure))in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))in Pipeline.php (line 102)
at Pipeline->then(object(Closure))in Kernel.php (line 151)
at Kernel->sendRequestThroughRouter(object(Request))in Kernel.php (line 116)
at Kernel->handle(object(Request))in index.php (line 53)
at require_once('C:\\Users\\Ubiratan Lima\\DEV\\Gestao-Escolar\\public\\index.php')in server.php (line 21)
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row">
<h3>Listagem de Usuários</h3>
{!! Button::success(Icon::create('plus').' Adicionar Usuário')->asLinkTo(route('admin.users.create')) !!}
</div>
<div class="row">
{!!
Table::withContents($users->items())
->striped()
->callback('Ações', function($field,$model){
$linkEdit = route('admin.users.edit',['user' => $model->id]);
$linkShow = route('admin.users.show',['user' => $model->id]);
$linkDestroy = route('admin.users.destroy',['user' => $model->id]);
return Button::warning(Icon::create('pencil'))->asLinkTo($linkEdit).' '.
Button::primary(Icon::create('eye-open'))->asLinkTo($linkShow).' '.
Button::danger(Icon::create('trash'))->asLinkTo($linkDestroy);
})
!!}
</div>
{!! $users->links() !!}
</div>
@endsection
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row">
<h3>Dados do Usuários</h3>
@php
$linkEdit = route('admin.users.edit',['user' => $user->id]);
$linkCancel = route('admin.users.index');
$linkDelete = route('admin.users.destroy',['user' => $user->id]);
@endphp
{!! Button::warning(Icon::create('Pencil').' Editar')->asLinkTo($linkEdit) !!}
{!!
Button::danger(Icon::create('trash').' Excluir')->asLinkTo($linkDelete)
->addAttributes([
'onclick' => "event.preventDefault();document.getElementById(\"form-delete\").submit()"
])
!!}
{!! Button::success(Icon::create('arrow-left').' Voltar')->asLinkTo($linkCancel) !!}
@php
$formDelete = FormBuilder::plain([
'id' => 'form-delete',
'url' => $linkDelete,
'method' => 'DELETE',
'style' => 'display:none'
])
@endphp
{!! form($formDelete) !!}
<br/><br/>
<table class="table table-bordered">
<tbody>
<tr>
<th class="row">#</th>
<td>{{$user->id}}</td>
</tr>
<tr>
<th class="row">Nome</th>
<td>{{$user->name}}</td>
</tr>
<tr>
<th class="row">E-mail</th>
<td>{{$user->email}}</td>
</tr>
</tbody>
</table>
</div>
</div>
@endsection
<?php
namespace GES\Models;
use Bootstrapper\Interfaces\TableInterface;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable implements TableInterface
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
public function getTableHeaders()
{
return [
'ID',
'Nome',
'E-mail'
];
}
public function getValueForHeader($header)
{
switch ($header){
case 'ID':
return $this->id;
case 'Nome':
return $this->name;
case 'E-mail':
return $this->email;
}
}
}
<?php
namespace GES\Http\Controllers\Admin;
use GES\Forms\UserForm;
use GES\Models\User;
use Illuminate\Http\Request;
use GES\Http\Controllers\Controller;
class UsersController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$users = User::paginate();
return view('admin.users.index',compact('users'));
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
$form = \FormBuilder::create(UserForm::class, [
'url' => route('admin.users.store'),
'method' => 'POST'
]);
return view('admin.users.create',compact('form'));
}
public function store(Request $request)
{
$form = \FormBuilder::create(UserForm::class);
if (!$form->isValid()){
return redirect()
->back()
->withErrors($form->getErrors())
->withInput();
}
$data = $form->getFieldValues();
$password = str_random(6);
$data['password'] = $password;
User::create($data);
return redirect()->route('admin.users.index');
}
public function show(User $user)
{
return view('admin.users.show',compact('user'));
}
/**
* Show the form for editing the specified resource.
*
* @param \GES\Models\User $user
* @return \Illuminate\Http\Response
*/
public function edit(User $user)
{
$form = \FormBuilder::create(UserForm::class, [
'url' => route('admin.users.update',['user' => $user->id]),
'method' => 'PUT',
'model' => $user
]);
return view('admin.users.edit',compact('form'));
}
public function update(User $user)
{
$form = \FormBuilder::create(UserForm::class, [
'data' => [
'id' => $user->id
]
]);
if (!$form->isValid()){
return redirect()
->back()
->withErrors($form->getErrors())
->withInput();
}
$data = $form->getFieldValues();
$user->update($data);
return redirect()->route('admin.users.index');
}
/**
* Remove the specified resource from storage.
*
* @param \GES\Models\User $user
* @return \Illuminate\Http\Response
*/
public function destroy(User $user)
{
$user->delete();
return redirect()->route('admin.users.index');
}
}
<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function () {
return view('welcome');
});
Route::prefix('admin')->group(function(){
Auth::routes();
Route::group([
'namespace' => 'Admin\\',
'as' => 'admin.',
'middleware' => 'auth'
], function(){
Route::name('dashboard')->get('/dashboard', function () {
return 'Estou no dashboard';
});
Route::resource('users', 'UsersController');
});
});
Route::get('/home', 'HomeController@index')->name('home');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment