public function run() { // Initialize empty array $status = array(); $date = new DateTime(); $status[] = array('name' => 'Out for Diagnostics', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'user_id' => 1, 'deleted_at' => NULL); $status[] = array('name' => 'Out for Repair', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'user_id' => 1, 'deleted_at' => NULL); $status[] = array('name' => 'Broken - Not Fixable', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'user_id' => 1, 'deleted_at' => NULL); $status[] = array('name' => 'Lost/Stolen', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'user_id' => 1, 'deleted_at' => NULL); // Delete all the old data DB::table('status_labels')->truncate(); // Insert the new posts Statuslabel::insert($status); }
public function run() { // Initialize empty array $status = array(); $date = new DateTime(); $status[] = array('name' => 'Ready to Deploy', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'user_id' => 1, 'deleted_at' => NULL, 'deployable' => 1, 'pending' => 0, 'archived' => 0, 'notes' => ''); $status[] = array('name' => 'Pending', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'user_id' => 1, 'deleted_at' => NULL, 'deployable' => 0, 'pending' => 1, 'archived' => 0, 'notes' => ''); $status[] = array('name' => 'Archived', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'user_id' => 1, 'deleted_at' => NULL, 'deployable' => 0, 'pending' => 0, 'archived' => 1, 'notes' => 'These assets are permanently undeployable'); $status[] = array('name' => 'Out for Diagnostics', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'user_id' => 1, 'deleted_at' => NULL, 'deployable' => 0, 'pending' => 0, 'archived' => 0, 'notes' => ''); $status[] = array('name' => 'Out for Repair', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'user_id' => 1, 'deleted_at' => NULL, 'deployable' => 0, 'pending' => 0, 'archived' => 0, 'notes' => ''); $status[] = array('name' => 'Broken - Not Fixable', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'user_id' => 1, 'deleted_at' => NULL, 'deployable' => 0, 'pending' => 0, 'archived' => 1, 'notes' => ''); $status[] = array('name' => 'Lost/Stolen', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'user_id' => 1, 'deleted_at' => NULL, 'deployable' => 0, 'pending' => 0, 'archived' => 1, 'notes' => ''); // Delete all the old data DB::table('status_labels')->truncate(); // Insert the new posts Statuslabel::insert($status); }
function statusLabelList() { $statuslabel_list = Statuslabel::orderBy('name', 'asc')->lists('name', 'id'); return $statuslabel_list; }
/* |-------------------------------------------------------------------------- | Admin API Routes |-------------------------------------------------------------------------- */ Route::group(['prefix' => 'api', 'namespace' => 'Controllers\\Admin', 'before' => 'admin-auth'], function () { /*---Hardware API---*/ Route::group(['prefix' => 'hardware'], function () { Route::get('list/{status?}', ['as' => 'api.hardware.list', 'uses' => 'AssetsController@getDatatable']); }); /*---Status Label API---*/ Route::group(['prefix' => 'statuslabels'], function () { Route::resource('/', 'StatuslabelsController'); Route::get('{statuslabelId}/deployable', function ($statuslabelId) { $statuslabel = Statuslabel::find($statuslabelId); if ($statuslabel->deployable == '1' && $statuslabel->pending != '1' && $statuslabel->archived != '1') { return '1'; } else { return '0'; } }); }); /*---Accessories API---*/ Route::group(['prefix' => 'accessories'], function () { Route::get('list', ['as' => 'api.accessories.list', 'uses' => 'AccessoriesController@getDatatable']); Route::get('{accessoryID}/view', ['as' => 'api.accessories.view', 'uses' => 'AccessoriesController@getDataView']); }); /*---Consumables API---*/ Route::group(['prefix' => 'consumables'], function () { Route::get('list', ['as' => 'api.consumables.list', 'uses' => 'ConsumablesController@getDatatable']);
function statusLabelList() { $statuslabel_list = array('' => Lang::get('general.select_statuslabel')) + Statuslabel::orderBy('name', 'asc')->lists('name', 'id'); return $statuslabel_list; }