Completed
Push — master ( 9dc7e5...d49645 )
by Manel
02:33
created

EnrollmentCreateRequest::forbiddenResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
ccs 0
cts 4
cp 0
rs 9.4285
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Scool\EnrollmentMobile\Http\Requests;
4
5
use GuzzleHttp\Psr7\Response;
6
use Illuminate\Foundation\Http\FormRequest;
7
use Illuminate\Support\Facades\Auth;
8
9
/**
10
 * Class EnrollmentCreateRequest
11
 * @package Scool\EnrollmentMobile\Http\Requests
12
 */
13
class EnrollmentCreateRequest 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
        return Auth::user()->can('create enrollments');
23
        //return false; //Per defecte
24
25
        //De moment true
0 ignored issues
show
Unused Code Comprehensibility introduced by
53% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
26
//if (auth:user()->can('update enrollments')) {
27
        //}
28
        //return false;
29
        //TODO: crear requests de show, delete... crear permissos amb un seed. (create writter(BREAD(Browse,Read...)). Crear rol manage per donar-li tots els anteriors.
30
    }
31
32
    public function forbiddenResponse()
33
    {
34
35
        return Response::make('Permission denied on create enrollment', 403);
36
    }
37
38
    /**
39
     * Get the validation rules that apply to the request.
40
     *
41
     * @return array
42
     */
43
    public function rules()
44
    {
45
        return [
46
            'name' => 'required|min:5|max:30'
47
        ];
48
    }
49
}
50