Skip to content

Commit

Permalink
Update StudentPermissionResource.php
Browse files Browse the repository at this point in the history
  • Loading branch information
farahamaliaa committed Dec 4, 2024
1 parent 1f7174a commit 672c9a4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/Http/Resources/StudentPermissionResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Facades\Storage;

class StudentPermissionResource extends JsonResource
{
Expand All @@ -21,7 +22,7 @@ public function toArray(Request $request): array
'class' => $this->model->classroom->name,
'date' => $this->created_at,
'status' => $this->status->label(),
'proof' => $this->proof != null ? asset(request()->root(). '/storage/'.$this->proof) : asset(request()->root(). '/public/admin_assets/dist/images/profile/user-1.jpg'),
'proof' => $this->proof != null && Storage::exists(request()->root(). '/storage/'.$this->proof) ? asset(request()->root(). '/storage/'.$this->proof) : asset(request()->root(). '/public/admin_assets/dist/images/empty/no-data.png'),
];
}
}

0 comments on commit 672c9a4

Please sign in to comment.