for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Created by Reliese Model.
* Date: Thu, 12 Jul 2018 22:39:27 +0000.
*/
namespace App\Models;
use \Backpack\CRUD\CrudTrait;
use \Backpack\CRUD\ModelTraits\SpatieTranslatable\HasTranslations;
* Class Skill
*
* @property int $id
* @property string $name
* @property string $description
* @property int $skill_type_id
* @property \App\Models\Lookup\SkillType $skill_type
* @property \Illuminate\Database\Eloquent\Collection $skill_declarations
class Skill extends BaseModel
{
use CrudTrait;
Backpack\CRUD\CrudTrait
App\Models\Skill
$Type
$fakeColumns
use HasTranslations;
* @var $casts string[]
$casts
0
* */
protected $casts = [
'skill_type_id' => 'int'
];
* @var $fillable string[]
$fillable
protected $fillable = [
'name',
'description',
'skill_type_id'
* @var $translatable string[]
$translatable
public $translatable = [
public function skill_type() // phpcs:ignore
return $this->belongsTo(\App\Models\Lookup\SkillType::class);
}
public function skill_declarations() // phpcs:ignore
return $this->hasMany(\App\Models\SkillDeclaration::class);
* Override the toArray() method to return the localized properties for
* name and description. This was causing issues for ajax responses.
* @return mixed[]
public function toArray() : array
$array = parent::toArray();
$array['name'] = $this->name;
$array['description'] = $this->description;
return $array;