Laravel API Crash Course With Sanctum | Laravel Sanctum Full Tutorial | How to Build Laravel API

  Рет қаралды 89,183

Code With Dary

Code With Dary

Күн бұрын

Пікірлер: 315
@codewithdary
@codewithdary Жыл бұрын
If 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
@devopsdevelopoptions409
@devopsdevelopoptions409 21 күн бұрын
and i want to say that the video was perfect for me as a beginner in apis
@AstreonOfficial
@AstreonOfficial Жыл бұрын
When declaring resource routes that will be consumed by APIs, you will commonly want to exclude routes that present HTML templates such as create and edit. For convenience, you may use the apiResource method to automatically exclude these two routes. Like this: Route::apiResource('tasks', TasksController::class);
@codewithdary
@codewithdary Жыл бұрын
Wait I didn’t do that in this tutorial! I’m ashamed! you are completely right.
@tacanda6479
@tacanda6479 Жыл бұрын
Your tutorials are way more transparent than the videos on Laracast
@codewithdary
@codewithdary Жыл бұрын
Thank you so much. Laracasts is incredible too :D
@adeoluayobami6810
@adeoluayobami6810 Жыл бұрын
I wanted to also say this
@soliuabdulkadir4488
@soliuabdulkadir4488 Жыл бұрын
Pls I am stuck while following the tutorial. I couldn't get the tinker to create the Tasks as it is returning "Error Class Task not found"
@nigmadude
@nigmadude 5 ай бұрын
@@soliuabdulkadir4488 just specify the path of your Task class , like \App\Models\Task
@naiveneger39
@naiveneger39 2 ай бұрын
​@@codewithdary hello for the tasks how can we show tasks belonging only to logged in user
@sv2109
@sv2109 Жыл бұрын
Man, you have a real talent for explaining complex topics so that they seem very simple
@codewithdary
@codewithdary Жыл бұрын
Thank you so much, Volodymyr!
@joshmakar9161
@joshmakar9161 7 ай бұрын
This crash course not only explained the basics of using Sanctum but also included a ton of valuable information about configuring APIs, using ResourceControllers, implementing custom requests, and so much more. Very well done!
@codewithdary
@codewithdary 7 ай бұрын
Thank you so much, I appreciate your kind words Josh!
@meetwithchuks8861
@meetwithchuks8861 2 жыл бұрын
I love your tutorials; clear and in-depth. This is the latest and the best. Many thanks.
@codewithdary
@codewithdary Жыл бұрын
Thank you so much Chuks!
@jackreacher8632
@jackreacher8632 3 ай бұрын
Before I even finish this video let me say that your are an amazing professor. That tutorial is so fluent , explaining patiently concepts I was hardly trying to understand. Thank you very much from Burkina Faso.
@cryswerton-silva
@cryswerton-silva Жыл бұрын
Best video on Laravel Sanctum ever!!
@codewithdary
@codewithdary Жыл бұрын
Wow, thank you
@AbderrahmanFodili
@AbderrahmanFodili Жыл бұрын
you are a lifesavour . I loved you content when I was still learning a year ago and I am even more thankful that you posted this video now that I got a job and I am asked to make an API. your methods are light years ahead of my put together garbage API . thank you good sir
@codewithdary
@codewithdary Жыл бұрын
Thank you so much Abderraham! Tried my best making it easy for you. I've also got a video where I create a property listing API, might be useful for you too :)
@MrWorkman2010
@MrWorkman2010 2 ай бұрын
What!! I have successfully gone through this entire tutorial. Was very helpful.
@knockedbull7087
@knockedbull7087 Жыл бұрын
Very well explained with details, common mistakes and coding things step by step so we are not saturated. One of the best teacher i've watched so far. Thanks a lot for this tutorial
@codewithdary
@codewithdary Жыл бұрын
Wow, your comment just made my day. Thank you so much :)
@madie2659
@madie2659 Жыл бұрын
Best Laravel video with great explanations I have seen on KZbin.. Thank you sooo much for this video
@sb-dor
@sb-dor 11 ай бұрын
thank you so much man, I've been working as a full-stack developer for a long time, and i didn't know some of that stuffs in laravel. push forward bro. greate video!
@codewithdary
@codewithdary 11 ай бұрын
Wow, I'm happy that I could help!!
@codewithdary
@codewithdary Жыл бұрын
YOU CAN FIND ME ON TWO NEW PLATFORMS. 🔥TikTok: www.tiktok.com/@codewithdary 🔥Blog: blog.codewithdary.com/ AND ON 🔥Instagram: instagram.com/codewithdary/ 🔥Twitter: twitter.com/codewithdary
@LuiBorosu
@LuiBorosu Жыл бұрын
If there is anything that i want to complain about in this tutorial, you need to show us every namespace that you used inside your controller. not all of us who are trying to learn laravel knows how to automatically add them whenever you used a class that isnt inside of the controller originally. It confused the heck out of me. 6/10. man do what i just said and it will be instant 9/10. cuz its such bummer to suddenly getting an error when i literally do everything you did step by step.
@codewithdary
@codewithdary Жыл бұрын
Namespaces are something you should learn in PHP, and not so much in Laravel. Let alone starting with Laravel Sanctum, which you shouldn't learn if you have no idea how namespaces work. I understand your concern, but I can't explain every single step over and over again, overwise people will start complaining about me repeating myself :) A part of being a developer is also making decisions on your own. You shouldn't just follow the tutor and expect to be a developer after a certain amount of hours.
@user-pv8jn9cz4l
@user-pv8jn9cz4l Жыл бұрын
Hi Dary, very good video. Just one small suggestion: pause for a second or two before you switch screen or program, so that your viewers get a chance to pause. Also, there is a small problem with the cli when the screen is paused, as YT's control overlaps on the last line, which happens to be what you are typing. So maybe using a ssh client to connect locally?
@codewithdary
@codewithdary Жыл бұрын
Thank you for the feedback, it is truly appreciated! I will definitely implement your feedback.
@zoltanfodor1605
@zoltanfodor1605 6 ай бұрын
It was a good-quality video. Thanks a lot, Dary!
@codewithdary
@codewithdary 5 ай бұрын
Glad you liked it, Zoltan!
@edi_gun_awan
@edi_gun_awan 6 ай бұрын
Thank you. I retired from JS framework hell from now on.
@codewithdary
@codewithdary 5 ай бұрын
I feel you! Haha :)
@mohammadhosseinmoradi2021
@mohammadhosseinmoradi2021 Жыл бұрын
It was very very useful. Thanks a lot to Mr. dary ❤for creating tutorial contents. Your tutorials are the best! I'm from iran country. I like next tutorial was be about the role based API and custom middleware. I look forward to your next tutorials.
@codewithdary
@codewithdary Жыл бұрын
Thank you so much Mohammad, I try to do my best for you :)
@EddieMao
@EddieMao 8 ай бұрын
Wow, wonderful tutorial, Dary. Thank you so much.
@codewithdary
@codewithdary 8 ай бұрын
Happy to help! :)
@HarshSharma-xp7uf
@HarshSharma-xp7uf Жыл бұрын
Fantastic Tutorial Dary. I am a newbie to laravel and your videos are just fantastic. Thank you
@codewithdary
@codewithdary Жыл бұрын
Thank you so much Harsh, truly appreciate your kind words.
@belaouraabdelwahab
@belaouraabdelwahab 2 жыл бұрын
Awesome video thanks 👍 Please add more videos about API other methods like email confirmation, password reset, OTP confirmation for mobile .... Thanks again for the tutorial
@codewithdary
@codewithdary 2 жыл бұрын
Sounds interesting! But the code will pretty much be the same as I’ve build in my other tutorials!
@XFX0629
@XFX0629 Жыл бұрын
Amazing tutorial. Extremely clear and useful. Thanks a lot!
@codewithdary
@codewithdary Жыл бұрын
Glad you enjoyed it!
@kavehsarkhanlou8608
@kavehsarkhanlou8608 Жыл бұрын
You are wrapping your credentials array in an extra array. Remove the extra array wrap in line 21 at 37:58
@nishaladhin7357
@nishaladhin7357 Жыл бұрын
This actually solved my error! Thanks!
@cjlacaste28
@cjlacaste28 Жыл бұрын
thank you.
@PacificDev
@PacificDev Жыл бұрын
Great video! Thanks 👊 When validating a form request you actually don't need to call request->all() inside the validated() method. It doesn't need it. The validated method returns an array with the validated fields.
@codewithdary
@codewithdary Жыл бұрын
That is correct! Don't know why I did that....
@afolabiabiodun7582
@afolabiabiodun7582 9 ай бұрын
You're too good. You made it easy
@codewithdary
@codewithdary 9 ай бұрын
Awesome
@charbel12334
@charbel12334 11 ай бұрын
getting a jumpscare with the start of each section😂. Very useful tutorial! Can you please make the frontend of this application with react js
@codewithdary
@codewithdary 11 ай бұрын
I have to keep my students awake you know :)
@feedgaming8374
@feedgaming8374 7 ай бұрын
tysm, you are so good at explaining subjects like this, appreciate your efforts,
@codewithdary
@codewithdary 6 ай бұрын
You're very welcome!
@gp6723
@gp6723 6 ай бұрын
Great one!
@codewithdary
@codewithdary 5 ай бұрын
Thank you so much :)
@ThaRealIansanity
@ThaRealIansanity Жыл бұрын
Small mistake in LoginUserRequest ? I think you referred to the 'email' rule as meaning it comes from the 'email' column. Actually validates that it is a properly formed email address. Also what is the need for 'string' rule if we are making sure it is a valid email? And for the password, Password::default() used in the register request rules has min:8 by default where we used min:6 in our login request. I just used Password::default() in both requests to make sure the rules match. Otherwise excellent course so far. I'm learning a lot and looking forward to moving to your authentication videos next
@codewithdary
@codewithdary Жыл бұрын
Thank you Ian! I'm here to learn too ;)
@n3volja
@n3volja Жыл бұрын
I loved this! Thank you for making this.
@codewithdary
@codewithdary Жыл бұрын
Thank you for your kind words!!
@mohamedadel936
@mohamedadel936 Жыл бұрын
Thank you Dary 😍 I learned a lot from this video ❤
@codewithdary
@codewithdary Жыл бұрын
I'm so happy that you dod Mohamed! :)
@md.ruhulamin7963
@md.ruhulamin7963 Жыл бұрын
Thank you sir, this is very clear, simple and informative. One request, would you please add how to handle image in API. Thank you.
@codewithdary
@codewithdary Жыл бұрын
Thank you for watching Ruhul. It needs to happen in the same way as "not with APIs"!
@josephofodum7895
@josephofodum7895 Ай бұрын
This is my first video on laravel and it is very enlightening.
@onesentientbeing6311
@onesentientbeing6311 Жыл бұрын
"You don't need to dream about Laravel at night" - CWD. Good one🤣👍.
@codewithdary
@codewithdary Жыл бұрын
Right? 😂
@felixowino3271
@felixowino3271 Жыл бұрын
I get an error message in the postman SQLSTATE [42S22] column not found when i test login with a user who is not in the database, what could be the issue?
@ChBoss-fc2yj
@ChBoss-fc2yj Жыл бұрын
Hay Felix, try "if(!Auth::attempt($request->only('email','password'))) {" instead of "if(!Auth::attempt([$request->only('email','password')])) {"
@ThaRealIansanity
@ThaRealIansanity Жыл бұрын
@@ChBoss-fc2yj Thanks I'm always forgetting you can hover or ctrl+click on functions to see their definitions. It already returns an array 🙂
@mudso
@mudso Жыл бұрын
@@ChBoss-fc2yj GREAT THANKS! you saved my day, is that square bracket a laravel 9 or 10 thing?
@kimelironald4451
@kimelironald4451 Жыл бұрын
Good staff,,,You are really doing something Amazing. API is my favorite. Make a simple mysql cli tutorial, very short is enough
@codewithdary
@codewithdary Жыл бұрын
Thank you Kimeli! Not sure if I be doing that any time soon.
@kimelironald4451
@kimelironald4451 Жыл бұрын
@@codewithdary No worry.Thanks
@wikichua3577
@wikichua3577 2 жыл бұрын
i love all your tutorials. hope to learn more from your up coming tutorial, appreciated if there is laravel livewire and alpinejs tutorial.
@codewithdary
@codewithdary Жыл бұрын
Great suggestion!
@LeonelLopezBorbon
@LeonelLopezBorbon Жыл бұрын
That's magnific your tutorial more clear understand! Thank very much! TOP!
@codewithdary
@codewithdary Жыл бұрын
Glad it helped Leonel!
@arash5094
@arash5094 Жыл бұрын
i like you tutorials
@codewithdary
@codewithdary Жыл бұрын
Thank you so much, Arash
@abrhamb2952
@abrhamb2952 Жыл бұрын
Best Course on Sanctum Thanks a lot , Do you have Laravel Fortify Course ?
@codewithdary
@codewithdary Жыл бұрын
Thank you so much Abrham! I unfortunately don't :(
@luisuran4050
@luisuran4050 Жыл бұрын
Something that bothers me is that on the update method you are giving the user the chance to update any field. I would instead do "$task->update($request->only(['name', 'description', 'priority']));"
@codewithdary
@codewithdary Жыл бұрын
I'm happy you saw that. Honestly don't really have a reason why I used it inside the AuthController and not inside of the TasksController. Just a mistake on my part.
@Muhammed-nani964
@Muhammed-nani964 Жыл бұрын
Noice video Dary we need more videos about auth with api for SPA front-end, and I have a question about authentication for a project. I'm confused about whether to use cookie or token-based API authentication. Which one do you suggest and which one is more secure? especially for SPA front-end
@codewithdary
@codewithdary Жыл бұрын
Hi Muhammed! It's difficult to judge without knowing the project's background. However, token-based authentication is useful for storing data on the client-side, while cookie-based authentication is suitable for storing less secure data, as cookies can be vulnerable.
@ahmedsabri6275
@ahmedsabri6275 9 ай бұрын
this was so amazing and helpful thanks for this tutorial
@codewithdary
@codewithdary 9 ай бұрын
Thank you so much Ahmed!
@mahamedassoul6960
@mahamedassoul6960 Жыл бұрын
your tutorial was very very helpful, thank you so much 👏
@codewithdary
@codewithdary Жыл бұрын
Thank you for watching Mahamed!
@jjplays404
@jjplays404 2 жыл бұрын
Awesome dude, for covering advance topic😁😁
@codewithdary
@codewithdary 2 жыл бұрын
Thank you so much :)
@user-nb7nb1hh1j
@user-nb7nb1hh1j 12 күн бұрын
Good stuff 👍
@miyirbek6821
@miyirbek6821 Жыл бұрын
Thanks a lot bro. You helped me so much
@codewithdary
@codewithdary Жыл бұрын
I'm happy that I could help!
@mr_farukhaleem
@mr_farukhaleem 10 ай бұрын
Thank you @codewithdary . Your video tutorial is very helpful and easy to learn. Which packages or feature of a Laravel should we learn more to make a complete app for backend API. like like for sending emails, que jobs, uploading files..
@codewithdary
@codewithdary 10 ай бұрын
You shouldn't really learn packages, because they usually have good docs. You need to level up your Laravel skills to learn APIs!
@robinncode
@robinncode Жыл бұрын
Thank you very much. Your Tutorial was very clear and easy to learn. You are awesome!!!
@codewithdary
@codewithdary Жыл бұрын
Thank you so much for your kind words, it's truly appreciated!
@SR-hp4tp
@SR-hp4tp 7 ай бұрын
Amazing tutorial !
@codewithdary
@codewithdary 7 ай бұрын
Thank you!
@ulaskorpe
@ulaskorpe 6 ай бұрын
thank you for this tutorial
@codewithdary
@codewithdary 5 ай бұрын
You're welcome 😊
@chrisngkaixing320
@chrisngkaixing320 Жыл бұрын
Nice video! Thank you for your great content, it's clear and easy to understand.
@codewithdary
@codewithdary Жыл бұрын
Thank you Chris! Hoped it help you out :)
@7Janiel
@7Janiel 5 ай бұрын
Very good tutorial sir
@kh1amirhamza
@kh1amirhamza Жыл бұрын
Wonderful Tutorial!
@codewithdary
@codewithdary Жыл бұрын
Thank you! Cheers!
@w155uu
@w155uu Жыл бұрын
hope you complete this tutorial by adding an extra section about token abilities and authorization. thanks
@codewithdary
@codewithdary Жыл бұрын
The tutorial is very complete, what you want is additions :)
@hichamelbachari2655
@hichamelbachari2655 Жыл бұрын
what an amazing video!
@codewithdary
@codewithdary Жыл бұрын
Thank you so much!
@chinazamekperechimbo1980
@chinazamekperechimbo1980 Жыл бұрын
This tutorial is the best I have ever seen for laravel API. I was wondering, what visual studio code extension do you use to automatically pull in newly created controllers to the route file
@codewithdary
@codewithdary Жыл бұрын
Thank you so much. kzbin.info/www/bejne/gXK4qZqLq6hoZ5Y
@piyushjain9229
@piyushjain9229 Жыл бұрын
thanks sir you helped a lot to understand the basis of api and how to complex things in simple way
@codewithdary
@codewithdary Жыл бұрын
Love to help buddy :)
@umar_adil
@umar_adil Жыл бұрын
This is a nice work and it helped me to improve my sanctum integration and few shortcuts. I am also listing out all users to list without login by any user how can I prevent that API from public access?
@codewithdary
@codewithdary Жыл бұрын
Use a middleware!
@JLaurel
@JLaurel Жыл бұрын
You should do a Postman course. That would be great info...
@codewithdary
@codewithdary Жыл бұрын
I’ve got a video on my channel where I setup postman
@TamilKingt
@TamilKingt Жыл бұрын
Thanks for the great tutorial, Can we validate the auth check in validation class, why we need a separate function in controller?, How to validate the type hinted model in form request class?
@MayankSinghParmar
@MayankSinghParmar 2 ай бұрын
Very good video
@darwinibay2174
@darwinibay2174 Жыл бұрын
you are a master
@codewithdary
@codewithdary Жыл бұрын
Thank you Darwin
@ahsanjawed9543
@ahsanjawed9543 Жыл бұрын
i am beginner in laravel and i want to learn API's in laravel. Should i watch this course or watch you laravel API Course?
@codewithdary
@codewithdary Жыл бұрын
I would definitely say both, some things I do in the Laravel API course I don't explain in here.
@JanLordLuga
@JanLordLuga Жыл бұрын
great tutorial. Thank you!
@codewithdary
@codewithdary Жыл бұрын
Thank you Jan
@luisdev7646
@luisdev7646 Жыл бұрын
thank you very complete tutorial
@codewithdary
@codewithdary Жыл бұрын
You are welcome Luis :)
@wellingtonchanda4067
@wellingtonchanda4067 Жыл бұрын
🔥🔥🔥 this is fire
@codewithdary
@codewithdary Жыл бұрын
Thank you Wellington!
@johwel340
@johwel340 Жыл бұрын
super content. Thanks Dary.
@codewithdary
@codewithdary Жыл бұрын
My pleasure John!
@sithumdasantha3147
@sithumdasantha3147 Жыл бұрын
Kudos
@codewithdary
@codewithdary Жыл бұрын
Thank you!
@jdbt7874
@jdbt7874 Жыл бұрын
thank you for your great content and detailed explanations, I really appreciate it
@codewithdary
@codewithdary Жыл бұрын
My pleasure!
@robchal7230
@robchal7230 6 ай бұрын
niice video bro, but its too bad you didnt mention about other props from sanctum
@codewithdary
@codewithdary 5 ай бұрын
I could make a 10 hour video about Sanctum, or pretty much and other tool :)
@Ancient244
@Ancient244 5 ай бұрын
GREAT EXPLANATION
@bestepisodes5774
@bestepisodes5774 10 ай бұрын
Task::factory()->times(2)->create(); Error Class "Task" not found. showing this error. Can you help me
@codewithdary
@codewithdary 10 ай бұрын
Ensure that the Task model file is autoloaded properly by checking your composer.json file. This can be done by running the following command: composer dump-autoload.
@TheKennyWorld
@TheKennyWorld Жыл бұрын
1:07:00 Update method
@dheeraj_kumar_1508
@dheeraj_kumar_1508 Жыл бұрын
Thank you very much Sir i saw the video and practice well
@codewithdary
@codewithdary Жыл бұрын
Keep it up buddy!
@dheeraj_kumar_1508
@dheeraj_kumar_1508 Жыл бұрын
@@codewithdary Sure Sir, thank you Sir
@giodafirst0
@giodafirst0 Жыл бұрын
Great tutorial ! Tx!
@codewithdary
@codewithdary Жыл бұрын
Thank you, Serge!
@arazibrahim7416
@arazibrahim7416 9 ай бұрын
Thanks a lot...
@codewithdary
@codewithdary 9 ай бұрын
Thank you for watching :)
@aouraghmohammedelamine5744
@aouraghmohammedelamine5744 Жыл бұрын
thank you Dary for the tutorial it's very rich with informations and best practices , can you please update the repo ?
@codewithdary
@codewithdary Жыл бұрын
Thank you so much. What is missing in the repo?
@aisalen
@aisalen Жыл бұрын
Thanks for this great and clear tutorial! Hoping that you can continue creating tutorial for vue or react consuming the api from this.
@codewithdary
@codewithdary Жыл бұрын
Definitely something I'll be doing very soon!
@tukurhamid
@tukurhamid Жыл бұрын
@@codewithdary can't wait 👍
@davidadewale8466
@davidadewale8466 Жыл бұрын
Thanks for the tutorial… I’m stucked here. I kept getting error (Error, class “Task” not found) when I tried to use tinker to generate task . Any assistance will be welcomed. Thanks
@codewithdary
@codewithdary Жыл бұрын
This happens sometimes when composer has not loaded the classes correctly. The simplest solution is to add the entire path to it such as App\Models\Task
@RaV86pl
@RaV86pl 9 ай бұрын
Great video again, love Your work. Just a question, can we use policies for sanctum API? feels like it should work and in this example it fits perfectly
@codewithdary
@codewithdary 9 ай бұрын
Yes you can!
@codewithdary
@codewithdary 9 ай бұрын
The reason why I didn't use policies is mainly because I nevr covered it in a separate video
@stuarttodd1875
@stuarttodd1875 Жыл бұрын
This is great, thank you
@codewithdary
@codewithdary Жыл бұрын
Thank you for watching Stuart!
@user-ii6yg3lf1v
@user-ii6yg3lf1v 10 ай бұрын
how you used auth->attempt() to verify the credentials and in the same time generate a token, that's not a good practise because the auth()->attempt apply the seesion based authentication so the server is created a session on it after using this method
@codewithdary
@codewithdary 10 ай бұрын
The auth()->attempt() method is used to verify the credentials and log in the user. However, it does not generate a token directly. Instead, after successfully logging in the user, the code creates a token using $user->createToken('API Token')->plainTextToken.
@user-ii6yg3lf1v
@user-ii6yg3lf1v 10 ай бұрын
​@@codewithdary Yes, I mean after a successful attempt to log in user using the auth()->attempt() method the server creates a session for this user and sends it back to the browser, and no benefits from using the token-based authentication because as I know that among need for the token is to make the server more free in memory
@autoge13
@autoge13 11 ай бұрын
Why don't you use auth()->user() to get the current user instead of User::where('email',.....) after the Attempt? If the Attempt succeeds doesn't it mean that the auth() helper can be used as well?
@codewithdary
@codewithdary 11 ай бұрын
Looking at the code right now I do believe that you are right. The code I added isn’t necessarily wrong, but using auth()→user() is cleaner. use auth()->user(). If you need to retrieve user information based on a given condition, use User::where().
@hache_raw
@hache_raw Жыл бұрын
Thanks.
@codewithdary
@codewithdary Жыл бұрын
You're welcome!!
@moali9944
@moali9944 Жыл бұрын
Great video, Dary.
@codewithdary
@codewithdary Жыл бұрын
Glad you think so Mo!
@firassebai8592
@firassebai8592 Жыл бұрын
Thanks for clearing me sanctum because many ppls says its for beginners .. Else i ve another question am starting deving some apps with laravel without using any packages like sanctum or passport for auth, are they not secured 🤔 do tou recommend to use sanctum .. already setup auth for *not small projects thank you
@codewithdary
@codewithdary Жыл бұрын
Glad I could help! Well I can’t say whether a custom auth system is secured or not without seeing it but you have to keep a lot of factors into consideration which are happening behind the scenes. I’m personally a fan of sanctum because of its simplicity, so I would recommend it (or Laravel passport for oauth2.0)
@sundayolaoye713
@sundayolaoye713 Жыл бұрын
HI Dary, I don't know what I did wrong in the 32min here 'password' => ['required', 'confirmed', Rules\Password::defaults()]. it was highlighting Rules\Password and was saying undefined type, I wouldn't know what I supposed to put in the name space on top.
@patrikhalgas7719
@patrikhalgas7719 Жыл бұрын
Hi, try 'password' => ['required', 'confirmed', Password::defaults()] and use Illuminate\Validation\Rules\Password;
@sundayolaoye713
@sundayolaoye713 Жыл бұрын
@@patrikhalgas7719, thanks Dary as explained to me in another course.
@vilhemleshi7222
@vilhemleshi7222 Жыл бұрын
I faced the same issue.
@majdaleid6648
@majdaleid6648 6 ай бұрын
Thank you, I think using the null coalescing operator '??' in show method will simplify the code further, like this: private function isNotAuthorized($task) { if (Auth::user()->id !== $task->user_id) { return $this->error('', 'You are not authorized to make this request', 403); } return null; } public function show(Task $task) { return $this->isNotAuthorized($task) ?? new TasksResource($task); }
@codewithdary
@codewithdary 5 ай бұрын
You are definitely right! :)
@user-fy7yn2fh9m
@user-fy7yn2fh9m Жыл бұрын
Great job Dary. But I forgot how to deal with this ""The PATCH method is not supported for this route. Supported methods: GET, HEAD, POST."," resource controller can not be used?
@codewithdary
@codewithdary Жыл бұрын
What is the route?
@user-fy7yn2fh9m
@user-fy7yn2fh9m Жыл бұрын
@@codewithdary timing 1:09:26 error "message": "The PATCH method is not supported for route api/tasks. Supported methods: GET, HEAD, POST.", "exception": "Symfony\\Component\\HttpKernel\\Exception\\MethodNotAllowedHttpException", Please advise how to fix this error
@codewithdary
@codewithdary Жыл бұрын
@@user-fy7yn2fh9m The patch method is used to update a resource, but you are trying to perform it on either retrieving or persisting a post. The endpoint for patch should be api/tasks/{id}
@user-fy7yn2fh9m
@user-fy7yn2fh9m Жыл бұрын
@@codewithdary thanks for the help. Inattentively looked, everything worked.
@aakashdesai149
@aakashdesai149 2 жыл бұрын
After using the validator Request in the parameter, we don't need to use the validated function in the function, it will validate automatically.
@fahvygaming1118
@fahvygaming1118 Жыл бұрын
If you add an extra input that isn't in the rule, it will get passed into the data
@__Cypher
@__Cypher Жыл бұрын
@@fahvygaming1118 If we add an extra input then we can add it to rules as well or we can add it as nullable
@tricioandrade
@tricioandrade Жыл бұрын
Hello teacher, how are you? I'm having problems with the Class Validator while trying to register a user: { "message": "Method Illuminate\\Validation\\Validator::validateAndrade does not exist." } I've searched on stackoverflow and other forums but I haven't had success. I tried to include the Class Validator, but I didn't succeed either. And again, thank you for taking your precious time to create this instructional-rich video.
@codewithdary
@codewithdary Жыл бұрын
Have you added validateAndrade in your use statement? Other than that I have no idea and it doesn't seem like an error related to this tutorial.
@codewithdary
@codewithdary Жыл бұрын
I'm also doing good! What about yourself? :)
@ladirevolutionist
@ladirevolutionist Жыл бұрын
I got the same error. But I find that I typo in AuthController.php. incorrect : $request->validate($request->all()); correct : $request->validated($request->all()); I hope this will help you from Japan. And super thank you, Dary!!
@tricioandrade
@tricioandrade Жыл бұрын
Thanks ladirevolutionist. I'll try that
@tricioandrade
@tricioandrade Жыл бұрын
@@ladirevolutionist thank you.
@mohammadeshaghi2637
@mohammadeshaghi2637 8 ай бұрын
thanks
@codewithdary
@codewithdary 8 ай бұрын
No problem
@user-if8ub3vd9g
@user-if8ub3vd9g 6 ай бұрын
Thnx for the video, how can we implement roles and permission
@codewithdary
@codewithdary 5 ай бұрын
Laravel Spatie Roles and Permissions :)
@tito-ace
@tito-ace Жыл бұрын
wow! very clear tutorial..how to be you sir 😁
@codewithdary
@codewithdary Жыл бұрын
Nothing special, just a lot of practice. Thank you :)
@seanmaruelcomingues6257
@seanmaruelcomingues6257 Жыл бұрын
Thank you.
@codewithdary
@codewithdary Жыл бұрын
My pleasure Sean!
@tukurhamid
@tukurhamid Жыл бұрын
Thank you sir. This tutorial is superb 👌👌👌
@codewithdary
@codewithdary Жыл бұрын
Thank you for watching Tukur, appreciate it
@mahdipaykoub9951
@mahdipaykoub9951 3 ай бұрын
It was great, but one question When we don't use the api of Laravel, the functionality of the register and login functions are implemented by Laravel. Is there no such api here?
@Psychobellic
@Psychobellic Жыл бұрын
Great content, Dary. Thank you!! Just wanted to add that I had some issues on the authentication, always getting Unauthorized back, even using traits.. But my issue was that I was using Breeze as starter kit, so I had to start a new project to make it work properly. It does now, I just don't understand why we create a token on register and a new one on login? Can you explain, please?
@codewithdary
@codewithdary Жыл бұрын
Laravel Breeze doesn't use Sanctum! You need to look into that to get more clarification :)
@AlexGower
@AlexGower Жыл бұрын
Laravel breeze -api uses sanctum all you need to do is get csrf before try to login etc and then it will refresh the csrf with every authenticated request
Laravel SPA Authentication - setup and common mistakes
16:55
My Cheetos🍕PIZZA #cooking #shorts
00:43
BANKII
Рет қаралды 26 МЛН
Running With Bigger And Bigger Feastables
00:17
MrBeast
Рет қаралды 129 МЛН
If Barbie came to life! 💝
00:37
Meow-some! Reacts
Рет қаралды 67 МЛН
Fortunately, Ultraman protects me  #shorts #ultraman #ultramantiga #liveaction
00:10
Why is anti-immigration sentiment on the rise in Canada?
13:00
The Guardian
Рет қаралды 1,8 МЛН
Brutally honest advice for new .NET Web Developers
7:19
Ed Andersen
Рет қаралды 145 М.
Should You Dare Criticize Kamala Harris... | Piers Morgan
12:40
Jordan B Peterson
Рет қаралды 1,9 МЛН
Laravel Passport vs Sanctum: What's the difference?
8:28
Andrew Schmelyun
Рет қаралды 15 М.
Become a PRO at Using Components in Laravel
32:51
Code With Dary
Рет қаралды 36 М.
I forced EVERYONE to use Linux
22:59
NetworkChuck
Рет қаралды 405 М.
Laravel Sanctum SPA Auth Overview
13:34
cdruc
Рет қаралды 9 М.
A.I. ‐ Humanity's Final Invention?
18:30
Kurzgesagt – In a Nutshell
Рет қаралды 4,3 МЛН
How This New Battery is Changing the Game
12:07
Undecided with Matt Ferrell
Рет қаралды 181 М.
Laravel 11 Tutorial for Beginners - Laravel Crash Course (2024)
1:22:20
The Codeholic
Рет қаралды 160 М.
My Cheetos🍕PIZZA #cooking #shorts
00:43
BANKII
Рет қаралды 26 МЛН