Completed
Push — develop-3.0 ( 5ab583...f20237 )
by Mohamed
06:33
created

AuthServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 30
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A boot() 0 7 1
1
<?php
2
3
/*
4
 * This file is part of the Tinyissue package.
5
 *
6
 * (c) Mohamed Alsharaf <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Tinyissue\Providers;
13
14
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
15
use Illuminate\Support\Facades\Gate;
16
use Tinyissue\Model\Project;
17
use Tinyissue\Model\Tag;
18
use Tinyissue\Model\User;
19
use Tinyissue\Policies\AdminPolicy;
20
use Tinyissue\Policies\AttachmentPolicy;
21
use Tinyissue\Policies\CommentPolicy;
22
use Tinyissue\Policies\IssuePolicy;
23
use Tinyissue\Policies\NotePolicy;
24
use Tinyissue\Policies\ProjectPolicy;
25
use Tinyissue\Policies\TagPolicy;
26
use Tinyissue\Policies\UserPolicy;
27
28
/**
29
 * AuthServiceProvider.
30
 *
31
 * @author Mohamed Alsharaf <[email protected]>
32
 */
33
class AuthServiceProvider extends ServiceProvider
34
{
35
    /**
36
     * The policy mappings for the application.
37
     *
38
     * @var array
39
     */
40
    protected $policies = [
41
        Project::class                  => ProjectPolicy::class,
42
        User::class                     => UserPolicy::class,
43
        Tag::class                      => TagPolicy::class,
44
        Project\Issue::class            => IssuePolicy::class,
45
        Project\Note::class             => NotePolicy::class,
46
        Project\Issue\Comment::class    => CommentPolicy::class,
47
        Project\Issue\Attachment::class => AttachmentPolicy::class,
48
    ];
49
50
    /**
51
     * Register any authentication / authorization services.
52
     *
53
     * @return void
54
     */
55
    public function boot()
56
    {
57
        $this->registerPolicies();
58
59
        Gate::define('manage-admin', AdminPolicy::class . '@manage');
60
        Gate::define('viewName', UserPolicy::class . '@viewName');
61
    }
62
}
63