This question is way too general for me to answer, but as per your previous comment. You may need to read through the documentation as you are probably using it wrong.
Hi Dear, I have a question: when you specify the route '/person/{person}' and then pass the id in the postmaster, why the callback function in the controller receives person objects instead of ID ?? if the model is doing this by itself, where are we directing it to do so ??
Because we used a type hint of Person in the controller's method and Laravel is smart enough to recognise the ID and fetch the whole model from the database. Without the type hint in the controller, the ID would simply be a number.
when you put :"php artisan make:model Person -mf" it create a table named "people" i was expecting a "person table".there is an explanation for this? thanks
The table should be plural. This is standard laravel practice and it's actually built into the framework. A user model refers to one user in a table full of users. A person model refers to one person in a table full of people. It's always plural in the collection.
@@QuentinWatt Thanks buddy! I actually wasn't aware that faker was a library and that you had to use those specific names from the library. Figured it out though. Great tutorial. If I get this job, you'll have some part in it haha Laravel is my new favorite framework for making Restful APIs.
Good stuff 👍 bro. I'm getting back into laravel once more. While learning react. Love the tutorials
Your tutorials are so simple, very well explained. Thanks there.
Thank you very much :)
guide me: 😉😉
SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) (SQL: select * from `names` where `id` = 1 limit 1)
Looks like your database is either not running, or requires a password to be set in the .env file.
finally i found the perfect lesson I was looking for. im only looking on how to create and setup an api for my react app.
nice! I use these for Vue apps. :)
Why does my Factory faker not work?
This question is way too general for me to answer, but as per your previous comment. You may need to read through the documentation as you are probably using it wrong.
Hi Dear, I have a question: when you specify the route '/person/{person}' and then pass the id in the postmaster, why the callback function in the controller receives person objects instead of ID ?? if the model is doing this by itself, where are we directing it to do so ??
Because we used a type hint of Person in the controller's method and Laravel is smart enough to recognise the ID and fetch the whole model from the database.
Without the type hint in the controller, the ID would simply be a number.
when you put :"php artisan make:model Person -mf" it create a table named "people" i was expecting a "person table".there is an explanation for this? thanks
The table should be plural. This is standard laravel practice and it's actually built into the framework.
A user model refers to one user in a table full of users.
A person model refers to one person in a table full of people.
It's always plural in the collection.
Sir
Vue Js
Project
Patience my Padawan!
hey! i got a question. If i want to secure my api, what should i do? i mean, using tokens whenever i send a get or post petition
You can use Laravel passport to set up authentication
I'm getting an "Unknown Formatter" error that seems to be linked to the faker/factory function. Any ideas?
Get the code for free from my repo, linked in the description and compare to see where you went wrong.
@@QuentinWatt Thanks buddy! I actually wasn't aware that faker was a library and that you had to use those specific names from the library. Figured it out though. Great tutorial. If I get this job, you'll have some part in it haha Laravel is my new favorite framework for making Restful APIs.
I wonder how that would work with joined tables..
Very much the same way, using Laravel relationships
A different table is technically a different resource but you can simply tack on the 2nd table in the Resource file.
I get Unknown formatter "phone"
As per the documentation. It's phoneNumber
Read more here.
github.com/fzaninotto/Faker
hello , my show function doesnt work
Did you fix it?
please don't swallow your saliva so loud next time, it is very annoying. I don't know why some people on youtube have such a saliva fetish
Mouth sounds are a very normal part of audio recordings and happen all the time in live talks on stage too. Maybe learn to deal with your phobia.