SendInvitationRequest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 27
rs 10
wmc 4
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A authorize() 0 7 3
A rules() 0 6 1
1
<?php
2
3
namespace Acacha\Users\Http\Requests;
4
5
use Auth;
6
use Illuminate\Foundation\Http\FormRequest;
7
8
/**
9
 * Class SendInvitationRequest.
10
 *
11
 * @package Acacha\Users\Http\Requests
12
 */
13
class SendInvitationRequest extends FormRequest
14
{
15
    /**
16
     * Determine if the user is authorized to make this request.
17
     *
18
     * @return bool
19
     */
20
    public function authorize()
21
    {
22
23
        if (config('users.users_can_invite_other_users')) return true;
24
        if (Auth::user()) return Auth::user()->can('send-user-invitations');
25
        return false;
26
    }
27
28
    /**
29
     * Get the validation rules that apply to the request.
30
     *
31
     * @return array
32
     */
33
    public function rules()
34
    {
35
        return [
36
            'email' => 'required|email|max:255|unique:users',
37
        ];
38
    }
39
}
40