forked from octobercms/test-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPhone.php
63 lines (52 loc) · 1.13 KB
/
Phone.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php namespace October\Test\Models;
use Model;
/**
* Phone Model
*/
class Phone extends Model
{
use \October\Rain\Database\Traits\Validation;
/**
* @var string The database table used by the model.
*/
public $table = 'october_test_phones';
/**
* @var array Guarded fields
*/
protected $guarded = ['*'];
/**
* @var array fillable fields
*/
protected $fillable = [];
/**
* @var array Rules
*/
public $rules = [
'name' => 'required',
];
/**
* @var array Relations
*/
public $belongsTo = [
'person' => Person::class
];
public $attachOne = [
'picture' => \System\Models\File::class
];
public function getBrandOptions()
{
return [
'nokia' => ['Nokia', '#666666'],
'apple' => ['Apple', '#ff9999'],
'samsung' => ['Samsung', '#ff0000'],
];
}
public function scopeIsActive($query)
{
return $query->where('is_active', true);
}
public function scopeCustomSearch($query, $term)
{
$query->where('name', $term);
}
}