public function update($id = null) { $model = $this->model; $id = $id; if (count($_POST) > 0) { $record = $model::find($id); if ($record->validate($_POST)) { $record->save(); header("Location: {$this->url}"); exit; } } $form = \Gravel\Scaffolding::createEditForm($this->table, $this->model, $id); $this->loadView('utilities/genericUpdate', compact('form')); }
public function update($id = null) { $id = $id; $user = User::find($id); if (count($_POST) > 0) { $password = $user->password; if ($user->validate($_POST)) { if ($password !== $user->password) { $user->password = sha1($user->password); } $user->save(); header("Location: {$_SERVER['HTTP_REFERER']}"); exit; } } $form = \Gravel\Scaffolding::createEditForm($this->table, $this->model, $id); $this->loadView('utilities/genericUpdate', compact('id', 'user', 'form')); }
<?php use Gravel\Scaffolding; ?> @extends('templates/admin') @section('content') @include('utilities/form-errors') <?php echo Scaffolding::createEditForm('blog_posts', 'Blog', $id); ?> @endsection
<?php use Gravel\Scaffolding; ?> @extends('templates/admin') @section('content') @include('utilities/form-errors') <?php echo Scaffolding::createInsertForm('blog_posts', 'Blog'); ?> @endsection
<?php use Gravel\Scaffolding; ?> @extends('templates/admin') @section('content') @include('utilities/form-errors') <?php echo Scaffolding::createInsertForm('brands', 'Brand'); ?> @endsection
<?php use Gravel\Scaffolding; ?> @extends('templates/admin') @section('content') @include('utilities/form-errors') <?php echo Scaffolding::createEditForm('users', 'User', $id); ?> @endsection
<?php use Gravel\Scaffolding; ?> @extends('templates/admin') @section('content') @include('utilities/form-errors') <?php echo Scaffolding::createEditForm('brands', 'Brand', $id); ?> @endsection
<?php use Gravel\Scaffolding; ?> @extends('templates/admin') @section('content') @include('utilities/form-errors') <?php echo Scaffolding::createInsertForm('users', 'User'); ?> @endsection