%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/camillo/camillo-api-master/app/Http/Resources/
Upload File :
Create Path :
Current File : /var/www/html/camillo/camillo-api-master/app/Http/Resources/ClassroomResource.php

<?php

namespace App\Http\Resources;

use Carbon\Carbon;
use Illuminate\Http\Resources\Json\JsonResource;

class ClassroomResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            "id"=> $this->id,
            "institute_id"  => $this->institute->id,
            "institue_name" => $this->institute->name,
            "schoolyear_id" => $this->schoolyear->id,
            "schoolyear"    => $this->schoolyear->description,
            "class_name"    => $this->class_name,
            "arrival_time"  => Carbon::parse($this->arrival_time)->format("H:i"),
            "leaving_time"  => Carbon::parse($this->leaving_time)->format("H:i"),
            "mon"           => $this->mon,
            "tue"           => $this->tue,
            "wed"           => $this->wed,
            "thu"           => $this->thu,
            "fri"           => $this->fri,
            "sat"           => $this->sat,
            "sun"           => $this->sun,
            "total_children"=> $this->minors->where('active', true)->count(),
            "created_at"    => $this->created_at->format("d-m-Y H:i:s"),
            "updated_at"    => $this->updated_at->format("d-m-Y H:i:s")
        ];
    }
}

Zerion Mini Shell 1.0