public function customers()
 {
     $term = \Input::get('term');
     $customers = Customer::where('customer_name', 'like', "%{$term}%")->orderBy('customer_name', 'asc')->get();
     $json = [];
     foreach ($customers as $c) {
         array_push($json, array('value' => $c->id, 'label' => $c->customer_name));
     }
     return response()->json($json);
 }
 public function del_customer(Request $request)
 {
     $id = $request->input('id');
     $customer = Customer::find($id);
     $customer->delete();
 }
Example #3
0
 public function post_create()
 {
     Customer::create(array('name' => Input::get('name')));
     return Redirect::to_route('home')->with('message', 'The author was created');
 }
 /**
  * Return a json list of records matching the provided query
  * @return json
  */
 public function ajaxCustomerSearch()
 {
     return Customer::searchByNameAutocomplete(Input::get('query'));
 }