Completed
Push — master ( f8f9db...e576f5 )
by Ricardo
01:19
created

AsHuman::setSkill()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Telefonica\Traits;
4
5
use Log;
6
7
use Informate\Models\Tag;
8
use Informate\Models\Entytys\About\Skill;
9
10
trait AsHuman
11
{
12
    use AsOrganization;
13
14
15
    public function setTag($data)
16
    {
17
      $data = [
18
        'code' => $data
19
      ];
20
      
21
      return Tag::createAndAssociate($data, $this);
22
    }
23
24
    public function setSkill($data)
25
    {
26
      $data = [
27
        'code' => $data
28
      ];
29
      
30
      return Skill::createAndAssociate($data, $this);
31
    }
32
33
34
    /**
35
     * One To Many (Polymorphic) - Feature FA
36
     *
37
     * @return void
38
     */
39
    public function pircings()
40
    {
41
        return $this->morphMany('Population\Models\Identity\Fisicos\Pircing', 'pircingable');
42
    }
43
    public function pintinhas()
44
    {
45
        return $this->morphMany('Population\Models\Identity\Fisicos\Pintinha', 'pintinhable');
46
    }
47
    public function tatuages()
48
    {
49
        return $this->morphMany('Population\Models\Identity\Fisicos\Tatuage', 'tatuageable');
50
    }
51
52
    /**
53
     * Many To Many (Polymorphic)
54
     */
55
    public function productions()
56
    {
57
        return $this->morphToMany('Population\Models\Components\Productions\Production', 'productionable');
58
    }
59
    public function personagens()
60
    {
61
        return $this->morphToMany('Population\Models\Market\Actors\Personagem', 'personagenable');
62
    }
63
    
64
65
    /**
66
     * Events
67
     */
68
    public static function bootAsHuman()                                                                                                                                                             
69
    {
70
71
        // static::deleting(function (self $user) {
72
        //     optional($user->photos)->each(function (Photo $photo) {
73
        //         $photo->delete();
74
        //     });
75
        // });
76
    }
77
    
78
79
}
80