コード例 #1
0
 public function home()
 {
     $stats['employees'] = \App\Employee::count();
     $stats['assets'] = \App\Asset::count();
     $stats['users'] = \App\User::count();
     $stats['vendors'] = \App\Vendor::count();
     return View('pages.dashboard', compact('stats'));
 }
コード例 #2
0
 /**
  * @param Request $request
  */
 public function getAssetId(Request $request)
 {
     $type = $this->asset_type[$request->get('type')];
     $brand = str_pad($request->get('brand'), 5, "_");
     $date = $request->get('entry_at');
     $yy = substr($date, 2, 2);
     $mm = substr($date, 5, 2);
     $dd = substr($date, 8, 2);
     $section = $this->sections[$request->get('section')];
     $warranty = $request->get('warranty');
     $serial = Asset::where('type', '=', $request->get('type'))->count();
     return $type . $dd . $mm . $yy . $brand . $warranty . $section . $serial;
 }
コード例 #3
0
ファイル: DecayAssets.php プロジェクト: patrickdamery/Eirene
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     // Get assets that should decay.
     $assets = Asset::where('Type', '=', 1)->get();
     // Loop through the assets and decay them.
     foreach ($assets as $asset) {
         // Check that we haven't already decayed this asset.
         $decay = AssetDecay::where('AssetId', '=', $asset->Id)->where('Date', '=', date('Y-m-d'))->first();
         if (!$decay) {
             $decayValue = $asset->Value / $asset->Days;
             $decay = AssetDecay::create(array('AssetId' => $asset->Id, 'Date' => date('Y-m-d'), 'Value' => $decayValue));
             // Update asset.
             $asset->Value -= $decayValue;
             $asset->Days--;
             $asset->save();
         }
         $permissions = json_decode(UserLevel::find(1)->Permissions);
         print_r($permissions);
     }
 }
コード例 #4
0
 public function searchAsset()
 {
     // Validate Input.
     $validator = Validator::make(Input::all(), array('asset' => 'required'));
     if ($validator->fails()) {
         return response()->json(['error' => 'Es necesario escribir algo para buscar!']);
     }
     $asset = Asset::find(Input::get('asset'));
     $response['state'] = 'Success';
     $response['asset'] = $asset;
     return response()->json($response);
 }
コード例 #5
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $asset = new Asset();
     if ($asset->destroy($id)) {
         return "success";
     }
 }
コード例 #6
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Asset::destroy($id);
     flash()->success('Success!', 'Asset has been deleted!');
     return redirect('assets');
 }
コード例 #7
0
ファイル: AssetController.php プロジェクト: shiruken1/LEIAs
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $asset = Asset::findOrFail($id);
     $asset->delete();
     return redirect()->route('assets.index')->with('message', 'Item deleted successfully.');
 }