Object of class App\\Repository\\UserRepository could not be converted to string

Posted 1 week ago by ken4ward

I am presently using the repository but kept getting the error

UserRepository class

        $users = User::all();
        return $users;

Object of class App\Repository\UserRepository could not be converted to string.

THis is the controller class
```public function show()
        $user = $this->$userRepository->getAll();
        $response = $this->response->item($user, new UserTransformer());

Kindly help.

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.