assetRepository = $assetRepository; $this->assetCategoryRepository = $assetCategoryRepository; $this->employeeRepository = $employeeRepository; } /** * Display a listing of the resource. */ public function index() { $data['title'] = "Asset Lists"; $data['assetLists'] = $this->assetRepository->findAll(); return view('asset::assets.index', $data); } /** * Show the form for creating a new resource. */ public function create() { $data['title'] = "Create Asset"; $data['editable'] = false; $data['assetCategoryLists'] = $this->assetCategoryRepository->pluck(); $data['employeeList'] = $this->employeeRepository->pluck(); return view('asset::assets.create', $data); } /** * Store a newly created resource in storage. */ public function store(Request $request): RedirectResponse { $this->assetRepository->create($request->all()); toastr()->success('Asset Created Successfully.'); return redirect()->route('asset.index'); } /** * Show the specified resource. */ public function show($id) { return view('asset::assets.show'); } /** * Show the form for editing the specified resource. */ public function edit($id) { $data['title'] = "Edit Asset"; $data['editable'] = true; $data['assetCategoryLists'] = $this->assetCategoryRepository->pluck(); $data['asset'] = $this->assetRepository->getAssetById($id); return view('asset::assets.edit', $data); } /** * Update the specified resource in storage. */ public function update(Request $request, $id): RedirectResponse { $this->assetRepository->update($id, $request->all()); toastr()->success('Asset Updated Successfully.'); return redirect()->route('asset.index'); } /** * Remove the specified resource from storage. */ public function destroy($id) { // } }