feat: ✨ Aggiunti campi POST a `UserRepository`
This commit is contained in:
parent
e151c0a67c
commit
901bc12b18
|
@ -4,6 +4,7 @@ namespace App\Restify;
|
|||
|
||||
use App\Models\User;
|
||||
use Binaryk\LaravelRestify\Http\Requests\RestifyRequest;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class UserRepository extends Repository
|
||||
{
|
||||
|
@ -25,4 +26,14 @@ class UserRepository extends Repository
|
|||
field('updated_at')->label('updatedAt')->readonly(),
|
||||
];
|
||||
}
|
||||
|
||||
public function fieldsForStore(RestifyRequest $request): array
|
||||
{
|
||||
return [
|
||||
...$this->fields($request),
|
||||
field('password')
|
||||
->rules('required')
|
||||
->storeCallback(static fn (string $value) => Hash::make($value)),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue