Projekt

Obecné

Profil

« Předchozí | Další » 

Revize e765fd91

Přidáno uživatelem Marek Lovčí před téměř 5 roky(ů)

Relace Metadata|User.
Issue #7847 @0.25h

Zobrazit rozdíly:

app/User.php
2 2

  
3 3
namespace App;
4 4

  
5
use Illuminate\Contracts\Auth\MustVerifyEmail;
6 5
use Illuminate\Foundation\Auth\User as Authenticatable;
7 6
use Illuminate\Notifications\Notifiable;
8 7

  
......
13 12
    // Table Name
14 13
    protected $table = 'users';
15 14
    // Primary Key
16
    public $primaryKey = 'id';//unnecessery?
15
    public $primaryKey = 'id';
17 16

  
18 17
    /**
19 18
     * The attributes that are mass assignable.
......
45 44
    /**
46 45
     * Get the artefacts for the user.
47 46
     */
48
    public function likes()
47
    public function likesArtefacts()
49 48
    {
50
        return $this->hasMany('App\Artefact');
49
        return $this->belongsToMany('App\Artefact');
50
    }
51

  
52
    /**
53
     * Get the metadata for the user.
54
     */
55
    public function likesMetadata()
56
    {
57
        return $this->belongsToMany('App\Metadata');
51 58
    }
52 59
}

Také k dispozici: Unified diff