Creating Database & Reading Records - RESTful API with Laravel - 02

  Рет қаралды 58,600

Atif Naseem

Atif Naseem

Күн бұрын

Пікірлер: 109
@SHAJ.T3CH
@SHAJ.T3CH 5 жыл бұрын
awesome, waiting for the next one
@AtifNaseem
@AtifNaseem 5 жыл бұрын
Thank you
@kamrankhan-py9ug
@kamrankhan-py9ug 5 жыл бұрын
Excellent work atif bhai.....the way you explain things is awesome!! You make difficult concepts quite easy to understand.... You are a God Gifted Teacher.....Great presentation skills....Great Videos.... Allah Bless You
@AtifNaseem
@AtifNaseem 5 жыл бұрын
Thank you kamran khan. ALLAH bless you.
@ehabelshimi9473
@ehabelshimi9473 2 жыл бұрын
the best of video "السلام عليكم" thanks
@AtifNaseem
@AtifNaseem 2 жыл бұрын
Glad you like it :-)
@aosky6168
@aosky6168 3 жыл бұрын
thanks for your helpful content. I have a question concerning getting list from database, how can I get list with filter for a specific value of a field, for example I want to get list with just the persons which their names = "jamal"?
@AtifNaseem
@AtifNaseem 3 жыл бұрын
select * from table_name where name = 'jamal'
@jelbinthomas9559
@jelbinthomas9559 3 жыл бұрын
can you tell me which link you are copy for the migration???
@AtifNaseem
@AtifNaseem 3 жыл бұрын
its in the description of the video.
@imranshabbir3517
@imranshabbir3517 4 жыл бұрын
Hi, can you please explain, why you used api/country in URL to access the webpage, as i see that in API routing file you were used (country) only in the get method, so I am confused how api word comes in the URL?
@AtifNaseem
@AtifNaseem 4 жыл бұрын
Yes, correct To change it we just go to the RouteServiceProvider.php file in the app/Providers folder Then in the mapApiRoutes method function section, we can eliminate the prefix (‘api’) protected function mapApiRoutes() { Route::prefix('api') ->middleware('api') ->namespace($this->namespace) ->group(base_path('routes/api.php')); } So that the function becomes as follows protected function mapApiRoutes() { Route::middleware('api') ->namespace($this->namespace) ->group(base_path('routes/api.php')); }
@supunmaththanagoda9082
@supunmaththanagoda9082 4 жыл бұрын
Did you store all County names in the _z_country table? 🤔 How did you get data without saving data in table?
@AtifNaseem
@AtifNaseem 4 жыл бұрын
The link of the table is in the description of the video.
@charlesessien3676
@charlesessien3676 4 жыл бұрын
Illuminate\Contracts\Container\BindingResolutionException Target class [App\Http\Controllers\CountryController] does not exist. i keep getting this error, please what could be wrong?
@AtifNaseem
@AtifNaseem 4 жыл бұрын
1. Run composer dump-autoload command. composer dump-autoload 2. Run the config command. php artisan config:clear
@donaldmjbart-williams3144
@donaldmjbart-williams3144 2 жыл бұрын
Hello Atif. Thanks for a great tutorial. Can you make a single video explaining the migration file?
@AtifNaseem
@AtifNaseem 2 жыл бұрын
Yes, soon. Thanks Donald MJ
@JavedKhan-gp1nj
@JavedKhan-gp1nj 3 жыл бұрын
Illuminate\Contracts\Container\BindingResolutionException Target class [Country\CountryController] does not exist. ye error de raha hai sir
@AtifNaseem
@AtifNaseem 3 жыл бұрын
Check the controller exists in the folder Country
@calligraphywithshohely117
@calligraphywithshohely117 3 жыл бұрын
Same error showing to me. Can you solve this issue? Please help me
@sapsirre
@sapsirre 4 жыл бұрын
hello good sir, when i open 127.0.0.1:8000/api/country it says that Illuminate\Database\QueryException could not find driver (SQL: select * from `_z_country`) i already uncomment pdo MySQL in PHP.ini but it doesn't seem to work
@AtifNaseem
@AtifNaseem 4 жыл бұрын
php.ini? in laravel have you set db in .env file?
@sapsirre
@sapsirre 4 жыл бұрын
@@AtifNaseem yes i have, also if its not maybe the error its different
@yehiakadah2070
@yehiakadah2070 4 жыл бұрын
Iam used xampp when i go to the database i found 3 table only what is the problem ?
@AtifNaseem
@AtifNaseem 4 жыл бұрын
Please open .sql file in notepad++ and copy everything from there and paste in phpmyadmin (after selecting a database)
@roshankc6044
@roshankc6044 4 жыл бұрын
Why we use this code the output is same using protected $fillable = [ 'id', 'iso', 'name', 'dname', 'iso3', 'position', 'numcode', 'phonecode', 'created', 'register_by', 'modified', 'modified_by', 'record_deleted', ]; or Not using This
@AtifNaseem
@AtifNaseem 4 жыл бұрын
will helpful on saving the data
@vishwakirtivardhan2691
@vishwakirtivardhan2691 4 жыл бұрын
Hi buddy, I am still getting same error while migrate the db, which is mention in video, I do all possible hack which you discribe in video. Help me out pls.
@vishwakirtivardhan2691
@vishwakirtivardhan2691 4 жыл бұрын
And one more thing,What is relevance of 99 or 199 in defaultstringlength function ?
@AtifNaseem
@AtifNaseem 4 жыл бұрын
share errors.
@AtifNaseem
@AtifNaseem 4 жыл бұрын
its default string length, set 99 if its enough
@obentabiayuk4780
@obentabiayuk4780 4 жыл бұрын
please how did you know that the that the url will be localhost:8000/api/country ???
@AtifNaseem
@AtifNaseem 4 жыл бұрын
Once you execute "php artisan serve" you can use this route.
@bouhadadouasma966
@bouhadadouasma966 4 жыл бұрын
I get an error when I run php artisan migrate can you help me ? Fatal error: Uncaught Error: Class 'Illuminate\Foundation\Application' not found in C:\xampp64\php\www\Think\bootstrap\app.php:14
@AtifNaseem
@AtifNaseem 4 жыл бұрын
execute these commands composer dump-autoload composer install --no-scripts composer update
@kalyanipriyadarsini
@kalyanipriyadarsini 4 жыл бұрын
$apitoken = $request->header('APP_KEY'); itis not displaying apitoken value from header in postman api
@AtifNaseem
@AtifNaseem 4 жыл бұрын
use APPKEY instead
@mythilim4751
@mythilim4751 4 жыл бұрын
Awesome .... Thank you sir .
@AtifNaseem
@AtifNaseem 4 жыл бұрын
Most welcome
@fauzanramadhan3916
@fauzanramadhan3916 4 жыл бұрын
why i just have 3 table without relationship?
@AtifNaseem
@AtifNaseem 4 жыл бұрын
Open sql file in notepad++ and check all the queries. I think there are many tables with data.
@VaVathana-co3nh
@VaVathana-co3nh 4 жыл бұрын
me too
@AhfazMalik
@AhfazMalik 4 жыл бұрын
Sir meri nai chalrai API ? PLZZ HELP
@AtifNaseem
@AtifNaseem 4 жыл бұрын
No porblem, share errors.
@AhfazMalik
@AhfazMalik 4 жыл бұрын
@@AtifNaseem he said , model not found , And i mention my model in controller . Like use\app\models\CountryModel
@musyafamuhammad5467
@musyafamuhammad5467 4 жыл бұрын
Assalamualaikum, how to read more than 1 table in the database?
@musyafamuhammad5467
@musyafamuhammad5467 4 жыл бұрын
Should i create more models?
@AtifNaseem
@AtifNaseem 4 жыл бұрын
Yes one model for one table and then create relationship.
@AtifNaseem
@AtifNaseem 4 жыл бұрын
You can create select query and get data from various tables.
@musyafamuhammad5467
@musyafamuhammad5467 4 жыл бұрын
@@AtifNaseem and for controller too?
@samuelandrian4025
@samuelandrian4025 4 жыл бұрын
in my case the url will be 127.0.0.1:8000/country, did i miss any configuration here?, how can the url become 127.0.0.1:8000/api/country ?
@AtifNaseem
@AtifNaseem 4 жыл бұрын
Make sure you created route in api and not in web, then check url with /api/country
@samuelandrian4025
@samuelandrian4025 4 жыл бұрын
@@AtifNaseem thankyou very much sir
@MrFranciscoooooo
@MrFranciscoooooo 4 жыл бұрын
2:52, you didn't explain why you did this step..
@AtifNaseem
@AtifNaseem 4 жыл бұрын
you mean php artisan migrate, actually after resolving the defaultstring error, we created all the tables
@MrFranciscoooooo
@MrFranciscoooooo 4 жыл бұрын
@@AtifNaseem no.. why that defaultstring? never got that in my migrations.
@BaoNguyen-de5du
@BaoNguyen-de5du 4 жыл бұрын
dear sir, i got only 3 tables how did you got 20 tables ? how to fix it ? Thank
@AtifNaseem
@AtifNaseem 4 жыл бұрын
In migration file: 2018_09_26_163300_student_register.php you can see that we have alot of tables. Check if any error is preventing it.
@TanPham-of4bt
@TanPham-of4bt 4 жыл бұрын
you must change file name 2018_09_26_163300_student_register.php.txt to 2018_09_26_163300_student_register.php
@CloudTechExpert
@CloudTechExpert 4 жыл бұрын
SOOOOOOOOOOOOOOOOOO AMAZING BRO.
@AtifNaseem
@AtifNaseem 4 жыл бұрын
Thank you so much 😀
@777Vasya77
@777Vasya77 5 жыл бұрын
6:27 use protected $guarded = ['id']
@AtifNaseem
@AtifNaseem 5 жыл бұрын
Thank you so much. You can use after this line protected $table = 'country'; protected $guarded = ['id']; * B U T * Laravel already makes everything guarded by default: protected $guarded = ['*']; As a result, there's no need to specify the id when it's already guarded. When you override that property, you are telling Laravel, "Actually, don't guard everything. Only guard the properties that I specify." So essentially, you are unguarding other properties. Also, if you are manually going to assign properties like this: $model = new CountryModel; $model->id = 1; $model->name = 'Example'; $model->save(); The $guarded / $fillable properties never kick in. They kick in when you use methods like create, update, fill, etc.
@cattalkhablandogato367
@cattalkhablandogato367 4 жыл бұрын
Use Route::get('country', [CountryController::class, 'country']); to avoid target problem
@AtifNaseem
@AtifNaseem 4 жыл бұрын
Thanks alot
@Arnold3976
@Arnold3976 3 жыл бұрын
it fixed my problem, Thank You
@calligraphywithshohely117
@calligraphywithshohely117 3 жыл бұрын
Illuminate\Contracts\Container\BindingResolutionException Target class [CountryController] does not exist. i have this problem. please help me
@calligraphywithshohely117
@calligraphywithshohely117 3 жыл бұрын
Finally solve this issue Alhamdulillah! Thank you!
@SorrowBee_2
@SorrowBee_2 3 жыл бұрын
why i keep getting error
@kutimanu6082
@kutimanu6082 4 жыл бұрын
Target class country\countrycontroller does not exist Illuminate/contracts/container/bimdingresolutionexception
@The_Lik_96
@The_Lik_96 4 жыл бұрын
Did you fix that error?
@AtifNaseem
@AtifNaseem 4 жыл бұрын
Target class error: check your controller.
@AtifNaseem
@AtifNaseem 4 жыл бұрын
Check controller name or namespace etc.
@The_Lik_96
@The_Lik_96 4 жыл бұрын
@@AtifNaseem everything checked and fix that! Thx for replying!
@SorrowBee_2
@SorrowBee_2 3 жыл бұрын
Illuminate\Contracts\Container\BindingResolutionException Target class [CountryController] does not exist. i have this problem. please help me
@AtifNaseem
@AtifNaseem 3 жыл бұрын
here is complete migration file github.com/anajetli/android_login_registration_via_api/tree/master/migrations you may create resource controller for CountryController
@shoukathali1710
@shoukathali1710 4 жыл бұрын
laravel version ????
@AtifNaseem
@AtifNaseem 4 жыл бұрын
You can do in any version. This is general.
@desunnet
@desunnet 4 жыл бұрын
Good work.
@AtifNaseem
@AtifNaseem 4 жыл бұрын
Thank you
@arsalanpices
@arsalanpices 4 жыл бұрын
i got only 3 tables how did you got 20 tables
@AtifNaseem
@AtifNaseem 4 жыл бұрын
If you open migration file you will see there many tables with data.
@zhapp3114
@zhapp3114 4 жыл бұрын
Illuminate \ Database \ QueryException (1049) SQLSTATE[HY000] [1049] Unknown database 'laravel' (SQL: select * from `_z_country`) Previous exceptions SQLSTATE[HY000] [1049] Unknown database 'laravel' (1049) I get this error
@AtifNaseem
@AtifNaseem 4 жыл бұрын
check .env file and check database settings.
@gkemoji
@gkemoji 3 жыл бұрын
Nice video.plz upload react js video
@AtifNaseem
@AtifNaseem 3 жыл бұрын
Thanks, will do.
@hamzashan8349
@hamzashan8349 5 жыл бұрын
Sir 3 more Api banae get, post, put, patch, delete with relationship
@AtifNaseem
@AtifNaseem 5 жыл бұрын
step by step... :)
@arunraj362
@arunraj362 4 жыл бұрын
Tq bro nice
@AtifNaseem
@AtifNaseem 4 жыл бұрын
Thanks
@denizgolbas9691
@denizgolbas9691 5 жыл бұрын
Aleykum selam from Turkey
@AtifNaseem
@AtifNaseem 5 жыл бұрын
My pleasure Deniz Gölbaş
@mohammadalabd189
@mohammadalabd189 5 жыл бұрын
Very good
@AtifNaseem
@AtifNaseem 5 жыл бұрын
Thank you.
@okan85100
@okan85100 3 жыл бұрын
perfect :D
@AtifNaseem
@AtifNaseem 3 жыл бұрын
Thanks okan sari
@darlansyah8856
@darlansyah8856 4 жыл бұрын
nice
@AtifNaseem
@AtifNaseem 4 жыл бұрын
Thanks
@usmanali-ed7xj
@usmanali-ed7xj 4 жыл бұрын
hello sir, i am computer science student of 7th semester i belong to swat pakistan , my project is teacher evaluation websites in php , i search about php but php not give best security , then i decide i do my project in php framework laravel, about 30 lecture of laravel ( become a master) i cover , in your laravel playlist(become a master ) leacture so clear , i like very much , it so easy and mostly understanable , but some lecture have api , which is use read , delete , and edit data between client and server , now i confuse that i do my project only in laravel or i use api also , sir if you give a time to discuss our project , and please mention your gmail id , to discuss our project problem darictley, i shall be very thankful
@AtifNaseem
@AtifNaseem 4 жыл бұрын
complete your web project using laravel only. use api when you decide to share data with your mobile applicaiton
@rahmadikaaa
@rahmadikaaa 4 жыл бұрын
Waalaikumsalam..
@AtifNaseem
@AtifNaseem 4 жыл бұрын
Thanks
@stevemasaki
@stevemasaki 4 жыл бұрын
Your title should be, importing a database not creating.
@AtifNaseem
@AtifNaseem 4 жыл бұрын
You may create database, watch series.
@jorgeleon9212
@jorgeleon9212 4 жыл бұрын
si jala
@AtifNaseem
@AtifNaseem 4 жыл бұрын
si jala ?
Setup - RESTful API with Laravel - 01
6:26
Atif Naseem
Рет қаралды 113 М.
Add a Record - RESTful API with Laravel - 03
5:16
Atif Naseem
Рет қаралды 34 М.
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН
Laravel REST API Tutorial - Build an API in Laravel
20:45
TheCodePro
Рет қаралды 89 М.
Edit and Delete a Record - RESTful API with Laravel - 04
4:51
Atif Naseem
Рет қаралды 24 М.
PHP REST API From Scratch [1] - Database & Read
32:18
Traversy Media
Рет қаралды 514 М.
Validation - RESTful API with Laravel - 05
9:10
Atif Naseem
Рет қаралды 25 М.
Solving one of PostgreSQL's biggest weaknesses.
17:12
Dreams of Code
Рет қаралды 220 М.
Token Authentication - RESTful API with Laravel - 07
6:43
Atif Naseem
Рет қаралды 84 М.
Microservices with Databases can be challenging...
20:52
Software Developer Diaries
Рет қаралды 112 М.
What’s Up with Laravel? It’s Everywhere, and Here’s Why!
6:22
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН