Seeding fake data with a factory - How to make a Laravel CRUD API Tutorial #2

Поделиться
HTML-код
  • Опубликовано: 1 окт 2024

Комментарии • 29

  • @kphorce
    @kphorce 5 лет назад +4

    Good stuff 👍 bro. I'm getting back into laravel once more. While learning react. Love the tutorials

  • @joshinsoorajk3623
    @joshinsoorajk3623 4 года назад +3

    Your tutorials are so simple, very well explained. Thanks there.

  • @bikashsubedi9965
    @bikashsubedi9965 3 года назад

    guide me: 😉😉
    SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) (SQL: select * from `names` where `id` = 1 limit 1)

    • @QuentinWatt
      @QuentinWatt  3 года назад

      Looks like your database is either not running, or requires a password to be set in the .env file.

  • @jeps7688
    @jeps7688 4 года назад +1

    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.

    • @QuentinWatt
      @QuentinWatt  4 года назад

      nice! I use these for Vue apps. :)

  • @jamols09
    @jamols09 4 года назад

    Why does my Factory faker not work?

    • @QuentinWatt
      @QuentinWatt  4 года назад

      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.

  • @elliotmiller3187
    @elliotmiller3187 4 года назад

    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 ??

    • @QuentinWatt
      @QuentinWatt  4 года назад

      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.

  • @marouaneboutaleb6790
    @marouaneboutaleb6790 4 года назад

    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

    • @QuentinWatt
      @QuentinWatt  4 года назад +1

      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.

  • @karthickrajalearn
    @karthickrajalearn 5 лет назад +2

    Sir
    Vue Js
    Project

  • @pedrocajas478
    @pedrocajas478 5 лет назад

    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

    • @QuentinWatt
      @QuentinWatt  5 лет назад +1

      You can use Laravel passport to set up authentication

  • @AlKindi9
    @AlKindi9 5 лет назад

    I'm getting an "Unknown Formatter" error that seems to be linked to the faker/factory function. Any ideas?

    • @QuentinWatt
      @QuentinWatt  5 лет назад +1

      Get the code for free from my repo, linked in the description and compare to see where you went wrong.

    • @AlKindi9
      @AlKindi9 5 лет назад

      @@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.

  • @kainerda2088
    @kainerda2088 4 года назад

    I wonder how that would work with joined tables..

    • @QuentinWatt
      @QuentinWatt  4 года назад

      Very much the same way, using Laravel relationships

    • @QuentinWatt
      @QuentinWatt  4 года назад

      A different table is technically a different resource but you can simply tack on the 2nd table in the Resource file.

  • @jamols09
    @jamols09 4 года назад

    I get Unknown formatter "phone"

    • @QuentinWatt
      @QuentinWatt  4 года назад

      As per the documentation. It's phoneNumber
      Read more here.
      github.com/fzaninotto/Faker

  • @eangmonireach2492
    @eangmonireach2492 5 лет назад

    hello , my show function doesnt work

  • @hasanaliyev5231
    @hasanaliyev5231 4 года назад

    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

    • @QuentinWatt
      @QuentinWatt  4 года назад +1

      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.