public function index() { if (Auth::user()->isAdmin() || Auth::user()->isSuperAdmin()) { $filter = \DataFilter::source(Account::where('company_id', Auth::user()->company_id)); $filter->add('name', 'Nome', 'text'); $filter->add('cpf_cnpj', 'CPF/CNPJ', 'text'); $filter->add('hasvehicle', 'Veículo', 'select')->options(array(0 => 'Todos', 1 => 'Com Veículos', 2 => 'Sem Veículos'))->scope('hasvehicle'); $filter->submit('Buscar'); $filter->reset('Limpar'); $filter->build(); $grid = \DataGrid::source($filter); $grid->label('Clientes'); $grid->attributes(array("class" => "table table-striped")); $grid->add('name', 'Nome', true); $grid->add('cpf_cnpj', 'CPF/CNPJ', true); $grid->add('phone1', 'Telefone'); $grid->add('phone2', 'Telefone'); $grid->edit('accounts/edit', 'Ações', 'show|modify|delete'); $grid->link('accounts/edit', "Novo Cliente", "TR"); $grid->orderBy('name', 'asc'); return view('accounts::index', compact('filter', 'grid')); } else { return view('errors.503'); } }
public function getAccountlist() { return Account::where("name", "like", \Input::get("q") . "%")->take(10)->get(); }