inti project
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Resources\V2\Communication;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
final class MessageResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
$value = $this->resource;
|
||||
if (is_array($value)) {
|
||||
return $value;
|
||||
}
|
||||
if (is_object($value) && method_exists($value, 'toArray')) {
|
||||
return $value->toArray();
|
||||
}
|
||||
if (is_object($value)) {
|
||||
return get_object_vars($value);
|
||||
}
|
||||
return ['value' => $value];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Resources\V2\Communication;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
final class RecipientPreviewResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
$value = $this->resource;
|
||||
if (is_array($value)) {
|
||||
return $value;
|
||||
}
|
||||
if (is_object($value) && method_exists($value, 'toArray')) {
|
||||
return $value->toArray();
|
||||
}
|
||||
if (is_object($value)) {
|
||||
return get_object_vars($value);
|
||||
}
|
||||
return ['value' => $value];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user