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 |
|
|
protected $attributes = [
|
20 |
|
|
'likes' => 0,
|
21 |
|
|
];
|
22 |
|
|
|
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 |
|
|
/**
|
39 |
|
|
* Get the categories for the artefact.
|
40 |
|
|
*/
|
41 |
|
|
public function categories()
|
42 |
|
|
{
|
43 |
|
|
return $this->belongsToMany('App\Category');
|
44 |
|
|
}
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
|
49 |
|
|
}
|