- Included `laravel/sanctum` in `composer.json` for lightweight API authentication. - Updated `User` model to use `HasApiTokens` trait for token management. - Configured API routing in `bootstrap/app.php`. - Modified `DatabaseSeeder` to include `ShieldSeeder` and adjusted `FillJsonData` seeder method. - Changed JSON data path in `ProvincesMigrator` for testing purposes. - Updated web routes to utilize `MigrationController` for better organization.
26 lines
702 B
PHP
26 lines
702 B
PHP
<?php
|
|
|
|
namespace Database\Seeders\Migrators;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\File;
|
|
|
|
class PersonalAccessTokensMigrator
|
|
{
|
|
public function migrate(): void
|
|
{
|
|
DB::table('personal_access_tokens')->truncate();
|
|
|
|
$path = database_path('data/tested/personal_access_tokens.json');
|
|
|
|
$rawData = File::json($path);
|
|
|
|
foreach ($rawData as $data) {
|
|
DB::table('personal_access_tokens')
|
|
->insert($data);
|
|
}
|
|
|
|
DB::statement("SELECT setval('personal_access_tokens_id_seq', (SELECT MAX(id) from personal_access_tokens));");
|
|
DB::statement("SELECT nextval('personal_access_tokens_id_seq');");
|
|
}
|
|
} |