Add the validation error fields in the templates

This commit is contained in:
Nabeel Shahzad
2018-02-06 10:18:22 -06:00
parent 995d53df3e
commit 8d76e16220
12 changed files with 77 additions and 10 deletions

View File

@@ -2,12 +2,18 @@
namespace App\Models;
use App\Models\Observers\AirportObserver;
use Illuminate\Notifications\Notifiable;
use Log;
/**
* Class Airport
* @package App\Models
*/
class Airport extends BaseModel
{
use Notifiable;
public $table = 'airports';
public $timestamps = false;
public $incrementing = false;
@@ -50,11 +56,21 @@ class Airport extends BaseModel
/**
* Callbacks
*/
protected static function boot()
public static function boot()
{
parent::boot();
static::creating(function (Airport $model) {
if(!empty($model->iata)) {
static::creating(function ($model) {
if(filled($model->iata)) {
$model->iata = strtoupper(trim($model->iata));
}
$model->icao = strtoupper(trim($model->icao));
$model->id = $model->icao;
});
static::updating(function($model) {
if (filled($model->iata)) {
$model->iata = strtoupper(trim($model->iata));
}