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???
SCREENSHOT-1: https://yadi.sk/i/YdMOwZ-b0NX_8Q
SCREENSHOT-2: https://yadi.sk/i/Rd90g7yrm1WP-w
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>
</div>
</body>
</html>
| | GET|HEAD | dog | dog.index | App\Http\Controllers\DogController@index | web |
| | POST | dog | dog.store | App\Http\Controllers\DogController@store | web |
| | GET|HEAD | dog/create | dog.create | App\Http\Controllers\DogController@create | web |
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community