Changes
This commit is contained in:
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Jobs\ImportUsers;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
|
class TransferUsers extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'import:transfer-users';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Command description';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
ImportUsers::dispatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ use App\Filament\Resources\UserResource\RelationManagers;
|
|||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use BezhanSalleh\FilamentShield\Contracts\HasShieldPermissions;
|
use BezhanSalleh\FilamentShield\Contracts\HasShieldPermissions;
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
|
use Filament\Forms\Components\Section;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
@@ -31,33 +32,46 @@ class UserResource extends Resource implements HasShieldPermissions
|
|||||||
{
|
{
|
||||||
return $form
|
return $form
|
||||||
->schema([
|
->schema([
|
||||||
Forms\Components\TextInput::make('name')
|
Section::make()->schema([
|
||||||
->required()
|
Forms\Components\Grid::make()->schema([
|
||||||
->maxLength(255)
|
Forms\Components\TextInput::make('name')
|
||||||
->live(onBlur: true),
|
->label('ФИО')
|
||||||
Forms\Components\TextInput::make('email')
|
->required()
|
||||||
->email()
|
->maxLength(255)
|
||||||
->required()
|
->live(onBlur: true),
|
||||||
->maxLength(255),
|
Forms\Components\TextInput::make('email')
|
||||||
Forms\Components\DateTimePicker::make('email_verified_at'),
|
->label('Email')
|
||||||
|
->email()
|
||||||
|
->required()
|
||||||
|
->unique(ignoreRecord: true)
|
||||||
|
->maxLength(255),
|
||||||
|
Forms\Components\DateTimePicker::make('email_verified_at')->label('Почта подтверждена'),
|
||||||
|
|
||||||
Forms\Components\TextInput::make('password')
|
Forms\Components\TextInput::make('password')
|
||||||
->password()
|
->label('Пароль')
|
||||||
->required(fn (string $context): bool => $context === 'create')
|
->password()
|
||||||
->dehydrated(fn ($state) => filled($state))
|
->default(Str::password(15))
|
||||||
->maxLength(255),
|
->required(fn (string $context): bool => $context === 'create')
|
||||||
|
->dehydrated(fn ($state) => filled($state))
|
||||||
|
->maxLength(255),
|
||||||
|
Forms\Components\Select::make('roles')
|
||||||
|
->label('Роль')
|
||||||
|
->relationship('roles', 'name')
|
||||||
|
->multiple()
|
||||||
|
->preload()
|
||||||
|
->searchable(),
|
||||||
|
|
||||||
Forms\Components\Select::make('roles')
|
Forms\Components\Select::make('permissions')
|
||||||
->relationship('roles', 'name')
|
->label('Разрешения')
|
||||||
->multiple()
|
->relationship('permissions', 'name')
|
||||||
->preload()
|
->multiple()
|
||||||
->searchable(),
|
->preload()
|
||||||
|
->searchable()
|
||||||
|
]),
|
||||||
|
|
||||||
Forms\Components\Select::make('permissions')
|
|
||||||
->relationship('permissions', 'name')
|
|
||||||
->multiple()
|
]),
|
||||||
->preload()
|
|
||||||
->searchable()
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ class ClientFacultyController extends Controller
|
|||||||
public function show(string $slug)
|
public function show(string $slug)
|
||||||
{
|
{
|
||||||
$faculties = FacultyResource::collection(Faculty::query()->where('is_active', true)->get());
|
$faculties = FacultyResource::collection(Faculty::query()->where('is_active', true)->get());
|
||||||
$faculty = new FullFacultyResource(Faculty::where('slug', $slug)->where('is_active', true)->with(['departments.faculty', 'workers.userDetail'])->first());
|
$faculty = new FullFacultyResource(Faculty::where('slug', $slug)->where('is_active', true)->with(['departments.faculty', 'workers.userDetail'])->firstOrFail());
|
||||||
$seo = $faculty->seo;
|
$seo = $faculty->seo ?? null;
|
||||||
return Inertia::render('Client/Faculties/Show', compact('faculty', 'faculties', 'seo'));
|
return Inertia::render('Client/Faculties/Show', compact('faculty', 'faculties', 'seo'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Jobs;
|
||||||
|
|
||||||
|
use App\Models\Post;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class ImportUsers implements ShouldQueue
|
||||||
|
{
|
||||||
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new job instance.
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the job.
|
||||||
|
*/
|
||||||
|
public function handle(): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$response = Http::get('http://crawdad-fresh-bream.ngrok-free.app/api/import/users/')->object();
|
||||||
|
foreach ($response as $user) {
|
||||||
|
$userDetail = $user->user_detail;
|
||||||
|
unset($user->user_detail);
|
||||||
|
$user = User::create([
|
||||||
|
'name' => $user->name,
|
||||||
|
'slug' => $user->slug,
|
||||||
|
'email' => $user->email,
|
||||||
|
'email_verified_at' => $user->email_verified_at,
|
||||||
|
'password' => $user->password,
|
||||||
|
'two_factor_secret' => $user->two_factor_secret,
|
||||||
|
'two_factor_recovery_codes' => $user->two_factor_recovery_codes,
|
||||||
|
'two_factor_confirmed_at' => $user->two_factor_confirmed_at,
|
||||||
|
'remember_token' => $user->remember_token,
|
||||||
|
'created_at' => $user->created_at,
|
||||||
|
'updated_at' => $user->updated_at,
|
||||||
|
]);
|
||||||
|
$user->userDetail()->create([
|
||||||
|
'user_id' => $user->id,
|
||||||
|
'is_only_worker' => $userDetail->is_only_worker,
|
||||||
|
'photo' => $userDetail->photo,
|
||||||
|
'academicTitle' => $userDetail->academicTitle,
|
||||||
|
'AcademicDegree' => $userDetail->AcademicDegree,
|
||||||
|
'education' => $userDetail->education,
|
||||||
|
'awards' => $userDetail->awards,
|
||||||
|
'professDisciplines' => $userDetail->professDisciplines,
|
||||||
|
'professionalRetraining' => $userDetail->professionalRetraining,
|
||||||
|
'professionalDevelopment' => $userDetail->professionalDevelopment,
|
||||||
|
'workExperience' => $userDetail->workExperience,
|
||||||
|
'attendedConferences' => $userDetail->attendedConferences,
|
||||||
|
'participationScienceProjects' => $userDetail->participationScienceProjects,
|
||||||
|
'publications' => $userDetail->publications,
|
||||||
|
'contactEmail' => $userDetail->contactEmail,
|
||||||
|
'contactPhone' => $userDetail->contactPhone,
|
||||||
|
'search_data' => $userDetail->search_data,
|
||||||
|
'other' => $userDetail->other,
|
||||||
|
'created_at' => $userDetail->created_at,
|
||||||
|
'updated_at' => $userDetail->updated_at,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error('Error fetching posts: ' . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,9 +9,6 @@ export default defineConfig({
|
|||||||
plugins: [
|
plugins: [
|
||||||
laravel({
|
laravel({
|
||||||
input: 'resources/js/app.js',
|
input: 'resources/js/app.js',
|
||||||
content: [
|
|
||||||
"./vendor/vormkracht10/filament-2fa/resources/**.*.blade.php",
|
|
||||||
],
|
|
||||||
ssr: 'resources/js/ssr.js',
|
ssr: 'resources/js/ssr.js',
|
||||||
refresh: true,
|
refresh: true,
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user