Update dependencies and enhance components
- Added "halaxa/json-machine" dependency to composer.json. - Updated content hash in composer.lock to reflect changes. - Improved SpatieMediaLibraryFileEntry component documentation. - Expanded FillJsonData seeder to include new migrators for card types, orders, and pin orders. - Updated Tailwind CSS version in app.css. - Refactored various JavaScript components for better performance and readability. - Added a test route in web.php for debugging purpose
This commit is contained in:
53
database/seeders/Migrators/UsersMigrator.php
Normal file
53
database/seeders/Migrators/UsersMigrator.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders\Migrators;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class UsersMigrator
|
||||
{
|
||||
public function migrate(): void
|
||||
{
|
||||
DB::table('users')->truncate();
|
||||
|
||||
$path = database_path('data/nurmuhammetsdb/users.json');
|
||||
|
||||
$data = File::json($path);
|
||||
|
||||
foreach ($data as $user) {
|
||||
DB::table('users')
|
||||
->insert([
|
||||
'id' => $user['id'],
|
||||
'name' => $user['name'],
|
||||
'email' => $user['email'],
|
||||
'email_verified_at' => $user['email_verified_at'],
|
||||
'password' => $user['password'],
|
||||
'remember_token' => $user['remember_token'],
|
||||
'created_at' => $user['created_at'],
|
||||
'updated_at' => $user['updated_at'],
|
||||
'username' => $user['username'],
|
||||
'first_name' => $this->extractFirstName($user['name']),
|
||||
'last_name' => $this->extractLastName($user['name']),
|
||||
'phone' => $user['phone'],
|
||||
'phone_verified_at' => $user['phone_verified_at'],
|
||||
'locale' => $user['locale'],
|
||||
'password_must_be_changed' => $user['password_must_be_changed'],
|
||||
'options' => $user['options'],
|
||||
'must_fill_profile' => false,
|
||||
'custom_fields' => null,
|
||||
'active' => $user['active'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
protected function extractFirstName(string $name): string
|
||||
{
|
||||
return explode(' ', $name)[0] ?? '';
|
||||
}
|
||||
|
||||
protected function extractLastName(string $name): string
|
||||
{
|
||||
return explode(' ', $name)[1] ?? '';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user