/** * Show a list of all suppliers * * @return View */ public function getIndex() { // Grab all the suppliers $suppliers = Supplier::orderBy('created_at', 'DESC')->get(); // Show the page return View::make('suppliers/index', compact('suppliers')); }
public function index() { $s = Supplier::orderBy('id', 'desc')->get(); //print_r($s); //foreach($s as $v){ // echo $v->id.'<br>'; //} return view('suppliers')->with('suppliers', $s); }
/** * Tests the update function in the SupplierController * @depends testStore * @param void * @return void */ public function testUpdate() { $this->be(User::first()); $this->runStore($this->input); $supplierSaved = Supplier::orderBy('id', 'desc')->first(); // Update the supplier $this->runUpdate($this->inputUpdate, $supplierSaved->id); $supplierUpdated = Supplier::orderBy('id', 'desc')->first(); $this->assertEquals($this->inputUpdate['name'], $supplierUpdated->name); $this->assertEquals($this->inputUpdate['phone'], $supplierUpdated->phone); $this->assertEquals($this->inputUpdate['email'], $supplierUpdated->email); $this->assertEquals($this->inputUpdate['address'], $supplierUpdated->address); }
/** * Display a listing of the resource. * * @return Response */ public function index() { // $suppliers = Supplier::orderBy('name', 'ASC')->get(); return view('inventory.supplier.index')->with('suppliers', $suppliers); }
/** * Returns a form with existing license data to allow an admin to * update license information. * * @author [A. Gianotto] [<*****@*****.**>] * @since [v1.0] * @param int $licenseId * @return View */ public function getEdit($licenseId = null) { // Check if the license exists if (is_null($license = License::find($licenseId))) { // Redirect to the blogs management page return redirect()->to('admin/licenses')->with('error', trans('admin/licenses/message.does_not_exist')); } elseif (!Company::isCurrentUserHasAccess($license)) { return redirect()->to('admin/licenses')->with('error', trans('general.insufficient_permissions')); } if ($license->purchase_date == "0000-00-00") { $license->purchase_date = null; } if ($license->purchase_cost == "0.00") { $license->purchase_cost = null; } // Show the page $license_options = array('' => 'Top Level') + DB::table('assets')->where('id', '!=', $licenseId)->pluck('name', 'id'); $depreciation_list = array('0' => trans('admin/licenses/form.no_depreciation')) + Depreciation::pluck('name', 'id')->toArray(); $supplier_list = array('' => 'Select Supplier') + Supplier::orderBy('name', 'asc')->pluck('name', 'id')->toArray(); $maintained_list = array('' => 'Maintained', '1' => 'Yes', '0' => 'No'); $company_list = Helper::companyList(); return View::make('licenses/edit', compact('license'))->with('license_options', $license_options)->with('depreciation_list', $depreciation_list)->with('supplier_list', $supplier_list)->with('company_list', $company_list)->with('maintained_list', $maintained_list); }
public static function suppliersList() { $supplier_list = array('' => trans('general.select_supplier')) + Supplier::orderBy('name', 'asc')->orderBy('name', 'asc')->pluck('name', 'id')->toArray(); return $supplier_list; }