承接 jamesdordoy/laravelvuedatatable 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jamesdordoy/laravelvuedatatable

最新稳定版本:1.3.8

Composer 安装命令:

composer require jamesdordoy/laravelvuedatatable

包简介

无描述信息

README 文档

README

A Vue.js Datatable Component for Laravel that works with Bootstrap.

Requirements

This package makes use of an optional default component, the Laravel Vue Pagination component created by gilbitron. If you need a pagination component for other areas of your website and you are using a Laravel API & Bootstrap, i highly suggest using this flexible component.

Demo

See https://jamesdordoy.github.io/laravel-vue-datatable/

Table of Contents

Example

Image description

Package Installation

$ composer require jamesdordoy/laravelvuedatatable 

Add Service Provider

JamesDordoy\LaravelVueDatatable\Providers\LaravelVueDatatableServiceProvider::class, 

Publish the Config

$ php artisan vendor:publish --provider="JamesDordoy\LaravelVueDatatable\Providers\LaravelVueDatatableServiceProvider" 

Package Options

[ 'models' => [ "alias" => "as", "search_term" => "searchable", "order_term" => "orderable", ], "default_order_by" => "id" ]

Use the Trait

This trait is optional and simply provides a basic method for filtering your data based on the $dataTableColumns attribute set in the model. If you would like more control on how the data is filtered, feel free to omit this trait use your own filtering methods. Just remember to paginate the results!

<?php namespace App; use Illuminate\Notifications\Notifiable; use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Foundation\Auth\User as Authenticatable; use JamesDordoy\LaravelVueDatatable\Traits\LaravelVueDatatableTrait; class User extends Authenticatable { use Notifiable, LaravelVueDatatableTrait; protected $dataTableColumns = [ 'id' => [ 'searchable' => false, ], 'name' => [ 'searchable' => true, ], 'email' => [ 'searchable' => true, ] ]; }

Use the Controller Resource

The Collection Resource is expecting a paginated collection, so feel free to use your own queries and omit the provided query if your require more complex filtering.

<?php namespace App\Http\Controllers; use App\User; use Illuminate\Http\Request; use JamesDordoy\LaravelVueDatatable\Http\Resources\DataTableCollectionResource; class UserController extends Controller { public function index(Request $request) { $length = $request->input('length'); $orderBy = $request->input('column'); //Index $orderByDir = $request->input('dir', 'asc'); $searchValue = $request->input('search'); $query = User::eloquentQuery($orderBy, $orderByDir, $searchValue); $data = $query->paginate($length); return new DataTableCollectionResource($data); } }

Component Installation

See https://github.com/jamesdordoy/vue-datatable

统计信息

  • 总下载量: 172.11k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 49
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 49
  • Watchers: 5
  • Forks: 16
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固