Class App\Models\Repository\UserRepository contains 1 abstract method and must therefore be declared abstract or implement the remaining methods

2018-03-07

1936

通りすがりの人

関連メモ

現在:公開中

Class App\Models\Repository\UserRepository contains 1 abstract method and must therefore be declared abstract or implement the remaining methods

クラスApp \ Models \ Repository \ UserRepositoryには1つの抽象メソッドが含まれているため、抽象宣言するか、残りのメソッドを実装する必要があります

0

投稿者:通りすがりの人 / 投稿日:2018-03-07 14:07:04 / PV数:1936 / コメント数:1

sponsor

コメント 1

2018-03-07 14:20:19

通りすがりの人

Class App\Models\Repository\UserRepository contains 1 abstract method and must therefore be declared abstract or implement the remaining methods

リポジトリパターンを使っていて
インターフェースで

<?php

namespace App\Models\Interfaces;

interface UsersRepositoryInterface
{
    public function getDetail($id);
}

という宣言をしているにもかかわらず、リポジトリのほうにメソッドを書いてない時に発生。

    public function getDetail($id)
    {
        return  $this->object->find($id);
    }

リポジトリでメソッド書いたら解決。

コメント投稿