Files
opensem/app/Models/Shop/Genre.php
Ludovic CANDELLIER d218125165 Add varieties
2020-04-14 01:24:37 +02:00

27 lines
481 B
PHP

<?php
namespace App\Models\Shop;
use Illuminate\Database\Eloquent\Model;
class Genre extends Model
{
protected $guarded = ['id'];
protected $table = 'shop_product_genres';
public function family()
{
return $this->belongsTo('App\Models\Shop\Family');
}
public function species()
{
return $this->hasMany('App\Models\Shop\Specie');
}
public function scopeByName($query,$name)
{
return $query->where('name', $name);
}
}