Support the ongoing development of →
Eloquent Database
Last updated 2 weeks ago.

Can you explain how it fails? The first impression is that this looks good.


Thank you for your reply I submit these screen-shots to show you

my question is App\Dog::all(); // all() function is build-in // not needed declare???



moderator Solution

Thanks for the screenshots, they made it clear.

You can use Dog::all(); (because you have the use statement) or \App\Dog:all();

Your controller lives in the App\Http\Controllers namespace with App\Dog(); it search for the class App\Http\Controllers\App\Dog and that class doesn't exist. That is because of the missing \ in front of it.


Thank you - now working 1st way $dogs = \App\Dog::all();

    foreach ($dogs as $dog) {
        echo $dog->name;

2nd way $dogs = Dog::all(); // use \App\Dog; // on top


http://homestead.test/dog GET // THIS GET ok get the result

http://homestead.test/dog POST // THIS GET : // ERROR IN POSTMAN App cannot call function: store in controller

any hint to try???

<body> <div class="flex-center position-ref full-height"> <div class="code"> 419 </div>
	<div class="message" style="padding: 10px;">
		Page Expired </div>
</body> </html> | | GET|HEAD | dog | dog.index | App\Http\Controllers\[email protected] | web | | | POST | dog | | App\Http\Controllers\[email protected] | web | | | GET|HEAD | dog/create | dog.create | App\Http\Controllers\[email protected] | web |

Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 - All rights reserved.