1, 'barbershop_id' => 1, 'username' => 'yoga', 'email' => 'yoga@developer.com', 'password' => Hash::make(env('PASSWORD_DEFAULT_USER')), 'entry_date' => now(), ]); Biography::create([ 'user_id' => $newUser->id, 'full_name' => 'Yoga Pangestu', 'pob' => 'Subang', 'dob' => '2000-01-01', 'contact_number' => '082121495806', 'address' => 'Jl.Babaru Nagri', 'gender' => '1', ]); $imagePath = public_path('assets/admin/images/avatar/speed.jpeg'); if (file_exists($imagePath)) { $file = new \Symfony\Component\HttpFoundation\File\File($imagePath); $fileName = Str::uuid(); Attachment::create([ 'attachmentable_id' => $newUser->id, 'attachmentable_type' => User::class, 'name' => $fileName, 'extension' => $file->getExtension(), 'size' => $file->getSize(), ]); $path = 'users/'.now()->format('Y-m-d'); Storage::disk('public')->putFileAs($path, $file, $fileName.'.'.$file->getExtension()); } }); } }