Help us understand the problem. What is going on with this article?

laravel repositoryパターン 他のrepositoryを使いたいとき

class AAController extends BaseController
{

    protected $externalImageRepository;

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct(
        Request $request,
        ComicTrialRepositoryInterface $comicTrialRepository,
        ExternalImageRepositoryInterface $externalImageRepository,
  ここ->  StaffRepositoryInterface $staffRepositoryInterface
    ) {
        parent::__construct($request);

        $this->repository = $comicTrialRepository;
        $this->externalImageRepository = $externalImageRepository;
 ここ->  $this->staffRepository = $staffRepositoryInterface;
    }
.
.
.
.
.

public function index(Request $request <--いらない)
    {
        // $requestParams = $request->all(); //取得データ用のパラメータ
  ここ-> $requestParams = $this->request->all(); //取得データ用のパラメータ

        unset($requestParams['page']);
        $params = $requestParams; // viewに受け渡す用のパラメータ

        if (isset($requestParams['assigned_user_id']) && $requestParams['assigned_user_id'] == 'all') {
            unset($requestParams['assigned_user_id']);
        }

        if (isset($requestParams['q']) && $requestParams['q'] == null) {
            unset($requestParams['q']);
        }

//        $staffList = $this->repository->staffList()->pluck('name', 'id')->toArray();
ここ->     $staffList = $this->staffRepository->getStaffList()->where('group', 'comic')->pluck('name', 'id')->toArray();
//        dd($staffList);

        $comicTrialPager = $this->repository->getPager($requestParams);

        return view('comic_trial.index', compact('comicTrialPager', 'params', 'staffList'));
    }

・_construct() で Requestのセットしているので、ここで引数にしなくていい
・$this->repository->staffList()
comic
trial の関連テーブル以外の取得をComicTrialRepositoryを使わない。
StaffRepositoryを使う。

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away