Issues (210)

src/Http/Requests/ProfileRequest.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Pratiksh\Adminetic\Http\Requests;
4
5
use Illuminate\Foundation\Http\FormRequest;
6
use Illuminate\Support\Facades\Auth;
7
8
class ProfileRequest extends FormRequest
9
{
10
    /**
11
     * Determine if the user is authorized to make this request.
12
     *
13
     * @return bool
14
     */
15
    public function authorize()
16
    {
17
        return Auth::user()->id == $this->profile->id;
0 ignored issues
show
Accessing id on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
18
    }
19
20
    /**
21
     * Get the validation rules that apply to the request.
22
     *
23
     * @return array
24
     */
25
    public function rules()
26
    {
27
        return [
28
            'user_id' => 'required|numeric',
29
            'username' => 'sometimes|max:100',
30
            'profile_pic' => 'sometimes|file|image|max:5000',
31
            'status' => 'sometimes|numeric|max:10',
32
            'gender' => 'sometimes|numeric|max:3',
33
            'martial_status' => 'sometimes|numeric|max:8',
34
            'blood_group' => 'sometimes|numeric|max:15',
35
            'country' => 'sometimes|max:50',
36
            'address' => 'sometimes|max:255',
37
            'phone_no' => 'sometimes|max:10',
38
            'email' => 'sometimes|max:255',
39
            'birthday' => 'sometimes|sometimes',
40
            'facebook' => 'sometimes|max:255',
41
            'instagram' => 'sometimes|max:255',
42
            'twitter' => 'sometimes|max:255',
43
            'linkedin' => 'sometimes|max:255',
44
            'father_name' => 'sometimes|max:255',
45
            'mother_name' => 'sometimes|max:255',
46
        ];
47
    }
48
}
49