Refactor Prop model to use enum for data types; remove PropDataType model and update related requests and migrations
This commit is contained in:
@@ -2,11 +2,13 @@
|
||||
|
||||
namespace App\Domains\Prop\Resources;
|
||||
|
||||
use App\Domains\Prop\Models\Prop;
|
||||
use App\Domains\Prop\Support\PropableModels;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin \App\Domains\Prop\Models\Prop
|
||||
* @mixin Prop
|
||||
*/
|
||||
class PropResource extends JsonResource
|
||||
{
|
||||
@@ -17,11 +19,11 @@ class PropResource extends JsonResource
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'propable_type' => $this->propable_type,
|
||||
'propable_type' => PropableModels::aliasFor($this->propable_type) ?? $this->propable_type,
|
||||
'codigo' => $this->codigo,
|
||||
'nombre' => $this->nombre,
|
||||
'is_required' => $this->is_required,
|
||||
'data_type_id' => $this->data_type_id,
|
||||
'data_type' => $this->data_type?->value,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user