namespace App\Repositories; use App\Entities\Sample; use Illuminate\Database\Eloquent\Collection; class SampleRepository implements ClientSenderEmailAddressInterface { public function __construct(Sample $resource) { $this->resource = $resource; } /** * idを指定して物理削除 * * @param int $id * @return void */ public function destroyById(int $id): void { $this->resource->where([ 'id' => $id ])->forceDelete(); } /** * idを指定して論理削除されたデータをリストア * * @param int $id * @return void */ public function restoreById(int $id): void { $this->resource->where('id', $id)->withTrashed()->update(['deleted_at' => null]); } }