php - eloquent boot not firing only for one class -


i'm using eloquent project , delete articles. problem database complicated. there articles, have article_lvl1 , article_lvl1 have article_lvl2. when delete article event functions work fine :

<?php namespace app\model;  class article extends \illuminate\database\eloquent\model { public static function boot() {     parent::boot();      // cause delete of product cascade children deleted     static::deleting(function($article)     {         $article->articleniveau1()->delete();         $article->articleniveau2()->delete();     }); }  public function articleniveau1() {     return $this->hasmany('app\model\articleniveau1', 'id_article'); }  public function articleniveau2() {     return $this->hasmany('app\model\articleniveau2', 'id_article'); }  protected $table = 'article'; public $timestamps = false; protected $primarykey = 'id_article'; } 

but article can have article_informations, can have article_date. problem in boot functions executes fine on delete, not article_date. here code :

<?php namespace app\model;  class article_informations extends \illuminate\database\eloquent\model { public function article() {     return $this->belongsto('app\model\article', 'id_article'); }  public function articleniveau1() {     return $this->belongsto('app\model\articleniveau1', 'id_nv1'); }  public function articleniveau2() {     return $this->belongsto('app\model\articleniveau2', 'id_nv2'); }  public function article_date() {     return $this->hasmany('app\model\article_date', 'id_info'); }  public static function boot() {     parent::boot();      // cause delete of product cascade children deleted     static::deleting(function($info)     {         $info->article_date()->delete();     }); }  protected $table = 'article_informations'; public $timestamps = false; protected $primarykey = 'id_info'; } 

i don't know why, it's event not fired on delete. can explain me ?


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -