
* #118 - wip * #118 - keys * #118 - fix * #118 - fix menu * #118 - fix to policies and added translations * #118 - wip * #118 - tests * #118 - fix * #118 - fix * #118 - fix * Update resources/lang/pl.json Co-authored-by: Ewelina Lasowy <56546832+EwelinaLasowy@users.noreply.github.com> * #118 - cr fix Co-authored-by: EwelinaLasowy <ewelina.lasowy@blumilk.pl> Co-authored-by: Ewelina Lasowy <56546832+EwelinaLasowy@users.noreply.github.com>
26 lines
622 B
PHP
26 lines
622 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Toby\Infrastructure\Http\Resources;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class KeyResource extends JsonResource
|
|
{
|
|
public static $wrap = null;
|
|
|
|
public function toArray($request): array
|
|
{
|
|
return [
|
|
"id" => $this->id,
|
|
"user" => new SimpleUserResource($this->user),
|
|
"updatedAt" => $this->updated_at->toDisplayString(),
|
|
"can" => [
|
|
"give" => $request->user()->can("give", $this->resource),
|
|
"take" => !$this->user()->is($request->user()),
|
|
],
|
|
];
|
|
}
|
|
}
|