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:
php artisan make:migration add_class_id_colum_to_students_table (membuat relasi id class ke tabel students )
membuat column class id
mengisi user id dengan referensi id dari table class
function up = $table->string('name')->unique->change(); down = $table->dropUnique('class_name_unique');
php artisan make:seeder ClassSeeder ClassRoom::insert([ 'name'=>'yanuar prayoga' ]);
Schema::disableForeignKeyConstraints(); Student::truncate(); Schema::enableForeignKeyConstraints();
php artisan make:factory ClassFactory --model=ClassRoom
--> $student = Student::where('name','LIKE','%'.$keyword.'%')->paginate(10);
- kita harus mengganti file systems
- if ($request->file('photo')) { $extension = $request->file('photo')->getClientOriginalExtension(); $newName = $request->name . '-' . now()->timestamp . '.' . $extension; $request->file('photo')->storeAs('photo', $newName); }
- public disk = php artisan storage:link
- to show
php artisan make:model Role $ php artisan make:migration add_role_id_column_to_users_table;