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