38 lines
773 B
PHP
38 lines
773 B
PHP
<?php
|
|
|
|
namespace App\Models\Botanic;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
use Wildside\Userstamps\Userstamps;
|
|
use Rinvex\Tags\Traits\Taggable;
|
|
|
|
class Specie extends Model
|
|
{
|
|
use SoftDeletes, Taggable, UserStamps;
|
|
|
|
protected $guarded = ['id'];
|
|
protected $table = 'botanic_species';
|
|
|
|
public function Genre()
|
|
{
|
|
return $this->belongsTo('App\Models\Botanic\Genre');
|
|
}
|
|
|
|
public function Varieties()
|
|
{
|
|
return $this->hasMany('App\Models\Botanic\Variety');
|
|
}
|
|
|
|
public function Articles()
|
|
{
|
|
return $this->morphMany('App\Models\Shop\Article', 'product');
|
|
}
|
|
|
|
public function scopeByName($query, $name)
|
|
{
|
|
return $query->where('name', $name);
|
|
}
|
|
}
|