??? Laravel ????? ??? ???? ??????. 2. ??, ?????? ? ????? ???? ??????? ??????. 3. Routes/API.php?? RESTFUL ??? ?????. 4. PostController?? ??, ??, ?? ? ?? ???? ???? JSON ??? ?????. 5. ??? ?? ?? API ??? ???????. 6. ????? ??? ?? API ??? ?????. ????? ?? ?? ??? ??? ??? ??, ???? ?? ??? Laravel REST API? ????.
Laravel?? REST API? ???? ?? ???, Eloquent ORM ? ?? ??? ?? ?? ?? ??? ?????. ??? Laravel? ???? ???? ???? REST API? ??? ? ????? ???? ??????.

1. ??? Laravel ????? ??????
???? ???? ??? Laravel ????? ??? ??????.
??? Create Project Laravel/Laravel Api-Demo CD API ??
?? ?? ?? ??? ???? ?? ??? ??????.

PHP ??? ?????
http://localhost:8000
? Laravel Welcome ???? ? ? ????.
2. ??, ?????? ? ????? ????
???? ?????? ??? API? ?????. MAKE : -a
???? ?? make:model
Command? ???? ??, ??????, ?? ? ????? ?????.

PHP Artisan Make : Model Post -A
??? ????? :
-
app/Models/Post.php
- ?? ?? -
database/migrations/xxxx_create_posts_table.php
- ?????? -
app/Http/Controllers/PostController.php
- ???? -
database/factories/PostFactory.php
-??
??? ??? ????? ?????? ??? ??????.
// ??????/???????? /..._ create_posts_table.php schema :: create ( 'posts', function (blueprint $ table) { $ table-> id (); $ table-> String ( 'title'); $ table-> text ( 'body'); $ table-> timestamps (); });
?????? ?? :
PHP ?? ??
3. API ??? ??????
Open routes/api.php
? Route::apiResource()
???? ??? ??? ?????.
App \ http \ Controllers \ PostController? ?????. route :: apiresource ( 'posts', postcontroller :: class);
? ??? ???? ?? ?? ??? ?????.
-
GET /api/posts
→ ??? -
POST /api/posts
→ ?? -
GET /api/posts/{id}
→ show -
PUT/PATCH /api/posts/{id}
→ ???? -
DELETE /api/posts/{id}
→ ??
??? ?? ?? ??? ? ? ????.
PHP Artisan Route : List --Path = API
4. ???? ??? ??????
app/Http/Controllers/PostController.php
?? ????? ???? ??? ?????.
app \ models \ post? ?????. Illuminate \ http \ request? ??????. ??? PostController? ????? ????? { ?? ?? ?? () { return response ()-> json (post :: all ()); } ?? ?? ??? (?? $ ??) { $ validated = $ request-> validate ([[[ 'title'=> '?? | String | max : 255', 'body'=> '?? | ???', ]); $ post = post :: create ($ validated); return response ()-> json ($ post, 201); } ?? ?? ? ($ id) { $ post = post :: ?? ($ id); if (! $ post) { return response ()-> json ([ 'message'=> 'post found'], 404); } return response ()-> json ($ post); } ?? ?? ???? (?? $ ??, $ id) { $ post = post :: ?? ($ id); if (! $ post) { return response ()-> json ([ 'message'=> 'post found'], 404); } $ validated = $ request-> validate ([[[ 'title'=> '?? | String | max : 255', 'body'=> '?? | ???', ]); $ post-> update ($ validated); return response ()-> json ($ post); } ?? ?? ?? ($ id) { $ post = post :: ?? ($ id); if (! $ post) { return response ()-> json ([ 'message'=> 'post found'], 404); } $ post-> delete (); return response ()-> json ([ 'message'=> 'post deleted']); } }
? Laravel? ????
response()->json()
? ??? ? JSON ??? ???? ?????. ?? API ??? ?? CSRF ??? ????api
???? (Sationeles)? ?????.
5. API? ???????
???? , ? ?? ?? ????? (vs ??)? ?? ??? ???? ?? ???? ???????.
? : ?? ???? ????
curl -x post http : // localhost : 8000/api/posts \ -H "Content-Type : Application/JSON"\ -d '{ "title": "My First Post", "Body": "This is the Body"}'
?? ? ??? ? 201
??? JSON ??? ???????.
6. (?? ??) ??? API ??? ??????
?? ? ??? ?? Laravel Sanctum? ???? ?? ?? ??? ??????.
?? ?? :
???? Laravel/Sanctum? ????? PHP Artisan ?? ?? : ?? -provider = "Laravel \ Sanctum \ Sanctumserviceprovider" PHP ?? ??
'api'
?? app/Http/Kernel.php
? Sanctum Middleware? ??????.
'API'=> [ \ laravel \ sanctum \ http \ middleware \ rittfrontendRequestSarestateful :: class, '??? : API', \ Illuminate \ Routing \ Middleware \ CustituteBindings :: Class, ],,
?? ?? :
Route :: Middleware ( 'Auth : Sanctum')-> apiresource ( 'posts', postcontroller :: class);
?? ???? API? ?????? ???? ???????.
?? ??
- ??? ?? ??? ???? ?????? - ??? ??? ?? ?? ??? ???? ??????.
- ??? ???? ?? API ??? (
php artisan make:resource PostResource
)? ??????. - ?? ??? ???? ?????? (? : 404, 422).
- ?? ???? ?? ?? (? :
/api/v1/posts
)? ??????.
?? ??. ?? Laravel? ?? ??? ???? REST API? ????. ???? ?? ???? ?? ??? ????? ????.
? ??? Laravel? REST API? ???? ???? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

1. PHP ?? ?? ? ?? ?????? Laravel MySQL VUE/React ??? ? ?? ??? ???? ??? ?? ?? ??? ?? Laravel MySQL VUE/React ??? ? ?? ?????. 2. ???? ?? (REDIS), ?????? ???, CDN ? ??? ?? ???????. 3. ?? ???, CSRF ??, HTTPS, ???? ??? ? ?? ??? ??? ???????. 4. ? ??? ??, ?? ??, ??, ???, ?? ?? ? ?? ??? ??? ???? ? ? ??? ??? ?? ????.

? ??? ? ?? ??? ???? ??? ?? ?? ??? ???? ???? ???? Laravel ??? ???? ???? ??? ???? ?? ??????. ??? ???? ???? ??? ??? ?? ?? ??? ?? "???? ???? ???"? ??? ???? ??? ??? ???? ??? ??? ?? ??? ???? ????? ???? ?? ? ???? ??? ?? ??? ?? ? ? ??????. ??? ??? ?? ???? httpdelete ???? ?????? ?? ??? ?????.

? ??? LaravelliveWire ?? ??? ???? ???? ??? ? ? ??? ??? ?? ??? ??? ?? ??? ????? ???? ????? ??? ???? ?? ??????. ?? ??? (? : "user.name")? ???? ?? ??? ?? ??? ????? ?? ?? ??? ??? ???? ?????. ? ??? Laravel? Data_get ??? ??? ??? ???? ?? ??? ?? ??? ??? ?? ??? ??? ???? ???? ??? ??? ???? ???? ???? ??? ?????.

??? PHP ??? ??? ??? ?? ???? ??? ?? ????? ???????. Laravel? ?? ??? ???? ??? ? ? ???? ??? ??? ???? ?????? ?? ? ?? ?? ???? ?????. Symfony? ? ???? ??? ???? ?????. Codeigniter? ??? ??? ?? ??? ?? ??? ?? ????? ?????. 2. AI ??? ???? ????? ??? ??? ??, ???? ?? ?? (? : ???, ??, F1 ?), ??? ? ?? ?? ? ?? ??? ?? ???? ?? ??? ???? ???? ?? ??? ? ?? ???? ?? ?? ??? ????? ?? ???? ????? ?????? ??? ????? ???????. 3. ??? ?? ?? ????? ?? ??? ?????. AES? ?? ??? ???? ????? ?????.

PHP?? ?? ??? ???? ? ?? ?? ??? ????. 1. php.ini? ?? ??? ??; 2. ? ?? (? : Apache? Setenv ?? nginx? FastCGI_Param)? ??????. 3. PHP ?????? putenv () ??? ??????. ? ??? Php.ini? ????? ??? ???? ??? ???? ? ?? ??? ?? ???? ????? ???? Putenv ()? ?? ??? ?????. ?? ???? ?? ?? (? : php.ini ?? ? ?? ??)? ???? ????. ?? ?? ??? ??? ?? ??? ????? ???? ?? ????.

PHP ????? ?? ??? ??? ? ??? ??? CI (Continuous Integration) ????? ???? ? ????. 1. DockerFile? ???? ?? ???, ?? ??, ??? ?? ? ?? ??? ???? PHP ??? ?????. 2. Gitlabci? ?? CI/CD ??? ???? .gitlab-ci.yml ??? ?? ??, ??? ? ?? ??? ???? ?? ??, ??? ? ??? ?????. 3. PHPUNIT? ?? ??? ??? ??? ???? ?? ?? ? ???? ???? ????????. 4. Kubernetes? ?? ?? ?? ??? ???? ?? .yaml ??? ?? ?? ??? ?????. 5. Dockerfile ??? ? ??? ??? ??????

? ??? ?? ??? ???? ??? ?? ??? ??? ??? ???? ???? ?? ????? ?? ?????. ??? ?? ??? ???? ??? ??? ?? ???? ???? ???? "???? ???? ???"??? ?? ????, ??? ???? ???? ??? ??, ? URI? ?? ??? ???? ???? ????? ??? ? ?? ??? ?????. ???? ??? HTTP ??? ?? ?? ??? ?? ?? ?? ? ??? ???? ?????? ???? ??? ?? ??????? ?? ? ? ??? ?????.

? ????? Laravel ????? ???? ???? ??? ?? ?? ??? ?? ??? ??? ?? ?????. ??? ?? ??? ???? ??? ??? ?? ???? ???? ???? ??? ?? ???? ??? ??? ?? ??? ??? ???? ??? Laravel ?? ?? ?? ???? ????? ?????. ???,? ??? ?? ??? ???? ?? ????? ?? ?? ? ???? ???? ?? RESTFUL ??? ? ???? HTTPDELETE ???? ???? ?? ????.
