v2 first commit

This commit is contained in:
denisdulici
2019-11-16 10:21:14 +03:00
parent 5b23e9c2c4
commit 6d50fa8442
3075 changed files with 3451681 additions and 65594 deletions

View 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',
];
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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,
];
}
}