Model for the Actionlog (the table that keeps a historical log of checkouts, checkins, and updates). More...

Inheritance diagram for App\Models\Actionlog:
App\Models\ICompanyableChild

Public Member Functions

 getCompanyableParents ()
 
 assetlog ()
 
 uploads ()
 
 licenselog ()
 
 accessorylog ()
 
 consumablelog ()
 
 adminlog ()
 
 userlog ()
 
 childlogs ()
 
 parentlog ()
 
 get_src ($type= 'assets')
 Check if the file exists, and if it does, force a download. More...
 
 logaction ($actiontype)
 Get the parent category name. More...
 
 getListingOfActionLogsChronologicalOrder ()
 getListingOfActionLogsChronologicalOrder More...
 
 getLatestCheckoutActionForAssets ()
 getLatestCheckoutActionForAssets More...
 
 scopeCheckoutWithoutAcceptance ($query)
 scopeCheckoutWithoutAcceptance More...
 

Public Attributes

 $timestamps = true
 

Protected Attributes

 $dates = [ 'deleted_at' ]
 
 $table = 'asset_logs'
 
 $fillable = [ 'created_at', 'asset_type' ]
 

Detailed Description

Model for the Actionlog (the table that keeps a historical log of checkouts, checkins, and updates).

Version
v1.0

Definition at line 15 of file Actionlog.php.

Member Function Documentation

App\Models\Actionlog::accessorylog ( )

Definition at line 53 of file Actionlog.php.

54  {
55 
56  return $this->belongsTo('\App\Models\Accessory', 'accessory_id')
57  ->withTrashed();
58  }
App\Models\Actionlog::adminlog ( )

Definition at line 67 of file Actionlog.php.

68  {
69 
70  return $this->belongsTo('\App\Models\User', 'user_id')
71  ->withTrashed();
72  }
App\Models\Actionlog::assetlog ( )

Definition at line 31 of file Actionlog.php.

32  {
33 
34  return $this->belongsTo('\App\Models\Asset', 'asset_id')
35  ->withTrashed();
36  }
App\Models\Actionlog::childlogs ( )

Definition at line 81 of file Actionlog.php.

82  {
83 
84  return $this->hasMany('\App\Models\ActionLog', 'thread_id');
85  }
App\Models\Actionlog::consumablelog ( )

Definition at line 60 of file Actionlog.php.

61  {
62 
63  return $this->belongsTo('\App\Models\Consumable', 'consumable_id')
64  ->withTrashed();
65  }
App\Models\Actionlog::get_src (   $type = 'assets')

Check if the file exists, and if it does, force a download.

Definition at line 96 of file Actionlog.php.

97  {
98 
99  $file = config('app.private_uploads') . '/' . $type . '/' . $this->filename;
100 
101  return $file;
102 
103  }
App\Models\Actionlog::getCompanyableParents ( )

Implements App\Models\ICompanyableChild.

Definition at line 26 of file Actionlog.php.

27  {
28  return [ 'accessorylog', 'assetlog', 'licenselog', 'consumablelog' ];
29  }
App\Models\Actionlog::getLatestCheckoutActionForAssets ( )

getLatestCheckoutActionForAssets

Returns
mixed
Author
Vincent Sposato vince.nosp@m.nt.s.nosp@m.posat.nosp@m.o@gm.nosp@m.ail.c.nosp@m.om
Version
v1.0

Definition at line 145 of file Actionlog.php.

146  {
147 
148  return DB::table('asset_logs')
149  ->select(DB::raw('asset_id, MAX(created_at) as last_created'))
150  ->where('action_type', '=', 'checkout')
151  ->groupBy('asset_id')
152  ->get();
153  }
App\Models\Actionlog::getListingOfActionLogsChronologicalOrder ( )

getListingOfActionLogsChronologicalOrder

Returns
mixed
Author
Vincent Sposato vince.nosp@m.nt.s.nosp@m.posat.nosp@m.o@gm.nosp@m.ail.c.nosp@m.om
Version
v1.0

Definition at line 127 of file Actionlog.php.

128  {
129 
130  return DB::table('asset_logs')
131  ->select('*')
132  ->where('action_type', '!=', 'uploaded')
133  ->orderBy('asset_id', 'asc')
134  ->orderBy('created_at', 'asc')
135  ->get();
136  }
App\Models\Actionlog::licenselog ( )

Definition at line 46 of file Actionlog.php.

47  {
48 
49  return $this->belongsTo('\App\Models\License', 'asset_id')
50  ->withTrashed();
51  }
App\Models\Actionlog::logaction (   $actiontype)

Get the parent category name.

Definition at line 108 of file Actionlog.php.

109  {
110 
111  $this->action_type = $actiontype;
112 
113  if ($this->save()) {
114  return true;
115  } else {
116  return false;
117  }
118  }
App\Models\Actionlog::parentlog ( )

Definition at line 87 of file Actionlog.php.

88  {
89 
90  return $this->belongsTo('\App\Models\ActionLog', 'thread_id');
91  }
App\Models\Actionlog::scopeCheckoutWithoutAcceptance (   $query)

scopeCheckoutWithoutAcceptance

Parameters
$query
Returns
mixed
Author
Vincent Sposato vince.nosp@m.nt.s.nosp@m.posat.nosp@m.o@gm.nosp@m.ail.c.nosp@m.om
Version
v1.0

Definition at line 164 of file Actionlog.php.

165  {
166 
167  return $query->where('action_type', '=', 'checkout')
168  ->where('accepted_id', '=', null);
169  }
App\Models\Actionlog::uploads ( )

Definition at line 38 of file Actionlog.php.

39  {
40 
41  return $this->belongsTo('\App\Models\Asset', 'asset_id')
42  ->where('action_type', '=', 'uploaded')
43  ->withTrashed();
44  }
App\Models\Actionlog::userlog ( )

Definition at line 74 of file Actionlog.php.

75  {
76 
77  return $this->belongsTo('\App\Models\User', 'checkedout_to')
78  ->withTrashed();
79  }

Member Data Documentation

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

Definition at line 20 of file Actionlog.php.

App\Models\Actionlog::$fillable = [ 'created_at', 'asset_type' ]
protected

Definition at line 24 of file Actionlog.php.

App\Models\Actionlog::$table = 'asset_logs'
protected

Definition at line 22 of file Actionlog.php.

App\Models\Actionlog::$timestamps = true

Definition at line 23 of file Actionlog.php.


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