Making a create route - How to make a Laravel CRUD API Tutorial #3

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

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

  • @foroughsarrafzadeh276
    @foroughsarrafzadeh276 5 лет назад +3

    Best tutorials ever
    Thank you very much

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

      Thank you 😊 glad you like them

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

    Superb Explanation :) Great Tutorial, thank you so much for putting in so much time and effort.

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

      Thank you watching. I'm glad it helped. 😬

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

    well actually i don't use this Resource because:
    you can use this to make arrays from data, where
    the result:
    {
    "room": {
    "id": 4,
    "user_id": 4,
    "name": "Macedonia Palace",
    "city": "Thessaloniki",
    "area": "GEvGCHN2WMasd",
    "photo": "images/room-4.jpg",
    "room_type": "Single Room",
    "count_of_guests": 1,
    "price": 85,
    "location": "asdasdasdasdasd",
    "lat_location": 31.48,
    "lng_location": 93.27,
    "short_description": "C1askfYfChm3PHJl97c9nr7trcKR2rYzHEqliaPPIjCLzbd1nM",
    "long_description": "K1d8WD8U8G",
    "parking": "No",
    "wifi": "Yes",
    "pet_friendly": "No",
    "created_at": "2019-03-16 17:46:37",
    "updated_at": "2019-03-30 09:14:57"
    },
    "title": "Macedonia Palace"
    }
    return [
    'room' => $room,
    'title' => $room->name,
    ];

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

      There are many different ways to go about it, but a resource is quite well structured so it's just the way I like to work.

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

      You can shorten the array in the resource instead.
      The great thing about the resource, is you can make 1 resource and return it everywhere. For places like lists and cards where you won't use all the data, you can make a summarized resource.

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

    How could i removed specific KEY Values from data (Items) , for in your JSON example i want to remove "City" from your result than how could it possible ?

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

      If you’re using the same project as me. Simply remove it from the people api resource file we created.
      By the looks of your other comment you have a different project open so I’m not sure what the answer is.

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

      @@QuentinWatt I solved that issue by using
      protected $hidden = [
      'logo'
      ];
      in my model file.

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

    I am getting BLOB data in my result how can i change those data in base64, i got an error of UTF-8 character

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

      This wouldn’t be from my tutorial.
      If it’s stored in the database as a blob you can covert it with a helper function.

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

      @@QuentinWatt Hi , Thanks for fast reply and yes it's not in your tutorial but i follow your tutorial and fetch data from my database , in my DB i have username, dob & image (blob data) so i need your help to fetch those data. Your help highly Appreciated!

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

    hello thank u very much! i d like to ask one question, how to use string variables as a dynamic route instead of id? like instagram.com/username

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

      You can set a unique slug field in the database and use that as the route key with function getRouteKeyName()
      laravel.com/docs/8.x/routing#implicit-binding

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

    que laravel broda ?

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

    Thank you very much
    very useful

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

    can i get your social media contact?, i want to ask you something urgent, I am very troubled, and I will be very happy if you want to help me, Thank you for making this video before,

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

      There are social media links in the description of every video :)