1 | <?php |
||
29 | class DatabaseHost extends Model |
||
30 | { |
||
31 | /** |
||
32 | * The table associated with the model. |
||
33 | * |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $table = 'database_hosts'; |
||
37 | |||
38 | /** |
||
39 | * The attributes excluded from the model's JSON form. |
||
40 | * |
||
41 | * @var array |
||
42 | */ |
||
43 | protected $hidden = ['password']; |
||
44 | |||
45 | /** |
||
46 | * Fields that are mass assignable. |
||
47 | * |
||
48 | * @var array |
||
49 | */ |
||
50 | protected $fillable = [ |
||
51 | 'name', 'host', 'port', 'username', 'max_databases', 'node_id', |
||
52 | ]; |
||
53 | |||
54 | /** |
||
55 | * Cast values to correct type. |
||
56 | * |
||
57 | * @var array |
||
58 | */ |
||
59 | protected $casts = [ |
||
60 | 'id' => 'integer', |
||
61 | 'max_databases' => 'integer', |
||
62 | 'node_id' => 'integer', |
||
63 | ]; |
||
64 | |||
65 | /** |
||
66 | * Gets the node associated with a database host. |
||
67 | * |
||
68 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
69 | */ |
||
70 | public function node() |
||
74 | |||
75 | /** |
||
76 | * Gets the databases assocaited with this host. |
||
77 | * |
||
78 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
79 | */ |
||
80 | public function databases() |
||
84 | } |
||
85 |