本文整理汇总了PHP中DataFilter::source方法的典型用法代码示例。如果您正苦于以下问题:PHP DataFilter::source方法的具体用法?PHP DataFilter::source怎么用?PHP DataFilter::source使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataFilter
的用法示例。
在下文中一共展示了DataFilter::source方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
if (Auth::user()->isAdmin() || Auth::user()->isSuperAdmin()) {
$filter = \DataFilter::source(Vehicle::with('Device', 'Account')->whereHas('Account', function ($query) {
$query->where('company_id', Auth::user()->company_id);
}));
$filter->add('plate', 'Placa', 'text')->scope(function ($query, $value) {
return $query->whereRaw("plate LIKE '%" . strtoupper($value) . "%'");
});
$filter->add('brand', 'Marca', 'text');
$filter->add('model', 'Modelo', 'text');
$filter->add('year', 'Ano', 'text');
$filter->add('color', 'Cor', 'text');
$filter->add('hasdevice', 'Atribuído', 'select')->options(array(0 => 'Todos', 1 => 'Com Rastreador', 2 => 'Sem Rastreador'))->scope('hasdevice');
$filter->submit('Buscar');
$filter->reset('Limpar');
$filter->build();
$grid = \DataGrid::source($filter);
$grid->label('Veículos');
$grid->attributes(array("class" => "table table-striped"));
$grid->add('Account.name', 'Cliente', 'account_id');
$grid->add('plate', 'Placa', true);
$grid->add('brand', 'Marca', true);
$grid->add('model', 'Modelo', true);
$grid->add('year', 'Ano', true);
$grid->add('color', 'Cor', true);
$grid->add('Device.serial', 'Aparelho');
$grid->edit('vehicles/edit', 'Ações', 'show|modify|delete');
$grid->link('vehicles/edit', "Novo Veículo", "TR");
$grid->paginate(10);
return view('vehicles::index', compact('filter', 'grid'));
} else {
return redirect()->back()->with('error', 'Você não tem permissão para acessar esse módulo!');
}
}
示例2: index
/**
* Display a listing of mailings
*
* @return Response
*/
public function index()
{
$filter = DataFilter::source(new Mailing());
$filter->add('email', 'Email', 'text');
$filter->add('nome', 'Nome', 'text');
$filter->add('phone', 'Telefone', 'text');
$filter->submit('Filtrar');
$filter->reset('Limpar Filtro');
$filter->build();
$grid = DataGrid::source($filter);
//same source types of DataSet
$grid->attributes(array("class" => "table table-striped table-hover"));
$grid->add('email', 'Email', true);
//field name, label, sortable
$grid->add('nome', 'Nome', true);
//field name, label, sortable
$grid->add('phone', 'Telefone', true);
//field name, label, sortable
$grid->add('
<a class="text-danger" title="Deletar" href="admin/mailing/delete/{{$id}}"><span class="glyphicon glyphicon-trash"> </span></a>
', 'Ações');
//$grid->edit('admin/mailing/crud', 'Ações','show|modify|delete'); //shortcut to link DataEdit actions
$grid->orderBy('email', 'asc');
//default orderby
$grid->paginate(10);
//pagination
$grid->attributes(array('class' => 'table table-striped table-hover'));
// $mailing = Mailing::find(1);
// echo $mailing->destino->{'nome_br'};
// dd();
return View::make('admin.mailing.index', compact('filter', 'grid'));
}
示例3: all
public function all($entity)
{
parent::all($entity);
$this->filter = \DataFilter::source(new \App\Pessoas());
$this->filter->add('nome', 'Nome', 'text');
$this->filter->add('id_grupo', 'Grupo', 'text');
$this->filter->add('id_programa', 'Programa', 'text');
$this->filter->submit('buscar');
$this->filter->reset('resetar');
$this->filter->build();
$this->grid = \DataGrid::source($this->filter);
$this->grid->add('nome', 'Nome');
$this->grid->add('sexo', 'Sexo');
$this->grid->add('nascimento', 'nascimento');
$this->grid->add('responsavel', 'Responsável');
$this->grid->add('email', 'Email');
$this->grid->add('tel-fixo', 'Telefone Fixo');
$this->grid->add('rua', 'Logradouro');
$this->grid->add('numero', 'Numero');
$this->grid->add('bairro', 'bairro');
$this->grid->add('id_grupo', 'Grupo');
$this->grid->add('id_programa', 'Programa');
$this->addStylesToGrid();
return $this->returnView();
}
示例4: gridForAdmins
public static function gridForAdmins(&$filter, &$grid)
{
$filter = \DataFilter::source(News::with('createdBy', 'approvedBy', 'status'));
//->where('status_id', '<>', 1)
$filter->add('title', 'Title', 'text');
$filter->add('content', 'Content', 'text');
$filter->add('createdBy.name', 'created_by', 'text');
$filter->add('approvedBy.name', 'approved_by', 'text');
$filter->add('updated_at', 'Last update date', 'daterange')->format('m/d/Y', 'en');
$filter->add('created_at', 'Create date', 'daterange')->format('m/d/Y', 'en');
$filter->submit('search');
$filter->reset('reset');
$filter->build();
$grid = DataGrid::source($filter);
$grid->attributes(array("class" => "table table-striped"));
$grid->add('title', 'Title', true);
$grid->add('updated_at|strtotime|date[m/d/Y]', 'Last update date', true);
$grid->add('created_at|strtotime|date[m/d/Y]', 'Create date', true);
$grid->add('content|strip_tags|substr[0,20]', 'Content');
$grid->add('createdBy.name', 'created_by');
$grid->add('approvedBy.name', 'approved_by');
$grid->add('status.title', 'Status');
$grid->add('view', 'View')->cell(function ($value, $row) {
return '<a class="btn btn-responsive" href="' . url('admin-news/view') . "/" . $row->id . '"><i class="glyphicon glyphicon-eye-open"></i></a>';
});
$grid->add('status.id', 'Approve')->cell(function ($value, $row) {
if ($value == 2) {
return '<a class="btn btn-success btn-responsive" href="' . url('admin-news/approve') . "/" . $row->id . '"><i class="glyphicon glyphicon-ok"></i> Approve</a>';
}
return '';
});
$grid->orderBy('id', 'desc');
$grid->paginate(10);
}
示例5: index
/**
* Display a listing of the resource.
* GET /admcontinentes
*
* @return Response
*/
public function index()
{
$filter = DataFilter::source(new Continente());
$filter->add('name_pt', 'Nome - PT', 'text');
$filter->submit('Filtrar');
$filter->reset('Limpar Filtro');
$filter->build();
$grid = DataGrid::source($filter);
//same source types of DataSet
$grid->attributes(array("class" => "table table-striped table-hover"));
$grid->add('name_pt', 'Nome PT', true);
//field name, label, sortable
$grid->add('
<a class="" title="Modificar" href="admin/continente/{{$code}}/edit"><span class="glyphicon glyphicon-edit"> </span></a>
', 'Ações');
//$grid->edit('admin/hotel/crud', 'Ações','show|modify|delete'); //shortcut to link DataEdit actions
$grid->orderBy('name_pt', 'desc');
//default orderby
$grid->paginate(10);
//pagination
$grid->attributes(array('class' => 'table table-striped table-hover'));
// $hotel = Hotel::find(1);
// echo $hotel->destino->{'nome_br'};
// dd();
return View::make('admin.continente.index', compact('filter', 'grid'));
}
示例6: index
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');
}
}
示例7: index
/**
* Display a listing of the resource.
* GET /admpedido
*
* @return Response
*/
public function index()
{
$filter = DataFilter::source(new User());
$filter->add('nome', 'Nome do Cliente', 'text');
$filter->add('email', 'Email do Cliente', 'text');
$filter->submit('Filtrar');
$filter->reset('Limpar Filtro');
$filter->build();
$grid = DataGrid::source($filter);
//same source types of DataSet
$grid->attributes(array("class" => "table table-striped table-hover"));
$grid->add('id', 'Id Cliente', true);
//field name, label, sortable
$grid->add('nome', 'Nome do Cliente', true);
//field name, label, sortable
$grid->add('email', 'Email do Cliente');
//relation.fieldname
$grid->add('
<a class="" title="Criar Produtos" href="admin/produto-personalizado/{{$id}}/edit"><span class="glyphicon glyphicon-edit"> </span></a>
', 'Ações');
//$grid->edit('admin/serviconoturno/crud', 'Ações','show|modify|delete'); //shortcut to link DataEdit actions
$grid->orderBy('id', 'desc');
//default orderby
$grid->paginate(10);
//pagination
$grid->attributes(array('class' => 'table table-striped table-hover'));
return View::make('admin.produtopersonalizado.index', compact('filter', 'grid'));
}
示例8: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$filter = \DataFilter::source(User::with('faction'));
$filter->add('name', 'Name', 'text');
$filter->add('faction.name', 'Faction', 'autocomplete');
$filter->add('updated_at', 'Last change', 'daterange')->format('m/d/Y', 'en');
$filter->submit('search');
$filter->reset('reset');
$filter->build();
$grid = \DataGrid::source($filter)->attributes(['class' => 'table table-hover table-striped']);
$grid->add('id', 'ID', true)->cell(function ($value) {
return link_to(action('Admin\\UserController@edit') . '?show=' . $value, $value);
});
$grid->add('status', 'Status', true);
$grid->add('name', 'Name', true);
$grid->add('faction.name', 'Faction', true);
$grid->add('reputation', 'Reputation', true);
$grid->add('alignment', 'Alignment', true);
$grid->add('affiliation', 'Affiliation', true);
$grid->add('created_at', 'Created', true);
$grid->add('updated_at', 'Last change', true);
$grid->add('email', 'Email address');
$grid->edit(action('Admin\\UserController@edit'), 'Edit', 'modify|delete');
return view('admin.user.index', compact('filter', 'grid'));
}
示例9: index
/**
* Display a listing of the resource.
* GET /admpedido
*
* @return Response
*/
public function index()
{
$filter = DataFilter::source(Pedido::with('cliente', 'status'));
$filter->add('nome', 'Nome do Cliente', 'text');
$filter->add('email', 'Email do Cliente', 'text');
$filter->add('status.nome', 'Status do pedido', 'select')->options(PedidoStatus::lists("nome_br", "id"));
$filter->submit('Filtrar');
$filter->reset('Limpar Filtro');
$filter->build();
$grid = DataGrid::source($filter);
//same source types of DataSet
$grid->attributes(array("class" => "table table-striped table-hover"));
$grid->add('id', 'Id Pedido', true);
//field name, label, sortable
$grid->add('nome', 'Nome do Cliente', true);
//field name, label, sortable
$grid->add('email', 'Email do Cliente');
//relation.fieldname
$grid->add('status.nome_br', 'Status do Pedido');
//relation.fieldname
$grid->add('total', 'Valor do Pedido');
$grid->add('created_at', 'Data do Pedido', true);
$grid->add('
<a class="" title="Modificar" href="admin/pedido/{{$id}}/edit"><span class="glyphicon glyphicon-edit"> </span></a>
<a class="text-danger" title="Deletar" href="admin/pedido/delete/{{$id}}"><span class="glyphicon glyphicon-trash"> </span></a>
', 'Ações');
//$grid->edit('admin/serviconoturno/crud', 'Ações','show|modify|delete'); //shortcut to link DataEdit actions
$grid->orderBy('id', 'desc');
//default orderby
$grid->paginate(10);
//pagination
$grid->attributes(array('class' => 'table table-striped table-hover'));
return View::make('admin.pedido.index', compact('filter', 'grid'));
}
示例10: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show(Variable $variable, Request $request)
{
if ($request->ajax()) {
//use query builder instead of eloquent
$rawData = DB::table('data_values')->join('entities', 'data_values.fk_ent_id', '=', 'entities.id')->join('times', 'data_values.fk_time_id', '=', 'times.id')->where('data_values.fk_var_id', $variable->id)->get();
$data = [];
$index = 1;
foreach ($rawData as $d) {
if (!array_key_exists($d->name, $data)) {
$obj = new \StdClass();
$obj->id = $index;
$obj->key = $d->name;
$obj->values = [];
$data[$d->name] = $obj;
$index++;
}
$data[$d->name]->values[] = ["x" => intval($d->label), "y" => intval($d->value)];
}
return ['success' => true, 'data' => ['variable' => $variable, 'data' => $data]];
} else {
//data
/*$source = DB::table( 'data_values' )
->leftJoin( 'entities', 'data_values.fk_ent_id', '=', 'entities.id' )
->leftJoin( 'times', 'data_values.fk_time_id', '=', 'times.id' )
->select( DB::raw( 'data_values.*, times.label, entities.name' ) );*/
$source = DataValue::grid()->where('fk_var_id', '=', $variable->id);
//$source = DataValue::with( array('Entity','Time') )->where( 'fk_var_id', '=', $variable->id );
$entityList = DataValue::where('fk_var_id', '=', $variable->id)->lists('fk_var_id');
$entities = Entity::whereIn('id', $entityList);
//datagrid & filter
$filter = \DataFilter::source($source);
$filter->attributes(array('class' => 'form-inline'));
$filter->add('value', 'Value', 'text');
$entitiesList = Entity::lists('name', 'name');
$entitiesList[''] = 'All';
$filter->add('Entities.name', 'Entity', 'select')->options($entitiesList);
$filter->add('Times.label', 'Time', 'text');
$filter->submit('search');
$filter->build();
$grid = \App\Components\BatchDataGrid::source($filter);
$grid->add('id', 'ID', true)->style('width:100px');
$grid->add('value', 'Value', true);
$grid->add('name', 'Entity', true);
$grid->add('label', 'Time', true);
$grid->add('description', 'Description');
$grid->add('<a href="' . route('values.index') . '/{{$id}}/edit">Edit</a>', 'Edit');
$grid->paginate(50);
//is csv export?
if (Input::has('export') && Input::get('export') == 'csv') {
return $grid->buildCSV('export_variable', 'Y-m-d.His');
}
//construct csv export url
$exportUrl = $request->fullUrl() . '&export=csv';
return view('variables.show', compact('variable', 'values', 'grid', 'filter', 'exportUrl'));
}
}
示例11: all
public function all($entity)
{
parent::all($entity);
$this->filter = \DataFilter::source(new \App\Grupo());
$this->filter->add('nome', 'Name', 'text');
$this->filter->submit('search');
$this->filter->reset('reset');
$this->filter->build();
$this->grid = \DataGrid::source($this->filter);
$this->grid->add('nome', 'Name');
$this->addStylesToGrid();
return $this->returnView();
}
示例12: all
public function all($entity)
{
parent::all($entity);
$this->filter = \DataFilter::source(new \App\Area());
$this->filter->add('nombre', 'Nombre', 'text');
$this->filter->submit('Buscar');
$this->filter->reset('Limpiar');
$this->filter->build();
$this->grid = \DataGrid::source($this->filter);
$this->grid->add('nombre', 'Nombre');
$this->addStylesToGrid();
return $this->returnView();
}
示例13: all
public function all($entity)
{
parent::all($entity);
$this->filter = \DataFilter::source(new \App\Admins());
$this->filter->add('first_name', 'Nome', 'text');
$this->filter->submit('buscar');
$this->filter->reset('resetar');
$this->filter->build();
$this->grid = \DataGrid::source($this->filter);
$this->grid->add('first_name', 'Name');
$this->grid->add('email', 'Email');
$this->addStylesToGrid();
return $this->returnView();
}
示例14: all
public function all($entity)
{
parent::all($entity);
$this->filter = \DataFilter::source(new \App\Categoria());
$this->filter->add('name', 'Nome', 'text');
$this->filter->submit('buscar');
$this->filter->reset('resetar');
$this->filter->build();
$this->grid = \DataGrid::source($this->filter);
$this->grid->add('id', 'ID');
$this->grid->add('name', 'Nome');
$this->addStylesToGrid();
return $this->returnView();
}
示例15: all
public function all($entity)
{
parent::all($entity);
$this->filter = \DataFilter::source(new \App\Newsletter());
$this->filter->add('name', 'Nome', 'text');
$this->filter->submit('Buscar');
$this->filter->reset('resetar');
$this->filter->build();
$this->grid = \DataGrid::source($this->filter);
$this->grid->add('name', 'Nome');
$this->grid->add('email', 'Email');
$this->grid->add('bairro', 'Bairro');
$this->addStylesToGrid();
return $this->returnView();
}