1
0
Fork 0
develop
panliang 2023-05-25 16:41:21 +08:00
parent 5811fdfb0e
commit 0d735f631a
2 changed files with 12 additions and 0 deletions

View File

@ -5,6 +5,9 @@ namespace App\Models;
use EloquentFilter\Filterable;
use Illuminate\Database\Eloquent\Model;
/**
* 收获记录
*/
class PlantHarvestLog extends Model
{
use Filterable;

View File

@ -4,6 +4,7 @@ namespace App\Services\Admin;
use App\Models\RegionPlantLog;
use App\Filters\Admin\RegionPlantLogFilter;
use App\Models\PlantHarvestLog;
/**
* @method RegionPlantLog getModel()
@ -15,4 +16,12 @@ class CropPlantService extends BaseService
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();
}
}