v2 first commit
This commit is contained in:
41
app/Http/Requests/Portal/Profile.php
Normal file
41
app/Http/Requests/Portal/Profile.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Portal;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class Profile extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$id = user()->getAttribute('id');
|
||||
|
||||
$picture = 'nullable';
|
||||
|
||||
if ($this->request->get('picture', null)) {
|
||||
$picture = 'mimes:' . config('filesystems.mimes') . '|between:0,' . config('filesystems.max_size') * 1024;
|
||||
}
|
||||
|
||||
return [
|
||||
'name' => 'required|string',
|
||||
'email' => 'required|email|unique:users,email,' . $id . ',id,deleted_at,NULL',
|
||||
'password' => 'confirmed',
|
||||
'picture' => $picture,
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user