LARAVEL AUTH, CRUD Multi Level User
Publised: Rabu, 4 Juni 2025 | Author: Sherly Ananda Putri - 2311532017
Click to go to githubPublised: Rabu, 4 Juni 2025 | Author: Sherly Ananda Putri - 2311532017
Click to go to githubPada praktikum ini, saya akan menjelaskan bagaimana membuat API CRUD sederhana menggunakan Laravel 12 dan mengetesnya dengan Postman.
- Komputer/Laptop
- XAMPP: Sebagai local web server untuk menjalankan PHP dan MySQL di komputer lokal.
- Visual Studio Code: Sebagai code editor untuk menulis skrip PHP dan HTML.
- Database MySQL.
- Postman sebagai REST client
- PHP artisan serve untuk server lokal
(C:\xampp\htdocs\laravel)composer global require "laravel/installer"laravel new api-products
composer create-project laravel/laravel api-products php artisan serve
php artisan serve pada command prompt.
php artisan make:migration create_products_table pada terminal/cmder
database/migrations/..._create_products_table.php
php artisan migrate pada terminal/cmder.
create_products_table telah berhasil dibuat.
php artisan make:model Product pada terminal/cmder
Models/Product.php
php artisan make:controller ProductController --api pada terminal/cmder
index, store, show, update, destroy.
php artisan make:resource ProductResource pada terminal/cdmder.
api.php secara manual pada folder routes.RouteServiceProvider.php terhubung ke file api.php.
Route::apiResource('products', ProductController::class); pada file api.php
php artisan serve pada terminal/cmderphp artisan route:list
GET all product, POST (create product),
PUT (update) product, GET by ID, dan DETELTE product.