Change validation to controllers and partial
This commit is contained in:
@@ -51,4 +51,10 @@ body.dashboard {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.alerts {
|
||||
.alert h5 {
|
||||
margin-top: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,16 +13,7 @@
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
@if($component = Session::get('component'))
|
||||
<div class="alert alert-{{ $component->isValid() ? 'success' : 'danger' }}">
|
||||
@if($component->isValid())
|
||||
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.components.add.success')) }}
|
||||
@else
|
||||
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.whoops'), trans('dashboard.components.add.failure').' '.$component->getErrors()) }}
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@include('partials.dashboard.errors')
|
||||
<form name="CreateComponentForm" class="form-vertical" role="form" action="/dashboard/components/add" method="POST">
|
||||
<fieldset>
|
||||
<div class="form-group">
|
||||
|
||||
@@ -13,16 +13,7 @@
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
@if($savedComponent = Session::get('savedComponent'))
|
||||
<div class="alert alert-{{ $savedComponent->isValid() ? 'success' : 'danger' }}">
|
||||
@if($savedComponent->isValid())
|
||||
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.components.edit.success')) }}
|
||||
@else
|
||||
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.whoops'), trans('dashboard.components.edit.failure').' '.$component->getErrors()) }}
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@include('partials.dashboard.errors')
|
||||
<form name="EditComponentForm" class="form-vertical" role="form" action="/dashboard/components/{{ $component->id }}/edit" method="POST">
|
||||
<fieldset>
|
||||
<div class="form-group">
|
||||
|
||||
@@ -13,16 +13,7 @@
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
@if($group = Session::get('group'))
|
||||
<div class="alert alert-{{ $group->isValid() ? 'success' : 'danger' }}">
|
||||
@if($group->isValid())
|
||||
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.components.groups.add.success')) }}
|
||||
@else
|
||||
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.whoops'), trans('dashboard.components.groups.add.failure').' '.$group->getErrors()) }}
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@include('partials.dashboard.errors')
|
||||
<form name="CreateComponentGroupForm" class="form-vertical" role="form" action="/dashboard/components/groups/add" method="POST">
|
||||
<fieldset>
|
||||
<div class="form-group">
|
||||
|
||||
@@ -13,16 +13,7 @@
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
@if($incident = Session::get('incident'))
|
||||
<div class="alert alert-{{ $incident->isValid() ? 'success' : 'danger' }}">
|
||||
@if($incident->isValid())
|
||||
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.incidents.add.success')) }}
|
||||
@else
|
||||
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.whoops'), trans('dashboard.incidents.add.failure').' '.$incident->getErrors()) }}
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@include('partials.dashboard.errors')
|
||||
{{ Form::open(['name' => 'IncidentForm', 'class' => 'form-vertical', 'role' => 'form']) }}
|
||||
<fieldset>
|
||||
<div class="form-group">
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
@include('partials.dashboard.errors')
|
||||
{{ Form::open(['name' => 'IncidentForm', 'class' => 'form-vertical', 'role' => 'form']) }}
|
||||
<fieldset>
|
||||
<div class="form-group">
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<div class="content-wrapper header-fixed">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
@include('partials.dashboard.errors')
|
||||
<p class="lead">{{ trans_choice('dashboard.incidents.logged', $incidents->count(), ['count' => $incidents->count()]) }}</p>
|
||||
|
||||
<div class="striped-list">
|
||||
|
||||
@@ -13,16 +13,7 @@
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
@if($template = Session::get('template'))
|
||||
<div class="alert alert-{{ $template->isValid() ? 'success' : 'danger' }}">
|
||||
@if($template->isValid())
|
||||
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.incidents.templates.add.success')) }}
|
||||
@else
|
||||
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.whoops'), trans('dashboard.incidents.templates.add.failure').' '.$template->getErrors()) }}
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@include('partials.dashboard.errors')
|
||||
{{ Form::open(['name' => 'IncidentTemplateForm', 'class' => 'form-vertical', 'role' => 'form']) }}
|
||||
<fieldset>
|
||||
<div class="form-group">
|
||||
|
||||
@@ -10,13 +10,7 @@
|
||||
<div class="col-sm-12">
|
||||
<form id="settings-form" name="SettingsForm" class="form-vertical" role="form" action="/dashboard/settings" method="POST" enctype="multipart/form-data">
|
||||
<h4 class="sub-header" id="application-setup">{{ trans('dashboard.settings.app-setup.app-setup') }}</h4>
|
||||
|
||||
@if(($saved = Session::get('saved')))
|
||||
<div class="alert alert-success"><strong>{{ trans('dashboard.settings.edit.success') }}</strong></div>
|
||||
@elseif(Session::has('error_message'))
|
||||
<div class="alert alert-danger"><strong>{{ Session::get('error_message') }}</strong></div>
|
||||
@endif
|
||||
|
||||
@include('partials.dashboard.errors')
|
||||
<fieldset>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
|
||||
@@ -10,13 +10,7 @@
|
||||
<div class="col-sm-12">
|
||||
<form name="SettingsForm" class="form-vertical" role="form" action="/dashboard/settings" method="POST">
|
||||
<h4 class="sub-header" id="security">{{ trans('dashboard.settings.security.security') }}</h4>
|
||||
|
||||
@if($saved = Session::get('saved'))
|
||||
<div class="alert alert-success"><strong>{{ trans('dashboard.settings.edit.success') }}</strong></div>
|
||||
@elseif(Session::has('saved'))
|
||||
<div class="alert alert-danger"><strong>{{ trans('dashboard.settings.edit.failure') }}</strong></div>
|
||||
@endif
|
||||
|
||||
@include('partials.dashboard.errors')
|
||||
<fieldset>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
|
||||
@@ -10,13 +10,7 @@
|
||||
<div class="col-sm-12">
|
||||
<form name="SettingsForm" class="form-vertical" role="form" action="/dashboard/settings" method="POST">
|
||||
<h4 class="sub-header" id="stylesheet">{{ trans('dashboard.settings.stylesheet.stylesheet') }}</h4>
|
||||
|
||||
@if($saved = Session::get('saved'))
|
||||
<div class="alert alert-success"><strong>{{ trans('dashboard.settings.edit.success') }}</strong></div>
|
||||
@elseif(Session::has('saved'))
|
||||
<div class="alert alert-danger"><strong>{{ trans('dashboard.settings.edit.failure') }}</strong></div>
|
||||
@endif
|
||||
|
||||
@include('partials.dashboard.errors')
|
||||
<fieldset>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
|
||||
@@ -10,13 +10,7 @@
|
||||
<div class="col-sm-12">
|
||||
<form name="SettingsForm" class="form-vertical" role="form" action="/dashboard/settings" method="POST">
|
||||
<h4 class="sub-header" id="theme">{{ trans('dashboard.settings.theme.theme') }}</h4>
|
||||
|
||||
@if($saved = Session::get('saved'))
|
||||
<div class="alert alert-success"><strong>{{ trans('dashboard.settings.edit.success') }}</strong></div>
|
||||
@elseif(Session::has('saved'))
|
||||
<div class="alert alert-danger"><strong>{{ trans('dashboard.settings.edit.failure') }}</strong></div>
|
||||
@endif
|
||||
|
||||
@include('partials.dashboard.errors')
|
||||
<fieldset>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
|
||||
@@ -12,16 +12,7 @@
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
@if($created = Session::get('created'))
|
||||
<div class="alert alert-success">
|
||||
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.team.add.success')) }}
|
||||
</div>
|
||||
@elseif($errors = Session::get('errors'))
|
||||
<div class="alert alert-danger">
|
||||
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.whoops'), trans('dashboard.team.add.failure')) }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@include('partials.dashboard.errors')
|
||||
<form name="UserForm" class="form-vertical" role="form" action="/dashboard/team/add" method="POST">
|
||||
<fieldset>
|
||||
<div class="form-group">
|
||||
|
||||
@@ -12,16 +12,7 @@
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
@if($updated = Session::get('updated'))
|
||||
<div class="alert alert-{{ $updated ? 'success' : 'danger' }}">
|
||||
@if($updated)
|
||||
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.team.edit.success')) }}
|
||||
@else
|
||||
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.whoops'), trans('dashboard.team.edit.failure')) }}
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@include('partials.dashboard.errors')
|
||||
<form name="UserForm" class="form-vertical" role="form" action="/dashboard/team/{{ $user->id }}" method="POST">
|
||||
<fieldset>
|
||||
<div class="form-group">
|
||||
|
||||
@@ -12,16 +12,7 @@
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
@if($updated = Session::get('updated'))
|
||||
<div class="alert alert-{{ $updated ? 'success' : 'danger' }}">
|
||||
@if($updated)
|
||||
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.team.edit.success')) }}
|
||||
@else
|
||||
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.whoops'), trans('dashboard.team.edit.failure')) }}
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@include('partials.dashboard.errors')
|
||||
<form name="UserForm" class="form-vertical" role="form" action="/dashboard/user" method="POST">
|
||||
<fieldset>
|
||||
<div class="form-group">
|
||||
|
||||
15
app/views/partials/dashboard/_error.blade.php
Normal file
15
app/views/partials/dashboard/_error.blade.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<div class="alerts">
|
||||
<div class="alert alert-{{ $level }} alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span></button>
|
||||
@if(isset($title)) <h5>{{ $title }}</h5> @endif
|
||||
@if(is_array($message))
|
||||
<ul class="list-unstyled">
|
||||
@foreach ($message as $msg)
|
||||
<li>{{ $msg }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@else
|
||||
{{ $message }}
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
15
app/views/partials/dashboard/errors.blade.php
Normal file
15
app/views/partials/dashboard/errors.blade.php
Normal file
@@ -0,0 +1,15 @@
|
||||
@if ($errors->any())
|
||||
@include('partials.dashboard._error', ['level' => 'danger', 'title' => Session::get('title'), 'message' => $errors->all(':message')])
|
||||
@endif
|
||||
|
||||
@if ($message = Session::get('success'))
|
||||
@include('partials.dashboard._error', ['level' => 'success', 'title' => Session::get('title'), 'message' => $message])
|
||||
@endif
|
||||
|
||||
@if ($message = Session::get('warning'))
|
||||
@include('partials.dashboard._error', ['level' => 'warning', 'title' => Session::get('title'), 'message' => $message])
|
||||
@endif
|
||||
|
||||
@if ($message = Session::get('info'))
|
||||
@include('partials.dashboard._error', ['level' => 'info', 'title' => Session::get('title'), 'message' => $message])
|
||||
@endif
|
||||
@@ -99,7 +99,13 @@ class DashComponentController extends Controller
|
||||
$_component = Binput::get('component');
|
||||
$component->update($_component);
|
||||
|
||||
return Redirect::back()->with('savedComponent', $component);
|
||||
if (! $component->isValid()) {
|
||||
return Redirect::back()->withInput(Binput::all())
|
||||
->with('title', sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.whoops'), trans('dashboard.components.edit.failure')))
|
||||
->with('errors', $component->getErrors());
|
||||
}
|
||||
|
||||
return Redirect::back()->with('success', sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.components.edit.success')));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,7 +133,13 @@ class DashComponentController extends Controller
|
||||
$_component = Binput::get('component');
|
||||
$component = Component::create($_component);
|
||||
|
||||
return Redirect::back()->with('component', $component);
|
||||
if (! $component->isValid()) {
|
||||
return Redirect::back()->withInput(Binput::all())
|
||||
->with('title', sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.whoops'), trans('dashboard.components.add.failure')))
|
||||
->with('errors', $component->getErrors());
|
||||
}
|
||||
|
||||
return Redirect::back()->with('success', sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.components.add.success')));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -179,6 +191,12 @@ class DashComponentController extends Controller
|
||||
{
|
||||
$group = ComponentGroup::create(Binput::get('group'));
|
||||
|
||||
return Redirect::back()->withGroup($group);
|
||||
if (! $group->isValid()) {
|
||||
return Redirect::back()->withInput(Binput::all())
|
||||
->with('title', sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.whoops'), trans('dashboard.components.groups.add.failure')))
|
||||
->with('errors', $group->getErrors());
|
||||
}
|
||||
|
||||
return Redirect::back()->with('success', sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.components.groups.add.success')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,24 @@ class DashIncidentController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new incident.
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function createIncidentAction()
|
||||
{
|
||||
$incident = Incident::create(Binput::get('incident'));
|
||||
|
||||
if (! $incident->isValid()) {
|
||||
return Redirect::back()->withInput(Binput::all())
|
||||
->with('title', sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.whoops'), trans('dashboard.incidents.add.failure')))
|
||||
->with('errors', $incident->getErrors());
|
||||
}
|
||||
|
||||
return Redirect::back()->with('success', sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.incidents.add.success')));
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the add incident template view.
|
||||
*
|
||||
@@ -60,19 +78,13 @@ class DashIncidentController extends Controller
|
||||
$_template = Binput::get('template');
|
||||
$template = IncidentTemplate::create($_template);
|
||||
|
||||
return Redirect::back()->with('template', $template);
|
||||
}
|
||||
if (! $template->isValid()) {
|
||||
return Redirect::back()->withInput(Binput::all())
|
||||
->with('title', sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.incidents.templates.add.failure')))
|
||||
->with('errors', $template->getErrors());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new incident.
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function createIncidentAction()
|
||||
{
|
||||
$incident = Incident::create(Binput::get('incident'));
|
||||
|
||||
return Redirect::back()->withInput(Binput::all())->with('incident', $incident);
|
||||
return Redirect::back()->with('success', sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.incidents.templates.add.success')));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,6 +128,12 @@ class DashIncidentController extends Controller
|
||||
$_incident = Binput::get('incident');
|
||||
$incident->update($_incident);
|
||||
|
||||
return Redirect::to('dashboard/incidents');
|
||||
if (! $incident->isValid()) {
|
||||
return Redirect::back()->withInput(Binput::all())
|
||||
->with('title', sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.incidents.templates.edit.failure')))
|
||||
->with('errors', $incident->getErrors());
|
||||
}
|
||||
|
||||
return Redirect::to('dashboard/incidents')->with('success', sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.incidents.edit.success')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ class DashSettingsController extends Controller
|
||||
];
|
||||
|
||||
View::share('subTitle', $this->subTitle);
|
||||
|
||||
View::share('subMenu', $this->subMenu);
|
||||
}
|
||||
|
||||
@@ -167,15 +168,15 @@ class DashSettingsController extends Controller
|
||||
$maxSize = $file->getMaxFilesize();
|
||||
|
||||
if ($file->getSize() > $maxSize) {
|
||||
return Redirect::back()->withErrorMessage("You need to upload an image that is less than $maxSize.");
|
||||
return Redirect::back()->withErrors("You need to upload an image that is less than $maxSize.");
|
||||
}
|
||||
|
||||
if (!$file->isValid() || $file->getError()) {
|
||||
return Redirect::back()->withErrorMessage($file->getErrorMessage());
|
||||
return Redirect::back()->withErrors($file->getErrorMessage());
|
||||
}
|
||||
|
||||
if (strpos($file->getMimeType(), 'image/') !== 0) {
|
||||
return Redirect::back()->withErrorMessage('Only images may be uploaded.');
|
||||
return Redirect::back()->withErrors('Only images may be uploaded.');
|
||||
}
|
||||
|
||||
// Store the banner.
|
||||
@@ -202,9 +203,9 @@ class DashSettingsController extends Controller
|
||||
]);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return Redirect::back()->withSaved(false);
|
||||
return Redirect::back()->with('errors', trans('dashboard.settings.edit.failure'));
|
||||
}
|
||||
|
||||
return Redirect::back()->withSaved(true);
|
||||
return Redirect::back()->with('success', trans('dashboard.settings.edit.success'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,9 +47,16 @@ class DashUserController extends Controller
|
||||
unset($items['password']);
|
||||
}
|
||||
|
||||
$updated = Auth::user()->update($items);
|
||||
$user = Auth::user();
|
||||
$user->update($items);
|
||||
|
||||
return Redirect::back()->with('updated', $updated);
|
||||
if (! $user->isValid()) {
|
||||
return Redirect::back()->withInput(Binput::except('password'))
|
||||
->with('title', sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.whoops'), trans('dashboard.team.edit.failure')))
|
||||
->with('errors', $user->getErrors());
|
||||
}
|
||||
|
||||
return Redirect::back()->with('success', sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.team.edit.success')));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,10 +3,7 @@
|
||||
namespace CachetHQ\Cachet\Http\Controllers;
|
||||
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\User;
|
||||
use GrahamCampbell\Binput\Facades\Binput;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class DashboardController extends Controller
|
||||
@@ -26,80 +23,6 @@ class DashboardController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the team members view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showTeamView()
|
||||
{
|
||||
$team = User::all();
|
||||
|
||||
return View::make('dashboard.team.index')->with([
|
||||
'pageTitle' => trans('dashboard.team.team').' - '.trans('dashboard.dashboard'),
|
||||
'teamMembers' => $team,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the edit team member view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showTeamMemberView(User $user)
|
||||
{
|
||||
return View::make('dashboard.team.edit')->with([
|
||||
'pageTitle' => trans('dashboard.team.edit.title').' - '.trans('dashboard.dashboard'),
|
||||
'user' => $user,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the add team member view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showAddTeamMemberView()
|
||||
{
|
||||
return View::make('dashboard.team.add')->with([
|
||||
'pageTitle' => trans('dashboard.team.add.title').' - '.trans('dashboard.dashboard'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new team member.
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postAddUser()
|
||||
{
|
||||
$user = User::create(Binput::all());
|
||||
|
||||
if ($user->isValid()) {
|
||||
return Redirect::back()->with('created', $user->isValid());
|
||||
} else {
|
||||
return Redirect::back()
|
||||
->withInput(Binput::except('password'))
|
||||
->with('errors', $user->getErrors());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a user.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\User $user
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function postUpdateUser(User $user)
|
||||
{
|
||||
$items = Binput::all();
|
||||
|
||||
$updated = $user->update($items);
|
||||
|
||||
return Redirect::back()->with('updated', $updated);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the metrics view.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user