Add thumbs views in datatables with traits
This commit is contained in:
@@ -7,10 +7,13 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Wildside\Userstamps\Userstamps;
|
||||
use Rinvex\Tags\Traits\Taggable;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
|
||||
class Specie extends Model
|
||||
use App\Traits\Model\Imageable;
|
||||
|
||||
class Specie extends Model implements HasMedia
|
||||
{
|
||||
use SoftDeletes, Taggable, UserStamps;
|
||||
use Imageable, SoftDeletes, Taggable, UserStamps;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'botanic_species';
|
||||
@@ -22,12 +25,12 @@ class Specie extends Model
|
||||
|
||||
public function Genre()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Botanic\Genre');
|
||||
return $this->belongsTo(Genre::class);
|
||||
}
|
||||
|
||||
public function Varieties()
|
||||
{
|
||||
return $this->hasMany('App\Models\Botanic\Variety');
|
||||
return $this->hasMany(Variety::class);
|
||||
}
|
||||
|
||||
public function Articles()
|
||||
@@ -37,6 +40,6 @@ class Specie extends Model
|
||||
|
||||
public function scopeByName($query, $name)
|
||||
{
|
||||
return $query->where('name', $name);
|
||||
return $query->where($this->table . '.name', $name);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user