Completed
Push — master ( 8105e1...29833d )
by Manel
02:50
created

CourseCreateRequest::forbiddenResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Scool\EnrollmentMobile\Http\Requests;
4
5
use Auth;
6
use Illuminate\Foundation\Http\FormRequest;
7
use Response;
8
9
class CourseCreateRequest extends FormRequest
10
{
11
    /**
12
     * Determine if the user is authorized to make this request.
13
     *
14
     * @return bool
15
     */
16
    public function authorize()
17
    {
18
      return Auth::user()->can('edit courses');
19
    }
20
21
    /**
22
     * Get the validation rules that apply to the request.
23
     *
24
     * @return array
25
     */
26
    public function rules()
27
    {
28
        return [
29
            //
30
        ];
31
    }
32
33
    public function forbiddenResponse()
34
    {
35
      return Response::make('Permission denied on creating courses', 403);
36
    }
37
}
38