*/ use HasFactory, LogsModelActivity; protected $fillable = [ 'name', 'external_ip', 'enable', ]; protected $casts = [ 'name' => 'string', 'external_ip'=> 'string', 'enable' => 'boolean', ]; public function rooms() { return $this->hasMany(Room::class); } public function songs(){ return $this->belongsToMany(Song::class) ->withPivot('counts') ->withTimestamps(); } protected static function booted() { static::deleting(function (Branch $branch) { $branch->rooms()->delete(); }); } }