24 lines
554 B
PHP
24 lines
554 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Resources\Api\V1;
|
||
|
|
|
||
|
|
use App\Models\Cours;
|
||
|
|
use Illuminate\Http\Request;
|
||
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||
|
|
|
||
|
|
/** @mixin Cours */
|
||
|
|
class CoursResource extends JsonResource
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* @return array<string, mixed>
|
||
|
|
*/
|
||
|
|
public function toArray(Request $request): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'identifiant' => $this->identifiant,
|
||
|
|
'titre' => $this->titre,
|
||
|
|
'contenu_markdown' => $this->when($request->routeIs('api.v1.cours.show'), $this->contenu_markdown),
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|