App\Models\Supplier Class Reference
Inheritance diagram for App\Models\Supplier:

Public Member Functions

 assets ()
 
 asset_maintenances ()
 
 num_assets ()
 
 licenses ()
 
 num_licenses ()
 
 addhttp ($url)
 
 scopeTextSearch ($query, $search)
 Query builder scope to search on text. More...
 

Protected Attributes

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

Detailed Description

Definition at line 8 of file Supplier.php.

Member Function Documentation

App\Models\Supplier::addhttp (   $url)

Definition at line 72 of file Supplier.php.

73  {
74  if (!preg_match("~^(?:f|ht)tps?://~i", $url)) {
75  $url = "http://" . $url;
76  }
77  return $url;
78  }
App\Models\Supplier::asset_maintenances ( )

Definition at line 52 of file Supplier.php.

53  {
54  return $this->hasMany('\App\Models\AssetMaintenance', 'supplier_id');
55  }
App\Models\Supplier::assets ( )

Definition at line 47 of file Supplier.php.

48  {
49  return $this->hasMany('\App\Models\Asset', 'supplier_id');
50  }
App\Models\Supplier::licenses ( )

Definition at line 62 of file Supplier.php.

63  {
64  return $this->hasMany('\App\Models\License', 'supplier_id');
65  }
App\Models\Supplier::num_assets ( )

Definition at line 57 of file Supplier.php.

58  {
59  return $this->hasMany('\App\Models\Asset', 'supplier_id')->count();
60  }
App\Models\Supplier::num_licenses ( )

Definition at line 67 of file Supplier.php.

68  {
69  return $this->hasMany('\App\Models\License', 'supplier_id')->count();
70  }
App\Models\Supplier::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 88 of file Supplier.php.

89  {
90 
91  return $query->where(function ($query) use ($search) {
92 
93  $query->where('name', 'LIKE', '%'.$search.'%');
94  });
95  }

Member Data Documentation

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

Definition at line 11 of file Supplier.php.

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

Definition at line 44 of file Supplier.php.

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

Definition at line 36 of file Supplier.php.

App\Models\Supplier::$rules
protected
Initial value:
= array(
'name' => 'required|min:3|max:255|unique:suppliers,name,NULL,deleted_at',
'address' => 'min:3|max:255',
'address2' => 'min:2|max:255',
'city' => 'min:3|max:255',
'state' => 'min:0|max:32',
'country' => 'min:0|max:2',
'fax' => 'min:7|max:20',
'phone' => 'min:7|max:20',
'contact' => 'min:0|max:255',
'notes' => 'min:0|max:255',
'email' => 'email|min:5|max:150',
'zip' => 'min:0|max:10',
'url' => 'min:3|max:250',
)

Definition at line 13 of file Supplier.php.


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