Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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:

Awesome Lists containing this project

README

        

Laravel Logo


Build Status
Total Downloads
Latest Stable Version
License

### 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