32 lines
501 B
PHP
32 lines
501 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App;
|
||
|
|
|
||
|
|
use App\Scopes\SystemScope;
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
|
||
|
|
class Format extends Model
|
||
|
|
{
|
||
|
|
|
||
|
|
/**
|
||
|
|
* The "booting" method of the model.
|
||
|
|
*
|
||
|
|
* @return void
|
||
|
|
*/
|
||
|
|
protected static function boot()
|
||
|
|
{
|
||
|
|
parent::boot();
|
||
|
|
|
||
|
|
static::addGlobalScope(new SystemScope);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* The sujet that belong to the format.
|
||
|
|
*/
|
||
|
|
public function sujets()
|
||
|
|
{
|
||
|
|
return $this->belongsToMany('App\Sujet', 'sujets_formats', 'format_id', 'sujet_id');
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|