of() public static method

Gets query and returns instance of class.
public static of ( mixed $object ) : mixed
$object mixed
return mixed
 /**
  * @param Request $request
  * @param Builder $htmlBuilder
  * @return $this This Index function include useless function like removeColumn , I wrote some method for show extra usage of datatable if
  * you want more complex datatable query please check the plugin's demo project. PLEASE READ DOCUMENTATION !!!
  * LINK =====> https://github.com/yajra/laravel-datatables-demo
  *
  * YAJRA DATATABLE PLUGINS ......
  */
 public function index(Datatables $datatables)
 {
     if ($this->currentUser->hasAccess('wts.user.show')) {
         if ($datatables->getRequest()->ajax()) {
             $users = DB::table('users')->select(['id', DB::raw("CONCAT(users.first_name,' ',users.last_name) as full_name"), 'slug', 'phone', 'password', 'email', 'created_at', 'updated_at']);
             return Datatables::of($users)->filterColumn('full_name', 'whereRaw', "CONCAT(users.first_name,' ',users.last_name) like ?", ["\$1"])->addColumn('action', function ($user) {
                 if ($this->currentUser->hasAccess('wts.user.edit')) {
                     $edit = $this->createEditButton('/admin/users/' . $user->slug . '/edit');
                 } else {
                     $edit = '';
                 }
                 if ($this->currentUser->hasAccess('wts.user.delete')) {
                     $delete = $this->createDeleteButton($user->id, 'admin.users.destroy');
                 } else {
                     $delete = '';
                 }
                 if ($this->currentUser->hasAccess('wts.user.show')) {
                     $use = '<a href="' . url("admin/users/") . "/" . $user->slug . '/use"
                             class="btn btn-warning" data-tooltip="true" title="Oturumu Kullan" ><i class="fa fa-user"></i></a>&nbsp;';
                 } else {
                     $use = '';
                 }
                 return $use . ' ' . $edit . ' ' . $delete;
             })->make(true);
         }
         $html = $datatables->getHtmlBuilder()->addColumn(['data' => 'full_name', 'name' => 'full_name', 'title' => 'Ad Soyad'])->addColumn(['data' => 'email', 'name' => 'email', 'title' => 'Email'])->addColumn(['data' => 'phone', 'name' => 'phone', 'title' => 'Telefon'])->addColumn(['data' => 'created_at', 'name' => 'created_at', 'title' => 'Created At'])->addColumn(['data' => 'updated_at', 'name' => 'updated_at', 'title' => 'Updated At'])->addColumn(['data' => 'action', 'name' => 'action', 'title' => 'İşlemler', 'orderable' => false, 'searchable' => false])->parameters(array('order' => [3, 'desc']));
         $data = ['menu' => 'users', 'page_title' => 'Kullanıcılar', 'page_description' => 'Sistem Kullanıcılara Ait Özellikler Bu Sayfada Yer Almaktadır'];
         return view('admin.user-group.user.index', $data)->with(compact('html'));
     } else {
         abort(403, $this->accessForbidden);
     }
 }
