update-client fixed

This commit is contained in:
ilmedova 2022-07-20 17:22:43 +05:00
parent 053384329f
commit a747536b80
3 changed files with 23 additions and 9 deletions

View File

@ -10,6 +10,7 @@
use App\Mail\ResetPassword;
use App\Models\Account;
use App\Models\Client;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
@ -552,14 +553,14 @@ public function updatePassword(Request $request) {
* @OA\Examples(example="en", value="en", summary="English localization"),
* @OA\Examples(example="tm", value="tm", summary="Turkmen localization"),
* ),
* @OA\Response(
* response="200",
* description="OK"
* )
* @OA\Response(response=201, description="Successful created", @OA\JsonContent()),
* @OA\Response(response=404, description="Not found", @OA\JsonContent()),
* )
*/
public function updateClient(UpdateClientRequest $request){
return $request->all();
$client = $request->user();
$data = $request->only('firstname', 'lastname', 'password');
@ -568,7 +569,7 @@ public function updateClient(UpdateClientRequest $request){
unset($data['password']);
}
else {
$data['password'] = bcrypt($data['password']);
$data['password'] = Hash::make($data['password']);
}
if($client->fill($data)->save()){

View File

@ -10,7 +10,7 @@ class UpdateClientRequest extends FormRequest
* Determine if the user is authorized to make this request.
*
* @return bool
*/
*/
public function authorize()
{
return true;
@ -20,7 +20,7 @@ public function authorize()
* Get the validation rules that apply to the request.
*
* @return array<string, mixed>
*/
*/
public function rules()
{
return [

View File

@ -660,8 +660,21 @@
}
},
"responses": {
"200": {
"description": "OK"
"201": {
"description": "Successful created",
"content": {
"application/json": {
"schema": {}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {}
}
}
}
},
"security": [