salma
salma
FFilament
Created by salma on 12/19/2023 in #❓┊help
How to implements repeater inside repeater
i have ExamResource i want to enable the user to enter the exam name and then enter the question content as repeater and inside the question content i want to use answers repeater, btw i have one to many relation between exam and questions and one to many between question and answers
2 replies
FFilament
Created by salma on 10/2/2023 in #❓┊help
get the id in the relation manager
i have this function in my status resurce relation manager protected static function getCandidateOptions() { // Assuming you have access to the currently logged-in user $loggedInUser = Auth::user(); if (!$loggedInUser) { return []; } $company = $loggedInUser->company; if (!$company) { return []; } $jobs = $company->jobs; $options = []; foreach ($jobs as $job) {
$jobApplications = $job->jobapplications; foreach ($jobApplications as $jobApplication) { $candidate = $jobApplication->candidate; if ($candidate) { $user = $candidate->user; if ($user) { $options[$jobApplication->id] = $user->name; } } } } return $options; } i have relation like this status->jobapplicatoin->job->id to get the jobId how can i access the jobId dynamicly like when i view the job and go to status, i can see the the status only for this job
2 replies
FFilament
Created by salma on 8/10/2023 in #❓┊help
export
how to enable users edit just there replays in relation manager ? like if i have ticket resources has one to many relation with replays i want to enable each user to edit just his replays and see the other replays
4 replies
FFilament
Created by salma on 8/3/2023 in #❓┊help
download file from view page
i have column in the resource that enable users to download the uploaded files from it, i want also to enable users to download it from the view page here is my code in the model : protected $casts = ['file'=> 'array']; public function getFileAttribute($value) { if (empty($value) || is_null($value)) { return "No file"; }
$file = explode(',', $value); $url = rtrim(env('APP_URL'), '/'); // Get the URL from the .env file and remove trailing slash $forReturn = [];
foreach ($file as $val) { $val = trim($val, '[]"'); $val = ltrim($val, '/'); if (!empty($val)) { array_push($forReturn, "<a href='{$url}/storage/{$val}'>Download</a>"); } }
if (empty($forReturn)) { return "No file"; }
return $forReturn; } and this from the form resource : FileUpload::make('file') ->acceptedFileTypes(['image/*','application/pdf','application/vnd.openxmlformats-officedocument.wordprocessingml.document','application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']) ->directory('tickets')->multiple(), this from the table: Tables\Columns\TextColumn::make('file')->html(function ($record) { if (isset($record->file['tickets'])) { return html("{$record->file['tickets']}"); } else { return null; } }, true)->openUrlInNewTab(),
3 replies