Example #1
0
 /**
  * Returns all the clients.
  *
  * @return View
  */
 public function getIndex()
 {
     // Get all the clients
     $clients = $this->client->orderBy('created_at', 'DESC')->paginate(10);
     // Show the page
     return View::make('site/clients/index', compact('clients'));
 }
 public function destroy($id)
 {
     $delete = Client::find($id);
     $delete->delete();
     $data = array('clients' => Client::orderBy('id', 'desc')->get(), 'refresh' => true);
     return View::make('clients.table', $data);
 }
 public function store()
 {
     $rules = array('id' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->passes()) {
         //pasó validacion y guarda
     } else {
         //mensajes de error si faltan dartos
         if (Request::ajax()) {
             $data = array('errors' => $validator->errors(), 'inputs' => Input::all());
             //regresa a la vista de crear
             return View::make('clients.create', $data);
         }
         return 0;
     }
     $data = array('clients' => Client::orderBy('id', 'desc')->get(), 'refresh' => true);
     return View::make('clients.table', $data);
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $items = Client::orderBy('name', 'ASC')->paginate(10);
     return View::make('client.view_client', compact('items'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $clients = Client::orderBy('company')->get();
     return View::make('clients.index')->withClients($clients);
 }