src/controllers/admin/AdminCrudController.php
public function index()
	{
		$Model   = App::make($this->Model);
		$objects = $Model::withTrashed();

		// If a search term has been entered...
		$this->data['search'] = $search = (Input::get('search')) ? urldecode(Input::get('search')) : null;
		if ($search) {
			$terms = explode(' ', $search);
			foreach ($terms as &$term) {
				$term = '%' . $term . '%';
			}

			// Call the search method on the Model
			$resultIDs = array();
			$Model->search($terms)->each(function($object) use (&$resultIDs) {
				$resultIDs[] = $object->id;
			});
			// Limit the $objects query based on the results, make sure that no objects
			// are returned if there are no results. (where id = 0, it's cheap but it works!)
			$objects = (count($resultIDs)) ? $objects->whereIn('id', $resultIDs) : $objects->where('id', 0);
		}

		// Return all objects in order if this is a reorderable index
		if ($Model->reorderable) {
			$this->data[$this->plural] = $objects->orderBy('order')->get();
		} else {
			// Otherwise, paginate the objects
			$paginator = $objects->paginate();
			$this->data[$this->plural] = $paginator->getCollection();
			$appends = $_GET;
			unset($appends['page']);
			$this->data['links'] = $paginator->appends($appends)->links();
		}

		return View::make($this->view('index'), $this->data);
	}
public function index()
	{
		$Model   = App::make($this->Model);
		$objects = $Model::withTrashed();

		// If a search term has been entered...
		$this->data['search'] = $search = (Input::get('search')) ? urldecode(Input::get('search')) : null;
		if ($search) {
			$terms = explode(' ', $search);
			foreach ($terms as &$term) {
				$term = '%' . $term . '%';
			}

			// Call the search method on the Model
			$resultIDs = array();
			$Model->search($terms)->each(function($object) use (&$resultIDs) {
				$resultIDs[] = $object->id;
			});
			// Limit the $objects query based on the results, make sure that no objects
			// are returned if there are no results. (where id = 0, it's cheap but it works!)
			$objects = (count($resultIDs)) ? $objects->whereIn('id', $resultIDs) : $objects->where('id', 0);
		}

		// Return all objects in order if this is a reorderable index
		if ($Model->reorderable) {
			$this->data[$this->plural] = $objects->orderBy('order')->get();
		} else {
			// Otherwise, paginate the objects
			$paginator = $objects->paginate();
			$this->data[$this->plural] = $paginator->getCollection();
			$appends = $_GET;
			unset($appends['page']);
			$this->data['links'] = $paginator->appends($appends)->links();
		}

		return View::make($this->view('index'), $this->data);
	}
An (optionally) searchable index of all the model objects.  If the models are reorderable,
they are displayed all at once (for easy reordering).  Otherwise, they are paginated.

@return \Illuminate\View\View