/** * Display a listing of the resource. * * @return Response */ public function index() { $suppliers = Supplier::orderBy('name')->get(); $employees = Employee::orderBy('firstname')->get(); $customers = Customer::orderBy('name')->get(); return view('inventory.home', compact(['suppliers', 'employees', 'customers'])); }
public function customers() { $search = \Input::get('q'); if ($search) { $customers = \App\Customer::where('firstname', 'like', $search . '%')->orWhere('lastname', 'like', $search . '%')->orderBy('created_at', 'desc')->paginate($this->limit); } else { $customers = \App\Customer::orderBy('created_at', 'desc')->paginate($this->limit); } return view('admin.pages.customers', compact('customers')); }
public function create() { $input = Input::all(); $customer = null; if ($input != null) { $customer = Customer::firstOrNew(['name' => $input['order_by']]); $customer->address = $input['address']; $customer->save(); } $employees = Employee::orderBy('firstname')->get(); $customers = Customer::orderBy('name')->get(); return view('order.create', compact(['employees', 'input', 'customer', 'customers'])); }
public function rent(Request $request) { $data = $request->all(); // If the movie isn't in any kiosk then provide the message and return to listing if (!($kiosks = $this->getKiosks($data))) { $this->setMessage('Sorry, this movie is currently not available in that format. Try again later', 'error'); return redirect('/'); } // Get customer list $customers = Customer::orderBy('lastname')->orderBy('firstname')->get(['id', 'firstname', 'lastname'])->toArray(); // dd($customers); return view('movies.rent')->with('movie_id', $data['movie_id'])->with('customers', $customers)->with('kiosks', $kiosks); }
/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(CustomerRequest $request) { try { Customer::create($request->all()); $customer = Customer::orderBy('created_at', 'desc')->first(); $items = Item::all(); foreach ($items as $item) { Price::create(['item_id' => $item->id, 'customer_id' => $customer->id, 'custom_price' => $item->price, 'sellable' => '1']); } return redirect('customer')->with('message', 'Data berhasil dibuat!'); } catch (\Illuminate\Database\QueryException $e) { return redirect('customer')->with('message', 'Data dengan email tersebut sudah digunakan!'); } catch (\PDOException $e) { return redirect('customer')->with('message', 'Data dengan email tersebut sudah digunakan!'); } }
| Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ use App\Customer; use Illuminate\Http\Request; /** * Display All Customers * * Route::get('/', function () { * return view('customers'); * }); */ Route::get('/', function () { $customers = Customer::orderBy('created_at', 'desc')->get(); return view('customers', ['customers' => $customers]); }); /** * Add A New Customer */ Route::post('/customer', function (Request $request) { $validator = Validator::make($request->all(), ['name' => 'required|max:255']); if ($validator->fails()) { return redirect('/')->withInput()->withErrors($validator); } $customer = new Customer(); $customer->customer_name = $request->name; $customer->save(); return redirect('/'); // Create The Task...
public function destroy($id) { Customer::find($id)->delete(); $customers = Customer::orderBy('customer')->paginate(env('CUSTOMER_PAGINATION_MAX')); return view('customers.index')->with('customers', $customers); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { // Retrieve all the customers in the database and return them $customers = Customer::orderBy('first_name', 'asc')->get(); return $customers; }
public function index() { $customers = Customer::orderBy('name')->get(); return view('customer.home', compact('customers')); }