add all controllers logic

This commit is contained in:
root
2026-03-11 17:53:15 -04:00
parent 3e6c577085
commit 2ef71cc92b
421 changed files with 12009 additions and 5211 deletions
@@ -0,0 +1,27 @@
<?php
namespace App\Http\Resources\Preferences;
use Illuminate\Http\Resources\Json\ResourceCollection;
class PreferencesCollection extends ResourceCollection
{
public $collects = PreferencesListResource::class;
public function toArray($request): array
{
return parent::toArray($request);
}
public function with($request): array
{
return [
'meta' => [
'total' => $this->resource->total() ?? null,
'per_page' => $this->resource->perPage() ?? null,
'current_page' => $this->resource->currentPage() ?? null,
'last_page' => $this->resource->lastPage() ?? null,
],
];
}
}
@@ -0,0 +1,28 @@
<?php
namespace App\Http\Resources\Preferences;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class PreferencesListResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->resource->id ?? null,
'user_id' => $this->resource->user_id ?? null,
'firstname' => $this->resource->firstname ?? null,
'lastname' => $this->resource->lastname ?? null,
'email' => $this->resource->email ?? null,
'receive_email_notifications' => (bool) ($this->resource->notification_email ?? false),
'receive_sms_notifications' => (bool) ($this->resource->notification_sms ?? false),
'theme' => $this->resource->theme ?? null,
'language' => $this->resource->language ?? null,
'style_color' => $this->resource->style_color ?? null,
'menu_color' => $this->resource->menu_color ?? null,
'created_at' => $this->resource->created_at ?? null,
'updated_at' => $this->resource->updated_at ?? null,
];
}
}
@@ -0,0 +1,21 @@
<?php
namespace App\Http\Resources\Preferences;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class PreferencesResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'receive_email_notifications' => $this->resource['receive_email_notifications'] ?? false,
'receive_sms_notifications' => $this->resource['receive_sms_notifications'] ?? false,
'theme' => $this->resource['theme'] ?? null,
'language' => $this->resource['language'] ?? null,
'style_color' => $this->resource['style_color'] ?? null,
'menu_color' => $this->resource['menu_color'] ?? null,
];
}
}