71 lines
2.3 KiB
PHP
71 lines
2.3 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use App\Traits\Models\ActivityLog;
|
||
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @property string $quality_title Title de la section "qualité".
|
||
|
|
* @property string $quality_text WYSIWYG - Contenu de la section qualité.
|
||
|
|
* @property string $product1_title Titre de la première partie de la section "produits".
|
||
|
|
* @property string $product1_text WYSIWYG - Contenu de la première partie de la section produit.
|
||
|
|
* @property string $product2_title Titre de la deuxième partie de la section "produits".
|
||
|
|
* @property string $product2_text WYSIWYG - Contenu de la deuxième partie de la section produit.
|
||
|
|
* @property string $environment_title Titre de la section "environnement".
|
||
|
|
* @property string $environment_text WYSIWYG - Contenu de la section "environment".
|
||
|
|
* @property-read \Carbon\Carbon $created_at Created date.
|
||
|
|
* @property-read \Carbon\Carbon $updated_at Updated date.
|
||
|
|
*
|
||
|
|
* @property-read \App\Models\Picto $pictos Pictos Many-to-many relationship.
|
||
|
|
*/
|
||
|
|
class CommitmentPage extends Model
|
||
|
|
{
|
||
|
|
use ActivityLog;
|
||
|
|
use HasFactory;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* The attributes that are mass assignable.
|
||
|
|
*
|
||
|
|
* @var array<int, string>
|
||
|
|
*/
|
||
|
|
protected $fillable = [
|
||
|
|
'quality_title',
|
||
|
|
'quality_text',
|
||
|
|
'product1_title',
|
||
|
|
'product1_text',
|
||
|
|
'product2_title',
|
||
|
|
'product2_text',
|
||
|
|
'environment_title',
|
||
|
|
'environment_text',
|
||
|
|
];
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Perform any actions required after the model boots.
|
||
|
|
*
|
||
|
|
* @return void
|
||
|
|
*/
|
||
|
|
protected static function booted(): void
|
||
|
|
{
|
||
|
|
static::creating(function () {
|
||
|
|
throw new \RuntimeException("Creating a new page is not authorized");
|
||
|
|
});
|
||
|
|
static::deleting(function () {
|
||
|
|
throw new \RuntimeException('Deleting a page is not authorized');
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
// * RELATIONS
|
||
|
|
|
||
|
|
/**
|
||
|
|
* The pictos that belong to the page.
|
||
|
|
*
|
||
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||
|
|
*/
|
||
|
|
public function pictos(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||
|
|
{
|
||
|
|
return $this->belongsToMany(Picto::class);
|
||
|
|
}
|
||
|
|
}
|