私のサービスは、このようなものです:解決方法App Repositories FavoriteRepository :: delete()の引数1がありませんか? (Laravel 5.3)
public function delete($store_id)
{
$result = $this->favorite_repository->delete($store_id);
dd($result);
}
私のリポジトリは、このようなものです:
public function delete($store_id)
{
$data = self::where('favoritable_id', $store_id)->delete();
return $data;
}
が存在エラー:
アプリ\リポジトリの引数1がありません\ FavoriteRepository :: delete()、 で呼び出された C:\ xampp \ htdocs \ mysystem \ app \ Repositories \ FavoriteRepository.php 行45定義済み
私を助けることができますか?
UPDATEはEloquentRepositoryでの削除機能は、このようなものです:あなたはこのpakageを使用しているよう
public function delete($id)
{
// Find the given instance
$deleted = false;
$instance = $id instanceof Model ? $id : $this->find($id);
if ($instance) {
// Delete the instance
$deleted = $instance->delete();
// Fire the deleted event
$this->getContainer('events')->fire($this->getRepositoryId().'.entity.deleted', [$this, $instance]);
}
return [
$deleted,
$instance,
];
}
どのクラスが 'App \ Repositories \ FavoriteRepository'を拡張していますか? 'パブリック関数は、($のSTORE_ID)を削除 { $データ=自己: – Mohan
@Angryコーダ、EloquentRepository –
が更新答え – Mohan