Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yanuarprayoga9/laravel-learn
learn laravel CRUD + AUTH Cara Fajar :pushpin:
https://github.com/yanuarprayoga9/laravel-learn
laravel9
Last synced: 3 months ago
JSON representation
learn laravel CRUD + AUTH Cara Fajar :pushpin:
- Host: GitHub
- URL: https://github.com/yanuarprayoga9/laravel-learn
- Owner: Yanuarprayoga9
- Created: 2023-07-26T00:17:42.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-22T13:48:25.000Z (over 1 year ago)
- Last Synced: 2024-10-11T11:22:49.920Z (3 months ago)
- Topics: laravel9
- Language: PHP
- Homepage:
- Size: 165 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### npm instal
### php artisan migrate // php artisan migrate::fresh
### npm run dev
### php artisan serve# CATATAN PENAMAAN FILE
# Belajar Laravel
## Routes
### php artisan migrate:fresh
### php artisan migrate:fresh --seed
## Migrate database
create table php = artisan make:migration create_flights
add column php = artisan make:migration add_column_to_students_table
The migrate:fresh command will drop all tables from the database and then execute the migrate command:## RELASI DB
php artisan make:migration add_class_id_colum_to_students_table (membuat relasi id class ke tabel students )
### $table->unsignedBigInteger('class_id')->required();
membuat column class id
### $table->foreign('class_id')->references('id')->on('class');
mengisi user id dengan referensi id dari table class## memberi aturan unique
function up = $table->string('name')->unique->change();
down = $table->dropUnique('class_name_unique');
# MVC
## MODEL
### Membuat Model = php artisan make:model Student## CONTROLLER
### php artisan make:controller StudentContoller### Membuat Route Controller
## DB SEEDER
### Tambah class
php artisan make:seeder ClassSeeder
ClassRoom::insert([
'name'=>'yanuar prayoga'
]);
### truncate db
Schema::disableForeignKeyConstraints();
Student::truncate();
Schema::enableForeignKeyConstraints();### Mengisi data denga factory
php artisan make:factory ClassFactory --model=ClassRoom### Eloquent
-->
### query builder
## search method
$student = Student::where('name','LIKE','%'.$keyword.'%')->paginate(10);
# upload foto
1. kita harus mengganti file systems
2. if ($request->file('photo')) {
$extension = $request->file('photo')->getClientOriginalExtension();
$newName = $request->name . '-' . now()->timestamp . '.' . $extension;
$request->file('photo')->storeAs('photo', $newName);
}
3. public disk = php artisan storage:link
4. to show
5.## middleware
php artisan make:model Role
$ php artisan make:migration add_role_id_column_to_users_table;### akun admin