28 lines
702 B
PHP
28 lines
702 B
PHP
<?php
|
|
|
|
namespace App\Services\Admin;
|
|
|
|
use App\Models\RegionPlantLog;
|
|
use App\Filters\Admin\RegionPlantLogFilter;
|
|
use App\Models\PlantHarvestLog;
|
|
|
|
/**
|
|
* @method RegionPlantLog getModel()
|
|
* @method RegionPlantLog|\Illuminate\Database\Query\Builder query()
|
|
*/
|
|
class CropPlantService extends BaseService
|
|
{
|
|
protected string $modelName = RegionPlantLog::class;
|
|
|
|
protected string $modelFilterName = RegionPlantLogFilter::class;
|
|
|
|
public function delete(string $ids): mixed
|
|
{
|
|
$id = explode(',', $ids);
|
|
// 同时删除收获记录
|
|
PlantHarvestLog::whereIn('plant_id', $id)->delete();
|
|
|
|
return $this->query()->whereIn($this->primaryKey(), $id)->delete();
|
|
}
|
|
}
|