Code Duplication    Length = 26-28 lines in 3 locations

src/Http/Requests/DestroyArticle.php 1 location

@@ 13-38 (lines=26) @@
10
 *
11
 * @package App\Http\Requests
12
 */
13
class DestroyArticle extends FormRequest
14
{
15
    use ChecksPermissions;
16
17
    /**
18
     * Determine if the user is authorized to make this request.
19
     *
20
     * @return bool
21
     */
22
    public function authorize()
23
    {
24
        if ($this->hasPermissionTo('destroy-article')) return true;
25
        if ($this->owns('article')) return true;
26
        return false;
27
    }
28
29
    /**
30
     * Get the validation rules that apply to the request.
31
     *
32
     * @return array
33
     */
34
    public function rules()
35
    {
36
        return [];
37
    }
38
}
39

src/Http/Requests/ShowArticle.php 1 location

@@ 13-38 (lines=26) @@
10
 *
11
 * @package App\Http\Requests
12
 */
13
class ShowArticle extends FormRequest
14
{
15
    use ChecksPermissions;
16
17
    /**
18
     * Determine if the user is authorized to make this request.
19
     *
20
     * @return bool
21
     */
22
    public function authorize()
23
    {
24
        if ($this->hasPermissionTo('show-article')) return true;
25
        if ($this->owns('article')) return true;
26
        return false;
27
    }
28
29
    /**
30
     * Get the validation rules that apply to the request.
31
     *
32
     * @return array
33
     */
34
    public function rules()
35
    {
36
        return [];
37
    }
38
}
39

src/Http/Requests/UpdateArticle.php 1 location

@@ 13-40 (lines=28) @@
10
 *
11
 * @package App\Http\Requests
12
 */
13
class UpdateArticle extends FormRequest
14
{
15
    use ChecksPermissions;
16
17
    /**
18
     * Determine if the user is authorized to make this request.
19
     *
20
     * @return bool
21
     */
22
    public function authorize()
23
    {
24
        if ($this->hasPermissionTo('update-article')) return true;
25
        if ($this->owns('article')) return true;
26
        return false;
27
    }
28
29
    /**
30
     * Get the validation rules that apply to the request.
31
     *
32
     * @return array
33
     */
34
    public function rules()
35
    {
36
        return [
37
            'name' => 'required'
38
        ];
39
    }
40
}
41