for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php namespace App\LaravelRestCms\Template;
use App\LaravelRestCms\BaseModel;
use App\LaravelRestCms\Template\TemplateDetail;
class Template extends BaseModel {
public static $searchCols = ['name', 'class'];
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'templates';
* The attributes that are mass assignable.
* @var array
protected $fillable = [];
* The attributes excluded from the model's JSON form.
protected $hidden = [];
* Rules to validate when creating a model
protected static $createRules = [
'name' => 'required|unique:templates',
];
* Joins the page_detail table
* @return \Illuminate\Database\Eloquent\Relations\HasMany
public function detail()
{
return $this->hasMany(TemplateDetail::class, 'template_id', 'id');
}