31 lines
520 B
PHP
31 lines
520 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use EloquentFilter\Filterable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Crop extends Model
|
|
{
|
|
use Filterable;
|
|
|
|
protected $casts = [
|
|
'extends' => 'array'
|
|
];
|
|
|
|
public function scopeSort($q)
|
|
{
|
|
return $q->orderBy('sort', 'desc')->orderBy('created_at', 'desc');
|
|
}
|
|
|
|
protected $fillable = [
|
|
'category_id',
|
|
'name', 'parent_id',
|
|
'unit',
|
|
'path', 'is_end',
|
|
'sort',
|
|
'extends',
|
|
'crop_type'
|
|
];
|
|
}
|