KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.41 (Ubuntu)
System : Linux vmi1525618.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64
User : www-data ( 33)
PHP Version : 8.2.12
Disable Function : NONE
Directory :  /var/www/lecturebazaar.com/app/Http/Resources/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/lecturebazaar.com/app/Http/Resources/WebinarAssignmentHistoryResource.php
<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class WebinarAssignmentHistoryResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param \Illuminate\Http\Request $request
     * @return array
     */
    public $student_details = false;

    public function toArray($request)
    {

        return [
            'id' => $this->assignment->id,
            'title' => $this->assignment->title,
            'deadline' => $this->deadlineDays(),
            $this->mergeWhen($this->student_details, [
                'student' => $this->student->id
            ]),
            'student' => [
                'id' => $this->student->id,
                'full_name' => $this->student->full_name,
                'email'=>$this->student->email ,
                'avatar' => $this->student->getAvatar() ? url($this->student->getAvatar()) : null,

            ],
//deadline_time
            $this->mergeWhen($this->student_id == apiAuth()->id, [
                'deadline_time' => ($this->student_id == apiAuth()->id) ? $this->assignment->deadlineTime : null
            ]),

            'can' => [
                'send_message' => $this->canSendMessage()
            ],
            'can_view_error' => $this->assignment->canViewError(),
            'description' => $this->assignment->description,
            'webinar_title' => $this->assignment->webinar->title,
            'webinar_image' => url($this->assignment->webinar->getImage()),
            'first_submission' => $this->first_submission ?? null,
            'last_submission' => $this->last_submission ?? null,
            'attempts' => $this->assignment->attempts ?? null,
            'used_attempts_count' => $this->used_attempts_count ?? 0,
            'grade' => $this->grade ?? null,
            'total_grade' => $this->assignment->grade,
            'pass_grade' => $this->assignment->pass_grade ?? null,
            'purchase_date' => $this->sale() ? $this->sale()->created_at : null,
            'user_status' => $this->status,
            'attachments' => $this->assignment->attachments->map(function ($item) {
                return [
                    'url' => $item->attach ? url($item->attach) : null,
                    'title' => $item->title,
                    'size' => $item->getFileSize(),

                ];
            })
        ];
    }
}

Anon7 - 2021