1 |
344b1e53
|
zabran
|
<?php
|
2 |
|
|
|
3 |
|
|
namespace App;
|
4 |
|
|
|
5 |
|
|
use Illuminate\Database\Eloquent\Model;
|
6 |
|
|
|
7 |
|
|
class Artefact extends Model
|
8 |
|
|
{
|
9 |
|
|
// Table Name
|
10 |
|
|
protected $table = 'artafacts';//unnecessery?
|
11 |
|
|
// Primary Key
|
12 |
|
|
public $primaryKey = 'id';//unnecessery?
|
13 |
|
|
|
14 |
|
|
/**
|
15 |
|
|
* The model's default values for attributes.
|
16 |
|
|
*
|
17 |
|
|
* @var array
|
18 |
|
|
*/
|
19 |
43bb92a9
|
zabran
|
/*protected $attributes = [
|
20 |
344b1e53
|
zabran
|
'likes' => 0,
|
21 |
43bb92a9
|
zabran
|
];*/
|
22 |
344b1e53
|
zabran
|
|
23 |
|
|
/**
|
24 |
|
|
* Indicates if the model should be timestamped.
|
25 |
|
|
*
|
26 |
|
|
* @var bool
|
27 |
|
|
*/
|
28 |
|
|
public $timestamps = false;
|
29 |
|
|
|
30 |
|
|
/**
|
31 |
|
|
* Get the metadata for the artefact.
|
32 |
|
|
*/
|
33 |
|
|
public function metadata()
|
34 |
|
|
{
|
35 |
|
|
return $this->hasMany('App\Metadata');
|
36 |
|
|
}
|
37 |
|
|
|
38 |
dc0fb924
|
zabran
|
/**
|
39 |
43bb92a9
|
zabran
|
* Get the categories for the artefact.
|
40 |
dc0fb924
|
zabran
|
*/
|
41 |
43bb92a9
|
zabran
|
public function categories()
|
42 |
dc0fb924
|
zabran
|
{
|
43 |
43bb92a9
|
zabran
|
return $this->belongsToMany('App\Category');
|
44 |
dc0fb924
|
zabran
|
}
|
45 |
|
|
|
46 |
344b1e53
|
zabran
|
/**
|
47 |
43bb92a9
|
zabran
|
* Get the users for the artefact.
|
48 |
344b1e53
|
zabran
|
*/
|
49 |
43bb92a9
|
zabran
|
public function users()
|
50 |
344b1e53
|
zabran
|
{
|
51 |
43bb92a9
|
zabran
|
return $this->belongsToMany('App\User');
|
52 |
344b1e53
|
zabran
|
}
|
53 |
|
|
|
54 |
|
|
|
55 |
|
|
|
56 |
|
|
}
|