public function getListGroupsTwo(Request $request) { $idCustomer = $request->input('idCustomer', null); $table = Groups::leftJoin('customers', 'groups.customer_id', '=', 'customers.id')->select(['groups.id', 'groups.customer_id', 'groups.name', 'groups.datecreate', 'customers.name_customer as cliente', DB::raw("(if(groups.flagactive='1','Activo',(if(groups.flagactive='0','Inactivo','-')))) as flagactive")]); if ($idCustomer != null) { $table = $table->whereCustomerId($idCustomer); } $table->orderBy('groups.id', 'desc'); $datatable = Datatables::of($table)->addColumn('action', function ($table) { return '<a href="' . $table->id . '" class="btn btn-warning">Editar</a> <a href="#" data-url="/admclient/' . self::NAMEC . '/delete/' . $table->id . '" class="btn btn-danger action_delete" data-id="' . $table->id . '" >Eliminar</a>'; }); return $datatable->make(true); }
public function getGroupsDataTableAll() { $table = Groups::leftJoin('customers', 'groups.customer_id', '=', 'customers.id')->select(['groups.id', 'groups.customer_id', 'groups.name', 'groups.datecreate', 'customers.name_customer as cliente', DB::raw("(if(groups.flagactive='1','Activo',(if(groups.flagactive='0','Inactivo','-')))) as flagactive")])->where('groups.flagactive', '=', '1')->orderBy('groups.id', 'desc')->get(); return $table; }