public function audit($id) { $account = Account::findOrFail($id); $logs = $account->logs; $audit = array(); $labels = array('name' => 'Nome', 'cpf_cnpj' => 'CPF/CNPJ', 'phone1' => 'Telefone', 'phone2' => 'Telefone', 'description' => 'Observações'); if ($logs) { foreach ($logs as $log) { foreach ($log->new_value as $key => $value) { $audit[] = array('label' => $labels[$key], 'old' => testVal($log->old_value, $key) ? $log->old_value[$key] : '', 'new' => testVal($log->new_value, $key) ? $log->new_value[$key] : '', 'user' => $log->user->username, 'date' => date('d/m/Y H:i:s', strtotime($log->updated_at))); } } } $grid = \DataGrid::source($audit); $grid->attributes(array("class" => "table table-striped .table-condensed")); $grid->add('label', 'Campo'); $grid->add('old', 'Valor Anterior'); $grid->add('new', 'Novo Valor'); $grid->add('user', 'Alterado por'); $grid->add('date', 'Data/Hora da Alteração'); $grid->paginate(10); return view('layouts.audit', compact('grid')); }
public function getAccountlist() { return Account::where("name", "like", \Input::get("q") . "%")->take(10)->get(); }