Laravel API Crash Course For Beginners | Laravel API Crash Course | Laravel API Tutorial

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

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

  • @codewithdary
    @codewithdary  Год назад

    f you're looking to level up your Laravel skills? My new course "Mastering Laravel 10 Query Builder, Eloquent & Relationships" is the perfect opportunity: www.udemy.com/course/mastering-laravel-10-query-builder-eloquent-relationships/?referralCode=C784C3DB5B8925207FCB

  • @ajaypandey7249
    @ajaypandey7249 2 года назад +1

    This is the best video for Laravel Rest api with authentication, I have ever seen from 2018.

  • @gillesashley9314
    @gillesashley9314 2 года назад

    This is by far the best Laravel API tutorial i have ever come across.

  • @josejustinomatimbe4087
    @josejustinomatimbe4087 Год назад +1

    Excellent Laravel AP tutorialI. no comments!

  • @Laserdum
    @Laserdum 3 года назад +6

    This series has been great and was just what I was hoping for when I suggested an api course. I'm building a laravel api for my angular frontend school project right now, and I've learned a lot from your series, only big difference is that I chose to use Sanctum instead of Passport. I hope to see more videos from you Dary!

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

      Thank you man, appreciate the kind words dude! :)

  • @MahdiMahdavi-pr2sz
    @MahdiMahdavi-pr2sz 5 месяцев назад

    any watching this video in 2024? thanks dary for good content

  • @azmaermalik4374
    @azmaermalik4374 3 года назад +3

    Excellent Laravel AP tutorialI, should easily rank at the top of list. Thanks for such wonderfully explained and taught lessons.

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

      Thank you so much man. We will get there :)

  • @zainsmj843
    @zainsmj843 3 года назад +3

    Nice and helpful tutorial. One question "Passport (or) Sanctum". When to use what ??

    • @codewithdary
      @codewithdary  3 года назад +2

      Depends on the size of your applications. I recommend Sanctum for small apps because it's a bit simpler and easier to use.

  • @philpelzer
    @philpelzer 3 года назад +1

    NL: Bedankt voor alle tutorials, ze zijn erg leerzaam!
    EN: Many thanks for making all the tutorials, they are very educational!

    • @codewithdary
      @codewithdary  3 года назад +2

      Geen problem! Doe mijn best om je te helpen!

  • @tibelchior
    @tibelchior 3 года назад +2

    Great video, thanks for this.
    Just was a bit disturbed on how the Eloquent Relationships were done, please read again the documentation and you'll see that this is MUCH more simple now.

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

      What relationship are you talking about? Can you please add a timestamp so I can look into it? Anyways thanks for the feedback buddy! :D

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

      @@codewithdary Sorry, I forgot to point the location. It's from 1:37:15 on.
      This is done easier if you follow the documentation.

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

      Thank you for sharing. I'll have a look into it. I sometimes don't agree with the documentation and think that a old way might be better, but I got to say you are right on this one! :)

  • @ryan_roga
    @ryan_roga 2 года назад +2

    I don't know if anyone has pointed this out yet but at 5:56 or so, your "create" is not
    POST, but also GET. You even say "POST" but wrote GET on the chart. Thought I'd point that out - maybe you can patch it with one of those overlay messages, whatever they're called...

    • @codewithdary
      @codewithdary  2 года назад

      Yep :( and I regret it...
      That sounds like a solid solution tbh. Thank you

  • @mountinrose6722
    @mountinrose6722 2 года назад +1

    It's great tutorial and easy to understand. Thanks a lot ...

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

    Your this series is mind blowing 😉 looking for more tutorials ☺
    Thank you ❤

  • @joshuankrumah-buadu9341
    @joshuankrumah-buadu9341 2 года назад +1

    Thank you Dary, you are a life saver. 🥺. You teaching is really simple and easy to understand.

  • @Viveksharmaa
    @Viveksharmaa 3 года назад +2

    Amazing... A complete package
    Worth watching and A ton of thanks for your contribution.

    • @codewithdary
      @codewithdary  3 года назад +1

      So nice of you man :)

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

      @@codewithdary I literally type letter by letter with u.............Thanks

  • @rustymonzon
    @rustymonzon Год назад +1

    Hi, your tutorial are really helpful and easy to understand but I got a question. When sending a API Post do we need CSRF token and do you have a tutorial for that? thank you

    • @codewithdary
      @codewithdary  Год назад

      When using Laravel Passport, CSRF protection is not necessary for API routes because they are typically consumed by other applications rather than by a user's browser directly.

    • @rustymonzon
      @rustymonzon Год назад

      Hi @@codewithdary I'm using Laravel Sanctum from also your video tutorial. Thank you

  • @anjalichauhan3346
    @anjalichauhan3346 2 года назад +1

    Thankyou Dary.. Such a Awesome Course and i am your new subscriber./😊

    • @codewithdary
      @codewithdary  2 года назад

      Thank you Anjali, I won't disappoint you :)

  • @Xyz-pp6lu
    @Xyz-pp6lu 3 года назад +1

    Just want to ask. Whats the better way to call an api?
    1. View(request)->controller(call api)->api_controller(return response)->controller(return response)->view
    2. View(request)->api_controller(return response)->view
    My colleagues said 1, but I think if we'll use AJAX, 2 would be better? (Not sure tho)

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

      I like the first method. But I do wonder why you think ti's better for Ajax. Any reasoning for that? (just wondering)

  • @abdullahdaulatzai4500
    @abdullahdaulatzai4500 2 года назад +1

    Man, you nailed it. Bravo

  • @Excess-qn7qh
    @Excess-qn7qh 2 года назад

    hi and thank you for this cool video.
    after i do laravle new appname ... there war sanctiom already includet ... is this the new 'default' auth from laravel now ?

  • @bekkarghezal6173
    @bekkarghezal6173 3 года назад +1

    Thank you so much
    Honestly a great course, I hoped to learn how to use API via javascript and blade views

  • @anthonystephen
    @anthonystephen 2 года назад

    thanks a lot great work there....Well Done Bravo!!! How can a user signup and get the API Secret Token to have access to the API End-Point....Once again thanks a lot in your endeavors Dary

  • @msalih
    @msalih 3 года назад +1

    Thank you for good tutorial. Except the last chapter I understand well i think.

  • @henrylemmon6685
    @henrylemmon6685 3 года назад +2

    Great tutorial, it has me looking at JSON:API Standards. Will you be continuing on to a front end for this api?

    • @codewithdary
      @codewithdary  3 года назад +1

      Thank you! I haven't schedules anything for the frontend though but I like the idea, thanks! :)

  • @szymonpszczoka3284
    @szymonpszczoka3284 2 года назад +2

    Good Crash Course - Thanks
    But You didn't show how to send custom response if show method fails. For example if i want to get book with id 9999 :D

    • @codewithdary
      @codewithdary  2 года назад +1

      Thank you! :) Haha yeah there are obivously 28498393 things that you could add, but had to draw the line somewhere!

    • @szymonpszczoka3284
      @szymonpszczoka3284 2 года назад

      @@codewithdary thanks for Your work

  • @LeonelLopezBorbon
    @LeonelLopezBorbon 2 года назад +2

    First time I learn a lot how build API thank you!! In my case I use Laravel 9 it is a bit different than Laravel 8 by Sanctum so I disabled this api to use with Passport. But overall amazing!!

    • @codewithdary
      @codewithdary  2 года назад

      You can obviously still use Passport though. The idea behind Passport and Sanctum is the same but they are both used for different type of projects!

    • @LeonelLopezBorbon
      @LeonelLopezBorbon 2 года назад

      @@codewithdary right

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

    Thank you for the tutorial simple and straight like the laravel course wish you the best

  • @danasugu1767
    @danasugu1767 3 года назад +1

    Hi, Dary! Awesome video tutorial. I just learned about The Thunder Client extension for VS Code, Rest Client for Testing APIs.

    • @codewithdary
      @codewithdary  3 года назад +1

      Good to hear that Dana. Do you like the extension?

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

      @@codewithdary I like it but I also like Postman.

    • @codewithdary
      @codewithdary  3 года назад +1

      Yeah I feel you. I used to work with the Chrome extension which I also really liked to use.

    • @codewithdary
      @codewithdary  3 года назад +1

      It's called Advanced Rest Client for Chrome: chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo

  • @zeeshansuleman93
    @zeeshansuleman93 2 года назад +1

    How would the model and controller behave if there is no author with the provided id? I think error handling should be explained in this video

    • @codewithdary
      @codewithdary  2 года назад

      Api isn't necessarily a beginners topic, like I have mentioned in the beginning.
      In the beginners course, you will find out that the same exact issue you mentioned will be solves inside the migration ->cascade('delete');
      Sorry if something was unclear, but I obviously can't keep explaining these things.

  • @kevinwakhisi7001
    @kevinwakhisi7001 2 года назад

    Information here is mind blowing

  • @msalih
    @msalih 3 года назад +2

    1:02:00
    if you get AuthorsController not found error, add the target of controller and change the class name inside the controller also. In video Dary changes only the class name and I guess IDE makes changes automatically.

    • @codewithdary
      @codewithdary  3 года назад +1

      Yes I'm using the PHP Intelephense extension that will handle that for me :)

    • @gunjanbasnet9458
      @gunjanbasnet9458 2 года назад

      I am having the same issue. Can you explain how you solved it?

    • @gunjanbasnet9458
      @gunjanbasnet9458 2 года назад

      Nevermind. We have to add path to the Authorscontroller.php file in api.php file

  • @asutoshroy9665
    @asutoshroy9665 3 года назад +1

    Absoulately fantastic , thanks a lot sir

  • @oanacristea2572
    @oanacristea2572 2 года назад

    I really like your courses and the way you explain what are you doing. Just a small feedback which, IMO would help you create even better content: You could also explain 'why things work this way' . For instance, the api route has a prefix of api - I would have liked to see a reference to the route service provider with the 'api' prefix to the route. Thank you for your effort!

    • @codewithdary
      @codewithdary  2 года назад +1

      Hi Oana. Thank you for your nice words and also another big thank you for providing me feedback! :)

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

    Started watching hope it will be good will update comment later after watching. Thanks 😇

  • @fleckenfurz77
    @fleckenfurz77 2 года назад

    Hi Dary! Thx for the tutorial!
    little correction: i think you mean POST as Reqest and Http Verb at 6:30min

    • @codewithdary
      @codewithdary  2 года назад

      I messed up there :(
      Thank you anyways.

    • @fleckenfurz77
      @fleckenfurz77 2 года назад +1

      @@codewithdary now i feel sorry, that i mentioned it. Don't be too hard on yourself!
      This is just a small mistake in the middle of an overall perfect tutorial. ;)

    • @codewithdary
      @codewithdary  2 года назад +2

      @@fleckenfurz77 no worries about it. Don’t mind if people do, makes me realize that tons of people are watching and I got to be more careful with the content I bring out! Can’t make small mistakes like these! Thank you anyways

  • @SalarPro
    @SalarPro 2 года назад +1

    What a great explanation

    • @codewithdary
      @codewithdary  2 года назад

      Thank you so much Salar, keep on going!

  • @kenanaghayev8981
    @kenanaghayev8981 2 года назад +1

    Thank you Dary

    • @codewithdary
      @codewithdary  2 года назад +1

      Thank you for watching Kenan :)

  • @dhiyaahadan1191
    @dhiyaahadan1191 2 года назад

    The Laravel Passport is necessary or optional?

  • @riahiyassine7703
    @riahiyassine7703 3 года назад +1

    Thank you dary for the best ever explain

  • @mahekarim4821
    @mahekarim4821 2 года назад

    Hi @CodeWithDary , I appreciate your work but there is an error in last couple of minutes. BookAuthor table . When you see single book other data from book_author data change automatically.

  • @mobytoby777
    @mobytoby777 3 года назад +1

    I love your videos! Will you be creating a series with laravel and graphQL?

    • @codewithdary
      @codewithdary  3 года назад +1

      Hmm that sounds interesting! Thank you for sharing

  • @ebonyandruth
    @ebonyandruth 3 года назад +1

    Great tutorial Dary.

    • @codewithdary
      @codewithdary  3 года назад +1

      Brother Ebony thank you man! :)

  • @jamesmbatia1834
    @jamesmbatia1834 3 года назад +1

    perfect crash course

  • @isaacnicholaus4361
    @isaacnicholaus4361 3 года назад +1

    This tutorial is amazing, thank you.

  • @mouradeljayi584
    @mouradeljayi584 3 года назад +5

    Thank you Dary , Your Courses are awesome.. We will be waiting for more especially on Laravel and Vue js !
    I hope you'll create some Full stack projects too ..
    Thank you again 🙏

  • @yousefrefahi8770
    @yousefrefahi8770 Год назад +1

    hi
    in laravel 9 i dont have to make changes in provider file and config right? because i provider file when i write passport::routes() show me error wnd when i delete it it works

    • @codewithdary
      @codewithdary  Год назад

      Not anymore I think. It has been change since this video was for Laravel 8. I have creaed a Short about it which might help you: ruclips.net/user/shortsFI8mxv14v-k

    • @yousefrefahi8770
      @yousefrefahi8770 Год назад

      @@codewithdary thank you very much

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

    Thank you Dary , Your Courses are awesome!!!

  • @adsboonyadol
    @adsboonyadol 3 года назад +1

    how difference with Lumen Laravel ?

  • @CHSKnight
    @CHSKnight 3 года назад +1

    Thank you bro.

  • @nightchiller
    @nightchiller 2 года назад +1

    At 1:42:05 you don't care about the id being a string like you did in the resources. As the authors are not going through the AuthorResource, how can I modify the ids to be strings as well?

    • @codewithdary
      @codewithdary  2 года назад

      Copies from the JSON documentation: Every resource object MUST contain an id member and a type member. The values of the id and type members MUST be strings.

    • @nightchiller
      @nightchiller 2 года назад

      @@codewithdary So, you would you not do it?

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

    Amazing video. Thanks bro!!!
    Do you plan creating vídeos teaching how to use Vue/NuxtJS and an SPA and GraphQL with Lighthouse (laravel)?

  • @BeatBustersDance
    @BeatBustersDance 3 года назад +1

    How you are getting the data in show method without invoking Database, TIME: 1hr.05min. I am not getting that

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

    Thank you Dary, awesome

  • @zuwei8490
    @zuwei8490 3 года назад +1

    1:08:49 , the json value must be string? but I remember the value can be number, string, boolean. I'm wrong?

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

      Yes it definitely can be. I think that a resource is represented in our document as a resource object that must contain an id and type member, both with a string datatype.

  • @TrikNgonlen
    @TrikNgonlen 3 года назад +2

    awesome!

  • @ДаниялКожакметов-и9ф

    Thank u so much! Can you share source code???

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

    Could you do a video showing how to apply fetch api in laravel?

  • @msalih
    @msalih 3 года назад +1

    Get stuck here, 1:14:10
    I am getting "message": "This action is unauthorized.", error. Really don't know why.
    GET method works but POST doesn't work.
    Solution: Request type changed to StoreAuthorRequest in my version. I return to Request and it worked.
    Thanks.

    • @jasonb202020
      @jasonb202020 2 года назад +5

      Had the same problem, my solution was to change the app/Http/Requests/StoreAuthorRequest/authorize() return value to true

    • @yanmyoe
      @yanmyoe 2 года назад

      @@jasonb202020 It's work on me! Thanks! :)

    • @abdullahdaulatzai4500
      @abdullahdaulatzai4500 2 года назад +1

      @@jasonb202020 Thanks Man

    • @shengjieyang1301
      @shengjieyang1301 2 года назад

      @@jasonb202020 POST works now, but PUT still throws 'This action is unauthorized', any solution for this problem?

  • @aqua_care_app
    @aqua_care_app 2 года назад +2

    Спасибо большое

    • @codewithdary
      @codewithdary  2 года назад

      Thank you for watching Ibrohim :)

  • @musiclovers8488
    @musiclovers8488 2 года назад +1

    hello sir can you tell me pls how can i connect mysql database to xampp in macbook i am new user of macbook pls tell me step by step it will be huge help for me thanksyou so much

    • @codewithdary
      @codewithdary  2 года назад

      Hi! This article should help you out: www.kaanburaksener.com/blog/installing-laravel-on-mac-os-x-with-xampp/

  • @gunjanbasnet9458
    @gunjanbasnet9458 2 года назад +1

    Thank you for all of your effort. God Bless you @code with dary

    • @codewithdary
      @codewithdary  2 года назад

      Thank you Gunjan, we keep going!!

  • @FactShower
    @FactShower 3 года назад +1

    I am getting a message of "unathenticated" in a GET request after puttng KEY= Authorization and VALUE = Bearer accessToken

    • @FactShower
      @FactShower 3 года назад +1

      oh sorry, my bad! There was auth:santum instead of auth:api in the Route, on the file named api.php

    • @codewithdary
      @codewithdary  3 года назад +1

      Haha! I've been there buddy!

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

      @@codewithdary Thanks for all the effort you made by making such informative videos. I am growing with you. Thank you once again :)

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

    Great..

  • @osegocodes
    @osegocodes Год назад +1

    At 6:18 the create verb should be Post. A little correction

    • @codewithdary
      @codewithdary  Год назад

      Biggest mistake in all my tutorials :(

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

    May God bless you son

  • @asmedeus448
    @asmedeus448 2 года назад

    at 48:39 I get this error:
    {
    "error": "invalid_client",
    "error_description": "Client authentication failed",
    "message": "Client authentication failed"
    }
    401: Unauthorized
    My laravel version 8.76.0
    is there way to fix it?

    • @codewithdary
      @codewithdary  2 года назад

      Looks like you have missed the publishing of the keys from passport config php artisan vendor:publish --tag=passport-config.

    • @asmedeus448
      @asmedeus448 2 года назад

      @@codewithdary It still not working after I use php artisan vendor:publish --tag=passport-config

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

    Hello nice video, but I keep getting an error when I try to get the Oauth/token endpoint via postman .
    I get it was not possible to parse your key, reason. Please help

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

    How to make a Website and API REST with the same Controllers? It is possible I'm totally confused, and how to create both are same Controllers, plz help

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

      I don't understand your question, sorry...

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

      @@codewithdary I think he's trying to ask if you could make a tutorial on building a frontend design using Laravel to fetch API

  • @krishnanarasimha1243
    @krishnanarasimha1243 2 года назад

    at 1:14:10 , I try to call the api using the post method, But getting the 404, How you used the Request parameter in Update() AuthorsController.php( public function update(UpdateAuthorRequest $request, Author $author))

  • @sargisgrigoryan254
    @sargisgrigoryan254 2 года назад +1

    ruclips.net/video/xvqPEEpRBJ4/видео.html This api authorization is returning 401 status code and {"message":"Unauthenticated."} for Laravel 9.x version is there any changes made?

    • @codewithdary
      @codewithdary  2 года назад

      You should compare it with the official documentation: laravel.com/docs/9.x/passport

  • @codewithdary
    @codewithdary  2 года назад

    LETS CONNECT THROUGH INSTAGRAM.
    instagram.com/codewithdary

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

    yesss

    • @codewithdary
      @codewithdary  3 года назад +1

      Let's go Mourad!

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

      @@codewithdary please continue this tutorial with upload files and user avatar .. roles and permissions.

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

    when speaking English, you should be able to speak a "th" correctly - besides that: thanks for these videos!

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

      It's very easy to bash something that doesn't have English as his first speaking language though. Your basically saying that if you make spelling or pronunciation mistakes, you shouldn't be talking English? Interesting...

  • @cristianbetsayda2985
    @cristianbetsayda2985 2 года назад

    not beginner friendly

    • @codewithdary
      @codewithdary  2 года назад

      It’s obviously not the basic Laravel topics since that’s what you need to learn before moving to Laravel API.

  • @prantosuwarno2733
    @prantosuwarno2733 2 года назад +2

    thank you so much dary

  • @SHADAN.__.KHAN077
    @SHADAN.__.KHAN077 2 года назад +1

    Thank you. 👍