Ejemplo n.º 2
1
 /**
  * Process datatables ajax request.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function search()
 {
     $auth_account = $this->auth_user->account;
     //return all accounts when we are in the system account
     //in a normal account only show the current linked one
     if ($auth_account->isSystemAccount()) {
         $accounts = Account::all();
     } else {
         // retrieve the account as a collection
         $accounts = Account::where('id', '=', $auth_account->id)->get();
     }
     return Datatables::of($accounts)->addColumn('actions', function ($account) {
         $actions = \Form::open(['route' => ['admin.accounts.destroy', $account->id], 'method' => 'DELETE', 'class' => 'form-inline']);
         $actions .= ' <a href="accounts/' . $account->id . '" class="btn btn-xs btn-primary"><span class="glyphicon glyphicon-eye-open"></span> ' . trans('misc.button.show') . '</a> ';
         $actions .= ' <a href="accounts/' . $account->id . '/edit" class="btn btn-xs btn-primary"><span class="glyphicon glyphicon-edit"></span> ' . trans('misc.button.edit') . '</a> ';
         if ($account->disabled) {
             $actions .= ' <a href="accounts/' . $account->id . '/enable' . '" class="btn btn-xs btn-success"><span class="glyphicon glyphicon-ok-circle"></span> ' . trans('misc.button.enable') . '</a> ';
         } else {
             $actions .= ' <a href="accounts/' . $account->id . '/disable' . '" class="btn btn-xs btn-warning"><span class="glyphicon glyphicon-ban-circle"></span> ' . trans('misc.button.disable') . '</a> ';
         }
         $actions .= \Form::button('<i class="glyphicon glyphicon-remove"></i> ' . trans('misc.button.delete'), ['type' => 'submit', 'class' => 'btn btn-danger btn-xs']);
         $actions .= \Form::close();
         return $actions;
     })->make(true);
 }
Ejemplo n.º 3
0
 public function anyData()
 {
     $hotel = Hoteluri::with('HoteluriOferte');
     return Datatables::of($hotel)->addColumn('action', function ($hotel) {
         return '<a href="' . url('auth/hoteluri', [$hotel->id, 'edit']) . '"><button type="submit" class="btn btn-primary btn-xs">Modifica</button></a>  ' . \Form::open(['method' => 'DELETE', 'url' => ['auth/hoteluri', $hotel->id], "style" => "display:inline"]) . '<button type="submit" class="btn btn-danger btn-xs" onclick="if(confirm(\'Sigur doriti sa stergeti?\')) return true; else return false; ">Sterge</button>' . \Form::close();
     })->make(true);
 }
Ejemplo n.º 4
0
 /**
  * Process datatables ajax request.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function search()
 {
     $auth_account = $this->auth_user->account;
     $tickets = Ticket::select('tickets.id', 'tickets.ip', 'tickets.domain', 'tickets.type_id', 'tickets.class_id', 'tickets.status_id', 'tickets.ip_contact_account_id', 'tickets.ip_contact_reference', 'tickets.ip_contact_name', 'tickets.domain_contact_account_id', 'tickets.domain_contact_reference', 'tickets.domain_contact_name', DB::raw('count(distinct events.id) as event_count'), DB::raw('count(distinct notes.id) as notes_count'))->leftJoin('events', 'events.ticket_id', '=', 'tickets.id')->leftJoin('notes', function ($join) {
         // We need a LEFT JOIN .. ON .. AND ..).
         // This doesn't exist within Illuminate's JoinClause class
         // So we use some nesting foo here
         $join->on('notes.ticket_id', '=', 'tickets.id')->nest(function ($join) {
             $join->on('notes.viewed', '=', DB::raw("'false'"));
         });
     })->groupBy('tickets.id');
     if (!$auth_account->isSystemAccount()) {
         // We're using a grouped where clause here, otherwise the filtering option
         // will always show the same result (all tickets)
         $tickets = $tickets->where(function ($query) use($auth_account) {
             $query->where('tickets.ip_contact_account_id', '=', $auth_account->id)->orWhere('tickets.domain_contact_account_id', '=', $auth_account->id);
         });
     }
     return Datatables::of($tickets)->addColumn('actions', function ($ticket) {
         $actions = ' <a href="tickets/' . $ticket->id . '" class="btn btn-xs btn-primary"><span class="glyphicon glyphicon-eye-open"></span> ' . trans('misc.button.show') . '</a> ';
         return $actions;
     })->editColumn('type_id', function ($ticket) {
         return trans('types.type.' . $ticket->type_id . '.name');
     })->editColumn('class_id', function ($ticket) {
         return trans('classifications.' . $ticket->class_id . '.name');
     })->editColumn('status_id', function ($ticket) {
         return trans('types.status.abusedesk.' . $ticket->status_id . '.name');
     })->make(true);
 }
Ejemplo n.º 5
0
 /**
  * 列出选课日志
  * @author FuRongxin
  * @date    2016-02-06
  * @version 2.0
  * @return  JSON 选课日志
  */
 public function listing()
 {
     $logs = Slog::whereXh(Auth::user()->xh)->orderBy('czsj', 'desc');
     return Datatables::of($logs)->editColumn('czlx', function ($log) {
         return config('constants.log.' . $log->czlx);
     })->make(true);
 }
 /**
  * @return mixed
  */
 public function getDataTable()
 {
     $categories = $this->category->select(['id', 'name', 'created_at', 'updated_at']);
     return Datatables::of($categories)->addColumn('edit', function ($category) {
         return link_to(route('backend.categories.edit', ['category' => $category->id]), 'Edit', ['data-target-model' => $category->id, 'class' => 'btn btn-xs btn-primary']);
     })->make(true);
 }
