v2 first commit
This commit is contained in:
31
app/Http/Requests/Auth/Login.php
Normal file
31
app/Http/Requests/Auth/Login.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Auth;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class Login 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()
|
||||
{
|
||||
return [
|
||||
'email' => 'required|email',
|
||||
'password' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
@ -25,7 +25,7 @@ class Permission extends FormRequest
|
||||
{
|
||||
// Check if store or update
|
||||
if ($this->getMethod() == 'PATCH') {
|
||||
$id = $this->permission->getAttribute('id');
|
||||
$id = is_numeric($this->permission) ? $this->permission : $this->permission->getAttribute('id');
|
||||
} else {
|
||||
$id = null;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class Role extends FormRequest
|
||||
{
|
||||
// Check if store or update
|
||||
if ($this->getMethod() == 'PATCH') {
|
||||
$id = $this->role->getAttribute('id');
|
||||
$id = is_numeric($this->role) ? $this->role : $this->role->getAttribute('id');
|
||||
} else {
|
||||
$id = null;
|
||||
}
|
||||
|
@ -23,9 +23,15 @@ class User extends FormRequest
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$picture = 'nullable';
|
||||
|
||||
if ($this->request->get('picture', null)) {
|
||||
$picture = 'mimes:' . config('filesystems.mimes') . '|between:0,' . config('filesystems.max_size') * 1024;
|
||||
}
|
||||
|
||||
// Check if store or update
|
||||
if ($this->getMethod() == 'PATCH') {
|
||||
$id = $this->user->getAttribute('id');
|
||||
$id = is_numeric($this->user) ? $this->user : $this->user->getAttribute('id');
|
||||
$required = '';
|
||||
} else {
|
||||
$id = null;
|
||||
@ -38,7 +44,7 @@ class User extends FormRequest
|
||||
'password' => $required . 'confirmed',
|
||||
'companies' => 'required',
|
||||
'roles' => 'required',
|
||||
'picture' => 'mimes:' . setting('general.file_types') . '|between:0,' . setting('general.file_size') * 1024,
|
||||
'picture' => $picture,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user