Inheritance diagram for App\Models\Statuslabel:

Public Member Functions

 has_assets ()
 
 getStatuslabelType ()
 
 scopeTextSearch ($query, $search)
 Query builder scope to search on text. More...
 

Static Public Member Functions

static getStatuslabelTypesForDB ($type)
 

Protected Attributes

 $injectUniqueIdentifier = true
 
 $dates = ['deleted_at']
 
 $table = 'status_labels'
 
 $rules
 
 $fillable = ['name']
 

Detailed Description

Definition at line 8 of file Statuslabel.php.

Member Function Documentation

App\Models\Statuslabel::getStatuslabelType ( )

Definition at line 31 of file Statuslabel.php.

32  {
33 
34  if ($this->pending == 1) {
35  return 'pending';
36  } elseif ($this->archived == 1) {
37  return 'archived';
38  } elseif (($this->archived == 0) && ($this->deployable == 0) && ($this->deployable == 0)) {
39  return 'undeployable';
40  } else {
41  return 'deployable';
42  }
43  }
static App\Models\Statuslabel::getStatuslabelTypesForDB (   $type)
static

Definition at line 45 of file Statuslabel.php.

46  {
47  if ($type == 'pending') {
48  $statustype['pending'] = 1;
49  $statustype['deployable'] = 0;
50  $statustype['archived'] = 0;
51 
52  } elseif ($type == 'deployable') {
53  $statustype['pending'] = 0;
54  $statustype['deployable'] = 1;
55  $statustype['archived'] = 0;
56 
57  } elseif ($type == 'archived') {
58  $statustype['pending'] = 0;
59  $statustype['deployable'] = 0;
60  $statustype['archived'] = 1;
61 
62  } elseif ($type == 'undeployable') {
63  $statustype['pending'] = 0;
64  $statustype['deployable'] = 0;
65  $statustype['archived'] = 0;
66  }
67 
68  return $statustype;
69  }
App\Models\Statuslabel::has_assets ( )

Definition at line 26 of file Statuslabel.php.

27  {
28  return $this->hasMany('\App\Models\Asset', 'status_id')->count();
29  }
App\Models\Statuslabel::scopeTextSearch (   $query,
  $search 
)

Query builder scope to search on text.

Parameters
Illuminate\Database\Query\Builder$queryQuery builder instance
text$searchSearch term
Returns
Illuminate Modified query builder

Definition at line 79 of file Statuslabel.php.

80  {
81 
82  return $query->where(function ($query) use ($search) {
83 
84  $query->where('name', 'LIKE', '%'.$search.'%');
85  });
86  }

Member Data Documentation

App\Models\Statuslabel::$dates = ['deleted_at']
protected

Definition at line 14 of file Statuslabel.php.

App\Models\Statuslabel::$fillable = ['name']
protected

Definition at line 24 of file Statuslabel.php.

App\Models\Statuslabel::$injectUniqueIdentifier = true
protected

Definition at line 13 of file Statuslabel.php.

App\Models\Statuslabel::$rules
protected
Initial value:
= array(
'name' => 'required|string|unique:status_labels,name,NULL,deleted_at',
'notes' => 'string',
)

Definition at line 18 of file Statuslabel.php.

App\Models\Statuslabel::$table = 'status_labels'
protected

Definition at line 15 of file Statuslabel.php.


The documentation for this class was generated from the following file: