Laravel Kyslik/列可排序包,排序不起作用,但分页正常
型号: 视图刀片:Laravel Kyslik/列可排序包,排序不起作用,但分页正常,laravel,sortables,Laravel,Sortables,型号: 视图刀片: public function index() { $exam_scheds= Exam_sched::sortable()->paginate(3); return view('examschedule',compact('exam_scheds')); } /** * Show the form for creating a new resource. * * @return \
public function index()
{
$exam_scheds= Exam_sched::sortable()->paginate(3);
return view('examschedule',compact('exam_scheds'));
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
$exam_scheds=Exam_sched::sortable()->paginate(3);
$subjects=Subject::all();
$batches=Batch::all();
return view('examschedule', compact('exam_scheds','subjects','batches'));
}
Kyslik/列可排序包,排序不起作用,但分页正常。
这里有人请帮帮我…谢谢
Kyslik/列可排序包,排序不起作用,但分页正常。
这里有人请帮帮我…谢谢!
Kyslik/列可排序包,排序不起作用,但分页正常。
这里有人请帮帮我…谢谢 @sortablelink第一个参数是数据库名称中的列,第二个参数是将在视图中呈现的名称 请参见此处的示例:
因此,您的
@sortablelink('test Date')
应该是@sortablelink('Date','test Date')
@sortablelink第一个参数是数据库名称中的列,第二个参数是将在视图中呈现的名称
请参见此处的示例:
所以你的@sortablelink('test Date')
应该是@sortablelink('Date','test Date')
public function index()
{
$exam_scheds= Exam_sched::sortable()->paginate(3);
return view('examschedule',compact('exam_scheds'));
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
$exam_scheds=Exam_sched::sortable()->paginate(3);
$subjects=Subject::all();
$batches=Batch::all();
return view('examschedule', compact('exam_scheds','subjects','batches'));
}
<div class="row schedule-form">
<div class="col-lg-10 offset-lg-1">
<table class="table table-striped ">
<thead>
<tr class="thead">
<th style="width: 150px">@sortablelink('Exam Date')</th>
<th style="width: 100px">@sortablelink('Batch')</th>
<th style="width: 100px">@sortablelink('Subject')</th>
<th style="width: 110px">@sortablelink('Room No')</th>
<th>@sortablelink('Start Time')</th>
<th>@sortablelink('End Time')</th>
<th>@sortablelink('Created At')</th>
@auth
@if(Auth::user()->role_id == 1)
<th>Action</th>
@endif
@endauth
</tr>
</thead>
<tbody>
@if($exam_scheds->count())
@foreach($exam_scheds as $exam_sched)
<tr class="tbody">
<td>{{$exam_sched->date}}</td>
<td>{{$exam_sched->batch->name}}</td>
<td>{{$exam_sched->subject->name}}</td>
<td>{{$exam_sched->roomNo}}</td>
<td>{{$exam_sched->startTime}}</td>
<td>{{$exam_sched->endTime}}</td>
<td>{{$exam_sched->created_at->diffForHumans()}}</td>
</tr>
@endforeach
@endif
</tbody>
</table>
{!! $exam_scheds->appends(\Request::except('page'))->render() !!}
</div>
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/*
* Package Service Providers...
*/
Kyslik\ColumnSortable\ColumnSortableServiceProvider::class,
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
],