feat: add ApiResponse trait for standardized API responses
chore: update composer dependencies to include phppresentation chore: update composer.lock after adding phppresentation feat: create categories migration for category management feat: create templates migration for template storage feat: create template generations migration for tracking template usage feat: create template keys migration for template customization feat: create notifications migration for user notifications feat: update API routes for categories, templates, and user profile management docs: update API documentation to include new endpoints for profile and wallet
This commit is contained in:
34
app/Http/Resources/CategoryResource.php
Normal file
34
app/Http/Resources/CategoryResource.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\Category;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use OpenApi\Attributes as OA;
|
||||
|
||||
#[OA\Schema(
|
||||
schema: 'Category',
|
||||
properties: [
|
||||
new OA\Property(property: 'id', type: 'integer', example: 1),
|
||||
new OA\Property(property: 'name', type: 'string', example: 'کسبوکار'),
|
||||
new OA\Property(property: 'slug', type: 'string', example: 'business'),
|
||||
new OA\Property(property: 'description', type: 'string', example: 'قالبهای ارائه کسبوکار', nullable: true),
|
||||
]
|
||||
)]
|
||||
/** @mixin Category */
|
||||
class CategoryResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'slug' => $this->slug,
|
||||
'description' => $this->description,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user