..
This commit is contained in:
@@ -5,6 +5,8 @@ declare(strict_types=1);
|
||||
namespace App\Model;
|
||||
|
||||
use Aether\AetherModel;
|
||||
use Aether\Contract\TreeableInterface;
|
||||
use Aether\Traits\AetherTree;
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Builder;
|
||||
use Hyperf\Database\Model\Relations\BelongsTo;
|
||||
@@ -26,8 +28,9 @@ use Hyperf\Database\Model\Relations\HasMany;
|
||||
* @property Carbon $updated_at
|
||||
* @property Carbon $deleted_at
|
||||
*/
|
||||
class Campus extends AetherModel
|
||||
class Campus extends AetherModel implements TreeableInterface
|
||||
{
|
||||
use AetherTree;
|
||||
protected ?string $table = 'da_campus';
|
||||
|
||||
protected array $fillable = [
|
||||
@@ -52,10 +55,12 @@ class Campus extends AetherModel
|
||||
];
|
||||
|
||||
protected array $search = [
|
||||
'name' => 'like',
|
||||
'level' => '=',
|
||||
'parent_id' => '=',
|
||||
'city' => 'like',
|
||||
'province' => 'like',
|
||||
'status' => '=',
|
||||
];
|
||||
|
||||
protected array|bool|string $sortable = false;
|
||||
@@ -119,4 +124,14 @@ class Campus extends AetherModel
|
||||
->where('status', 1)
|
||||
->whereNull('deleted_at');
|
||||
}
|
||||
|
||||
protected function getParentIdField(): string
|
||||
{
|
||||
return 'parent_id';
|
||||
}
|
||||
|
||||
protected function getSortField(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user