infobloks.php 645 Bytes
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class infobloks extends Model
{
    use HasFactory;

    protected $fillable = [
        'name',
        'is_remove',
        'sort',
    ];

    public function ScopeActive($query) {
        return $query->where('is_remove', '=', '0');
    }

    /*
    * Связь модели Инфоблоки (Infobloks) с моделью Доп.информация (dop_info)
      один-ко-многим
    */
    public function model_dop_info() {
        return $this->hasMany(Dop_info::class, 'infoblok_id');
    }
}