Ejemplo n.º 7
0
 public function getAdminOrganizations()
 {
     $organizations = \App\Models\Organization::all();
     $datatables = Datatables::of($organizations)->addColumn('document', function ($organization) {
         $orgdocs = $organization->orgdocs;
         if ($orgdocs->count()) {
             $document = 'Загружен';
         } else {
             $document = 'Не Загружен';
         }
         return $document;
     })->addColumn('repetition', function ($organization) {
         $user = $organization->user;
         $documents_movalbes = $user->documents()->whereDocument_typeAndOs_type('residues_entering', 'movables')->count();
         $document_value_movables = $user->documents()->whereDocument_typeAndOs_type('residues_entering', 'value_movables')->count();
         $document_car = $user->documents()->whereDocument_typeAndOs_type('residues_entering', 'car')->count();
         $document_buildings = $user->documents()->whereDocument_typeAndOs_type('residues_entering', 'buildings')->count();
         $document_parcels = $user->documents()->whereDocument_typeAndOs_type('residues_entering', 'parcels')->count();
         if ($documents_movalbes > 1 || $document_value_movables > 1 || $document_car > 1 || $document_buildings > 1 || $document_parcels > 1) {
             $repetition = 'Есть повтор';
         } else {
             $repetition = 'Нет';
         }
         return $repetition;
     })->addColumn('action', function ($organization) {
         return '<a href="admin/organization/' . $organization->id . '" class="actions icons"><i class="fa fa-eye"></i></a><a href="/organization/' . $organization->id . '/edit" class="actions icons"><i class="fa fa-pencil-square-o"></i></a>';
     });
     return $datatables->make(true);
 }
 public function dataFijo($categoria)
 {
     if ($categoria == 'todos') {
         $conceptosfijos = ConceptoCategory::with('Concepto')->with('Categoria')->get(array("id", "concepto_id", "categoria_id", "cantidad", "importe"));
     } else {
         $conceptosfijos = ConceptoCategory::with('Concepto')->with('Categoria')->DelaCategoria($categoria)->get(array("id", "concepto_id", "categoria_id", "cantidad", "importe"));
     }
     //var action= $(e.relatedTarget).attr('data-id');
     //var concepto_id = $(e.relatedTarget).attr('data-concepto_id');
     //var concepto = $(e.relatedTarget).attr('data-concepto');
     //var employee_id = $(e.relatedTarget).attr('data-employee_id');
     //var nombre = $(e.relatedTarget).attr('data-nombre');
     //var importe =$(e.relatedTarget).attr('data-importe');
     //        //var cantidad =$(e.relatedTarget).attr('data-cantidad');
     //        "concepto.codigo"},
     //{"targets": [2], "data": "concepto.detalle"
     return Datatables::of($conceptosfijos)->add_column('actions', '
            <div class="btn-group" align="center">
                 <a class="btn btn-xs btn-primary" type="button" data-toggle="modal" data-target="#confirmEditConceptoFijo"
                    data-title="Update Type" data-concepto_id="{{{$concepto["codigo"]}}}" data-concepto="{{{$concepto["detalle"]}}}"
                    data-categoria_id="{{{ $categoria_id }}}" data-categoria="{{{ $categoria["category"] }}}"
                    data-importe="{{{ $importe }}}" data-cantidad="{{{ $cantidad }}}"
                    data-id="{{{ URL::to(\'conceptos/categorias/\' .$id   ) }}}">
                     <i class="fa fa-pencil" aria-hidden="true"></i>Edit</a>
                 <a class="btn btn-xs btn-danger" type="button" data-toggle="modal" data-target="#confirmDeletegr"
                    data-id="{{{ URL::to(\'conceptos/categorias/\' . $id . \'/delete\' ) }}}" data-title="Delete Type"
                    data-message="Are you sure to delete this Option ?">
                     <i class="fa fa-trash-o" aria-hidden="true"></i>Delete</a>
             </div>
                     	')->make(true);
 }
 public function showOrderListAjaxHandler()
 {
     $objModelOrder = Order::getInstance();
     $selectedColumns = ['users.name', 'orders.*', 'plans.plan_name'];
     $allOrders = $objModelOrder->getAvaiableUserDetailsFromOrders($selectedColumns);
     $orders = new Collection();
     $allOrders = json_decode(json_encode($allOrders), true);
     $i = 0;
     foreach ($allOrders as $order) {
         $id = $order['order_id'];
         $reAdd = '';
         $cancel = '';
         if ($order['status'] == 0) {
             $status = '<span class="label label-info"><i class="fa fa-clock-o"></i> Pending</span>';
             //                $reAdd = '<button class="label label-warning" id="reAdd"> Re-add</button>';
             //                $cancel = '<button class="bond label label-warning" id="cancel" data-id=' . $id . '> Cancel</a>';
             //                $cancel = '<span class="btn popovers btn-default btn-xs"><i class="fa fa-info-circle"></i> Cancel</span>';
             //                $reAdd = '<span class="btn popovers btn-default btn-xs"><i class="fa fa-info-circle"></i> Re-Add </span>';
         } elseif ($order['status'] == 1) {
             $status = '<span class="label label-info"><i class="fa fa-refresh fa-spin"></i>Processing</span>';
         } elseif ($order['status'] == 2) {
             $status = '<span class="label label-info"><i class="fa fa-refresh fa-spin"></i>Processing</span>';
         } elseif ($order['status'] == 3) {
             $status = '<span class="label label-primary"><i class="fa fa-check-circle"></i> Completed</span>';
         } elseif ($order['status'] == 4) {
             $status = 'Failed';
         } elseif ($order['status'] == 5) {
             $status = '<span class="label label-warning"><i class="fa fa-dollar"></i>Refunded</span>';
         } else {
             $status = '<span class="label label-danger"><i class="fa fa-times-circle"></i> Cancelled</span>';
         }
         $orders->push(['chck' => '<input type="checkbox" class="orderCheckBox" name="checkbox" value="' . $id . '">', 'id' => ++$i, 'order_id' => $order['order_id'], 'by_user_id' => $order['name'], 'plan_id' => $order['plan_name'], 'ins_url' => '<a href="' . $order['ins_url'] . '" target="_blank">' . $order['ins_url'] . '</a>', 'quantity_total' => $order['quantity_total'], 'status' => $status, 'view' => '<a class="btn  btn-sm btn-default btn-raised" data-toggle="modal" data-target="#modal1" data-id=' . $id . ' style="margin-left:1%;">details</a>']);
     }
     return Datatables::of($orders)->make(true);
 }
 public function data($legajos, $conceptos)
 {
     if ($legajos == 'todos') {
         if ($conceptos == 'todos') {
             $conceptosfijos = ConceptoFijo::with('Concepto')->with('Empleado')->get(array("id", "concepto_id", "employees_id", "importe", "cantidad"));
         } else {
             $conceptosfijos = ConceptoFijo::with('Concepto')->with('Empleado')->DelConcepto($conceptos)->get(array("id", "concepto_id", "employees_id", "importe", "cantidad"));
         }
     } else {
         if ($conceptos == 'todos') {
             $conceptosfijos = ConceptoFijo::with('Concepto')->with('Empleado')->DelLegajo($legajos)->get(array("id", "concepto_id", "employees_id", "importe", "cantidad"));
         } else {
             $conceptosfijos = ConceptoFijo::with('Concepto')->with('Empleado')->DelLegajo($legajos)->DelConcepto($conceptos)->get(array("id", "concepto_id", "employees_id", "importe", "cantidad"));
         }
     }
     return Datatables::of($conceptosfijos)->add_column('actions', '
            <div class="btn-group" align="center">
                 <a class="btn btn-xs btn-primary" type="button" data-toggle="modal" data-target="#confirmEditConceptoFijo"
                    data-title="Update Type" data-concepto_id="{{{$concepto["codigo"]}}}" data-concepto="{{{$concepto["detalle"]}}}"
                    data-employees_id="{{{ $employees_id }}}" data-nombre="{{{ \\App\\Models\\Employees::find($employees_id)->nombre }}}"
                    data-importe="{{{ $importe }}}" data-cantidad="{{{$cantidad}}}"
                    data-id="{{{ URL::to(\'conceptofijo/\' . $concepto_id . \'/\' . $employees_id   ) }}}">
                     <i class="fa fa-pencil" aria-hidden="true"></i>Edit</a>
                 <a class="btn btn-xs btn-danger" type="button" data-toggle="modal" data-target="#confirmDeletegr"
                    data-id="{{{ URL::to(\'conceptofijo/\' . $id . \'/delete\' ) }}}" data-title="Delete Type"
                    data-message="Are you sure to delete this Option ?">
                     <i class="fa fa-trash-o" aria-hidden="true"></i>Delete</a>
             </div>
                     	')->make(true);
 }
Ejemplo n.º 11
0
 /**
  * Fetch all inactive employee records.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function fetchInactive()
 {
     $employees = App\Employee::select('EmployeeID', DB::raw('CONCAT(LastName, ", ", FirstName, " ",MiddleName) AS FullName'), 'EmailAddress')->where('Status', '=', '0')->orderBy('LastName')->get();
     return Datatables::of($employees)->addColumn('action', function ($employee) {
         return '<a href="/employees/' . $employee->EmployeeID . '" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-search"></i> View</a>&nbsp;' . '<a href="/employees/' . $employee->EmployeeID . '/edit" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-edit"></i> Edit</a>&nbsp;';
     })->make(true);
 }
 /**
  * Show a list of all the languages posts formatted for Datatables.
  *
  * @return Datatables JSON
  */
 public function data()
 {
     $questions = Question::whereNull('questions.deleted_at')->where('questions.user_id', '=', Auth::id())->join('question_categories', 'question_categories.id', '=', 'questions.question_category_id')->join('answers', 'answers.question_id', '=', 'questions.id')->select(array('questions.id', 'question_categories.name as category', 'questions.content', 'answers.content AS answer_content', 'questions.created_at', 'questions.updated_at'))->orderBy('questions.updated_at', 'DESC');
     return Datatables::of($questions)->add_column('actions', '
             <a href="{{{ URL::to(\'question/\' . $id . \'/delete\' ) }}}" class="btn btn-sm btn-danger iframe"><span class="glyphicon glyphicon-trash"></span> {{ trans("admin/modal.delete") }}</a>
             <input type="hidden" name="row" value="{{$id}}" id="row">')->remove_column('id')->make();
 }
Ejemplo n.º 13
0
 /**
  * @param $id
  * @param Request $request
  * @return mixed
  * 获取商品详情
  */
 public function productData($id)
 {
     $products = OrderProduct::select('name', 'count')->where('sub_order_id', $id)->get();
     //设置table
     $datatables = Datatables::of($products);
     return $datatables->make(true);
 }
 public function data($mes, $anio, $legajos, $conceptos)
 {
     if ($legajos == 'todos') {
         if ($conceptos == 'todos') {
             $conceptosVariables = ConceptoVariable::with('Concepto')->with('Empleado')->DelPeriodo($mes, $anio)->get(array("id", "concepto_id", "employees_id", "importe", "cantidad", "mes", "anio"));
         } else {
             $conceptosVariables = ConceptoVariable::with('Concepto')->with('Empleado')->DelPeriodo($mes, $anio)->DelConcepto($conceptos)->get(array("id", "concepto_id", "employees_id", "importe", "cantidad", "mes", "anio"));
         }
     } else {
         if ($conceptos == 'todos') {
             $conceptosVariables = ConceptoVariable::with('Concepto')->with('Empleado')->DelPeriodo($mes, $anio)->DelLegajo($legajos)->get(array("id", "concepto_id", "employees_id", "importe", "cantidad", "mes", "anio"));
         } else {
             $conceptosVariables = ConceptoVariable::with('Concepto')->with('Empleado')->DelPeriodo($mes, $anio)->DelLegajo($legajos)->DelConcepto($conceptos)->get(array("id", "concepto_id", "employees_id", "importe", "cantidad", "mes", "anio"));
         }
     }
     //return $conceptos = Concepto::with('EsVariableDe')->where('esfijo', '!=', 'S')
     //    ->where('anio',$year)->get();
     return Datatables::of($conceptosVariables)->add_column('actions', '
         				<div class="btn-group" align="center">
                              <a class="btn btn-primary btn-xs" type="button" data-toggle="modal"
                                id="btnUpdateVariable" data-target="#confirmUpdateConceptoVariable"
                                data-mes="{{$mes}}" data-anio="{{$anio}}" data-concepto_id="{{$concepto_id}}"
                               data-employees_id="{{$employees_id}}"  data-importe="{{$importe}}" data-cantidad="{{$cantidad}}"
                                data-id="{{{ URL::to(\'conceptovariable/\' . $id   ) }}}">
                                 <i class="fa fa-pencil" aria-hidden="true"></i>Editar
                             </a>
                         <a class="btn btn-xs btn-danger" type="button" data-toggle="modal" data-target="#confirmDeletegr"  data-id="{{{ URL::to(\'conceptovariable/\' .$id . \'/delete\' ) }}}" data-title="Delete Type" data-message="Are you sure to delete this Option ?" >
                         <i class="fa fa-trash-o" aria-hidden="true"></i>Delete</a>
                         </div>
                     	')->make(true);
 }
Ejemplo n.º 15
0
    public function getIncidents()
    {
        $incidents = ITP::select(['ID', 'Title', 'ReportingOrg', 'ImpactDescription', 'BriefDescription', 'IncidentLevel', 'Date', 'Section', 'IncidentOwner', 'Engineer', 'IncidentStatus']);
        $datatables = Datatables::of($incidents)->editColumn('BriefDescription', function ($incident) {
            return '
					<div class="text-semibold"><a href="./incident/' . $incident->ID . '/edit">' . str_limit($incident->Title, 40) . '</a></div>
                    <div class="text-muted">' . str_limit($incident->BriefDescription, 80) . '</div>
				';
        })->removeColumn('Title');
        if ($months = $datatables->request->get('months')) {
            $datatables->where(function ($query) use($months) {
                foreach ($months as $month) {
                    $query->orWhereRaw('MONTH(Date) = ' . $month);
                }
            });
        }
        if ($quarters = $datatables->request->get('quarters')) {
            $datatables->where(function ($query) use($quarters) {
                foreach ($quarters as $quarter) {
                    $query->orWhereRaw('MONTH(Date) = ' . $quarter);
                }
            });
        }
        if ($years = $datatables->request->get('years')) {
            $datatables->where(function ($query) use($years) {
                foreach ($years as $year) {
                    $query->orWhereRaw('YEAR(Date) = ' . $year);
                }
            });
        }
        return $datatables->make(true);
    }
 /**
  * @return mixed
  */
 public function getDataTable()
 {
     $articles = $this->articlesEntity->select(['id', 'topic', 'created_at', 'updated_at']);
     return Datatables::of($articles)->addColumn('edit', function ($article) {
         return link_to(route('backend.articles.edit', ['articles' => $article->id]), 'Edit', ['data-target-model' => $article->id, 'class' => 'btn btn-xs btn-primary']);
     })->make(true);
 }
 /**
  * @return mixed
  */
 public function getDataTable()
 {
     $categories = $this->subcategory->with(['category'])->select('*');
     $data = Datatables::of($categories)->addColumn('edit', function ($subcat) {
         return link_to(route('backend.subcategories.edit', ['subcategory' => $subcat->id]), 'Edit', ['data-target-model' => $subcat->id, 'class' => 'btn btn-xs btn-primary']);
     });
     return $data->make(true);
 }
Ejemplo n.º 18
0
 /**
  * Get Docs current user is authorised to manage + Process datatables ajax request.
  */
 public function getToolbox(Request $request)
 {
     $company_list = [Auth::user()->company->id, Auth::user()->company->reportsToCompany()->id];
     //$company_list = [3, 27];
     $records = SafetyDoc::select(['id', 'type', 'site_id', 'reportfile', 'name'])->where('type', 'TOOL')->whereIn('company_id', $company_list)->where('status', '1');
     $dt = Datatables::of($records)->editColumn('id', '<div class="text-center"><a href="/filebank/whs/toolbox/{{$reportfile}}"><i class="fa fa-file-text-o"></i></a></div>')->make(true);
     return $dt;
 }
Ejemplo n.º 19
0
 public function customer_data()
 {
     \DB::statement(\DB::raw('set @rownum=0'));
     $customers = Customer::select([\DB::raw('@rownum  := @rownum  + 1 AS rownum'), 'id', 'name', 'address', 'phone', 'membership']);
     return Datatables::of($customers)->addColumn('action', function ($customer) {
         return '<a href="./customer/edit/' . $customer->id . '" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-edit"></i> Edit</a>';
     })->make(true);
 }
Ejemplo n.º 20
0
 public function getOrganizations()
 {
     $organizations = \App\Models\Organization::where('type', 'client');
     $datatables = Datatables::of($organizations)->addColumn('action', function ($organization) {
         return '<a href="inspector/organization/' . $organization->id . '" class="actions icons"><i class="fa fa-eye"></i></a>';
     });
     return $datatables->make(true);
 }
 public function data()
 {
     $agentHasUsersBuilder = $this->repo->search('', false);
     return Datatables::of($agentHasUsersBuilder)->addColumn('actions', function ($model) {
         return '<a class="btn default btn-xs purple" href="/agentHasUsers/' . $model->id . '/edit' . '"><i class="fa fa-edit"></i> Editar </a>
             <a href="/agentHasUsers/' . $model->id . '/delete' . '" class="btn btn-xs red"><i class="glyphicon glyphicon-trash"></i> </a>';
     })->make(true);
 }
Ejemplo n.º 22
0
 public function item_data()
 {
     \DB::statement(\DB::raw('set @rownum=0'));
     $items = Item::select([\DB::raw('@rownum  := @rownum  + 1 AS rownum'), 'id', 'name']);
     return Datatables::of($items)->addColumn('action', function ($item) {
         return '<a href="./item/edit/' . $item->id . '" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-edit"></i> Edit</a>';
     })->make(true);
 }
 /**
  * @return mixed
  */
 public function getIntegrationsData()
 {
     return Datatables::of(Integration::all())->editColumn('type', function ($row) {
         return ucfirst($row->type);
     })->addColumn('actions', function ($row) {
         return view('notifications::integrations.partials.deleteintegration', compact('row'))->render();
     })->make(true);
 }
 public function listingAjax()
 {
     $this->gridView->_route = 'admin.usuario';
     $data = Usuario::select('id', 'nome', 'email', 'usuario', 'ativo');
     return Datatables::of($data)->edit_column('id', $this->gridView->listAddChk())->edit_column('ativo', function ($data) {
         return $this->gridView->listStatus($data);
     })->make();
 }
Ejemplo n.º 25
0
 public function getRequests(Request $request)
 {
     //$lccb = \App\Request::with('equipment', 'area', 'location', 'category', 'uploads', 'approvers', 'status', 'requester.organization');
     $lccb = \App\Request::join('areas', 'requests.functional_id', '=', 'areas.id')->join('categories', 'requests.category_id', '=', 'categories.id')->join('equipment', 'requests.equipment_id', '=', 'equipment.id')->join('users', 'requests.submitted_by', '=', 'users.id')->join('organizations', 'users.organization_id', '=', 'organizations.id')->join('status', 'requests.status_id', '=', 'status.id')->join('locations', 'requests.location_id', '=', 'locations.id')->select('requests.*', 'areas.name AS area', 'categories.name AS category', 'equipment.name AS equipment', 'users.name AS requester', 'organizations.name AS organization', 'status.name AS status', 'locations.name AS location');
     $datatables = Datatables::of($lccb)->editColumn('id', function ($lccb) {
         return "<a href='/lccb/" . $lccb->id . "/edit'>" . $lccb->id . "</a>";
     });
     return $datatables->make(true);
 }
 public function getList()
 {
     if (Auth::user()->hasRole('admin') || Auth::user()->hasRole('manager')) {
         $data = ProductionSequence::orderBy('seqId', 'ASC')->select(['id', 'title', 'created_at', 'seqId'])->where('isDelete', '!=', 1)->orWhereNull('isDelete');
         $action = '<a type="button" class="btn btn-success btn-sm" onclick="javascript:window.location=\'' . URL::to('/sequence/add') . '/{{$id}}\'"><i class="fa fa-edit"></i></a>&nbsp;<a type="button" class="btn btn-danger btn-sm" onclick="javascript:window.location=\'' . URL::to('/sequence/delete') . '/{{$id}}\'"><i class="fa fa-trash-o"></i></a>';
         return Datatables::of($data)->editColumn("created_at", $action)->make();
     }
     return Response::json([]);
 }
Ejemplo n.º 27
0
 /**
  * @return mixed
  */
 public function getLogsData()
 {
     $logs = $this->getAllSecurityLogs();
     return Datatables::of($logs)->editColumn('user', function ($row) {
         if ($row->user) {
             return $row->user->name;
         }
     })->make(true);
 }
Ejemplo n.º 28
0
 public function getData()
 {
     $pegawai = Pegawai::select('*');
     return Datatables::of($pegawai)->editColumn('tgllahir', function ($pegawai) {
         return $pegawai->tgllahir ? with(new Carbon($pegawai->tgllahir))->format('d-m-Y') : '';
     })->addColumn('action', function ($pegawai) {
         return view('pages.pegawai.action', compact('pegawai'))->render();
     })->make(true);
 }
Ejemplo n.º 29
0
 /**
  * Get Data of Categories.
  *
  * @return mixed
  */
 public function getData()
 {
     $categories = GalleryCategories::select('id', 'title');
     return Datatables::of($categories)->addColumn('action', function ($category) {
         $actions = '<a href="" data-edit="' . $category->id . '" data-toggle="modal" data-target="#editModal" class="btn btn-xs btn-primary m-r-10"><i class="glyphicon glyphicon-edit"></i> ' . trans('kgallery.options.edit') . '</a>';
         $actions .= '<a href="k_categories/delete/' . $category->id . '" class="btn btn-xs btn-danger trash"><i class="glyphicon glyphicon-trash"></i> ' . trans('kgallery.options.delete') . '</a>';
         return $actions;
     })->make(true);
 }
 /**
  * @return mixed
  */
 public function getDataTable()
 {
     $products = $this->products->with(['category', 'subcategory', 'brand', 'reviews'])->select('*');
     return Datatables::of($products)->addColumn('edit', function ($product) {
         return link_to(route('backend.products.edit', ['id' => $product->id]), 'Edit', ['data-target-model' => $product->id, 'class' => 'btn btn-xs btn-primary']);
     })->editColumn('price', function ($product) {
         return format_money($product->price);
     })->make(true);
 }