- add cv management
This commit is contained in:
17
app/Http/Resources/CVCollection.php
Normal file
17
app/Http/Resources/CVCollection.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
|
||||
class CVCollection extends ResourceCollection
|
||||
{
|
||||
public function toArray($request): array
|
||||
{
|
||||
return [
|
||||
'data' => $this->collection,
|
||||
];
|
||||
}
|
||||
}
|
17
app/Http/Resources/CVInfoCollection.php
Normal file
17
app/Http/Resources/CVInfoCollection.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
|
||||
class CVInfoCollection extends ResourceCollection
|
||||
{
|
||||
public function toArray($request): array
|
||||
{
|
||||
return [
|
||||
'data' => $this->collection,
|
||||
];
|
||||
}
|
||||
}
|
21
app/Http/Resources/CVInfoResource.php
Normal file
21
app/Http/Resources/CVInfoResource.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class CVInfoResource extends JsonResource
|
||||
{
|
||||
public static $wrap = null;
|
||||
|
||||
public function toArray($request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'ip' => $this->ip,
|
||||
'created_at' => $this->created_at->format('d-m-Y H:i:s'),
|
||||
];
|
||||
}
|
||||
}
|
17
app/Http/Resources/FullCVCollection.php
Normal file
17
app/Http/Resources/FullCVCollection.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
|
||||
class FullCVCollection extends ResourceCollection
|
||||
{
|
||||
public function toArray($request): array
|
||||
{
|
||||
return [
|
||||
'data' => $this->collection,
|
||||
];
|
||||
}
|
||||
}
|
29
app/Http/Resources/FullCVResource.php
Normal file
29
app/Http/Resources/FullCVResource.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class FullCVResource extends JsonResource
|
||||
{
|
||||
public static $wrap = null;
|
||||
|
||||
public function toArray($request = null): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'token' => $this->token,
|
||||
'email' => $this->email,
|
||||
'recipient' => $this->recipient,
|
||||
'phone' => new PhoneResource($this->resource),
|
||||
'locations' => $this->locations,
|
||||
'views' => $this->resource->info()->select('id')->get()->count(),
|
||||
'registeredViews' => $this->views,
|
||||
'mission' => explode(PHP_EOL, $this->mission ?? '', 5),
|
||||
'rodo' => $this->rodo,
|
||||
'position' => $this->position,
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user