tethys/app/Models/License.php

40 lines
903 B
PHP
Raw Normal View History

2018-08-06 12:30:51 +00:00
<?php
2018-09-10 13:09:10 +00:00
namespace App\Models;
2018-08-06 12:30:51 +00:00
use Illuminate\Database\Eloquent\Model;
2018-09-10 13:09:10 +00:00
use App\Models\Dataset;
2018-08-06 12:30:51 +00:00
class License extends Model
{
protected $table = 'document_licences';
public $timestamps = false;
protected $fillable = [
2018-09-12 15:30:42 +00:00
'name_long',
2018-08-06 12:30:51 +00:00
'language',
'link_licence',
'link_logo',
2018-09-12 15:30:42 +00:00
'desc_text',
'desc_markup',
'comment_internal',
2018-08-06 12:30:51 +00:00
'mime_type',
2018-09-10 13:09:10 +00:00
'sort_order',
2018-09-12 15:30:42 +00:00
'active',
'pod_allowed'
2018-08-06 12:30:51 +00:00
];
// See the array called $touches? This is where you put all the relationships you want to get
// updated_at as soon as this Model is updated
protected $touches = ['datasets'];
2018-08-06 12:30:51 +00:00
public function datasets()
{
2018-09-10 13:09:10 +00:00
return $this->belongsToMany(Dataset::class, 'link_documents_licences', 'licence_id', 'document_id');
2018-08-06 12:30:51 +00:00
}
2018-10-10 16:28:51 +00:00
public function getCheckedAttribute()
{
return "false";
}
2018-08-06 12:30:51 +00:00
}