'string', ]; /** * Validation rules * * @var array */ public static $rules = [ #'icao' => 'required|unique:airports' ]; /** * Some fancy callbacks */ protected static function boot() { parent::boot(); /** * Make sure the ID is set to the ICAO */ static::creating(function (Airport $model) { $model->icao = strtoupper($model->icao); $model->id = $model->icao; }); } }