Browse AI Field GuideForum Podcast
All ThreadsLeaderboard
  1. Discussions

    1. Popular This Week
    2. Popular All Time
    3. Solved
    4. Unsolved
    5. No Replies Yet

afoysal's avatar

Remove Datatable

How to remove Datatable from Laravel View ? I got below code in a view file. <table> <tfoot> {!! $payers->withQueryString()->links() !!} </tfoot> </table> I am getting a pagination at the bottom of the Web Page like below. How can I remove this DataTable ? I would like to display whole records.

afoysal's avatar
afoysal's avatar LoverToHel...3yrs agoLaravel
6
1
Last reply by LoverToHelp 3yrs ago
bhaviktrambadiya's avatar

Add algorithm in database query

I have one algorithm that gives me a number (the algorithm has some other table queries) And then I need to desc that value and apply pagination to it. In this case, I have this solution I need to calculate values for all records, sort by collection, and add pagination. but in this approach, more records mean more time to calculate the value. can anyone have any solution for it

bhaviktrambadiya's avatar
bhaviktrambadiya's avatar bhaviktram...3yrs agoEloquent
2
1
Last reply by bhaviktrambadiya 3yrs ago
princeoo7's avatar

Only return products where Eloquent dailyInventory has return records

I am using below code to get the records with filter and all. Product::with(['daily_stocks' => function ($q) { $q->whereIssuedStock(480.000); }])->paginate(); now what this does it for paginate it selected 1 to 15 and on that it gets be daily_stocks record. and in the code case, very few have 480 issued stocks and for rest its empty array like belo

princeoo7's avatar
princeoo7's avatar jaseofspad...3yrs agoEloquent
12
1
Last reply by jaseofspades88 3yrs ago
username1's avatar

Livewire link not working

I tried to used livewire pagination in my table but the link is not working this is my component if(is_null($this->compare_status)){ $job_Orders = JobOrder::orderBy('created_at','desc')->paginate(10); }else{ $job_Orders = JobOrder::where('status', $this->compare_status)->paginate(10); } return view('livewire.j-o-m-s.job-order-table', [ 'job_orders'=>

username1's avatar
username1's avatar username13yrs agoLivewire
4
1
Last reply by username1 3yrs ago
RileyGWeb's avatar

Livewire component data corrupted when class is dynamically instantiated

I posted about this last week, but I've significantly narrowed down where the error occurs. I am using Livewire Datatables (https://github.com/MedicOneSystems/livewire-datatables/) and I need to dynamically build columns based on user input. Don't worry if you're not familiar with Livewire Datatables, I'll include all the context you need. All it is is a TALL-stack package for

RileyGWeb's avatar
RileyGWeb's avatar RileyGWeb3yrs agoLivewire
0
3
boyjarv's avatar

options API > Composition API attempt 1

Here is my options API: <!-- Options API --> <script> import axios from 'axios'; import LaravelVuePagination from 'laravel-vue-pagination'; import HelloWorld from '@/components/HelloWorld.vue' export default { name: 'HomeView', components: { HelloWorld, Pagination: LaravelVuePagination, }, data() { return { artwork: [], pagination: {

boyjarv's avatar
boyjarv's avatar Lumethys3yrs agoVue
10
1
Last reply by Lumethys 3yrs ago
boyjarv's avatar

How can I show that an item has been added to my list after my POST axios is successful

Hi, after posting an item to my api endpoint successfully an item has been added to my list but in order to see this at the moment I need to refresh the browser which isn't ideal. Here's my relevant pages: TodoView.vue <template> <div> <div v-if="!isLoading" class="container max-w-6xl mx-auto my-20"> <div class="flex jus

boyjarv's avatar
boyjarv's avatar boyjarv3yrs agoVue
4
1
Last reply by boyjarv 3yrs ago
Shibbir's avatar

Vue Bootstrap - How to open sidebar when Vue good table row is click?

I am using Vue Bootstrap as well as the Vue good table. Here is the good table code: <vue-good-table class="p-1" style="background-color: #fff" :columns="columns" :rows="rows" :rtl="direction" :search-options="{ enabled: true, externalQuery: searchTerm, }" :select-opti

Shibbir's avatar
Shibbir's avatar Shibbir3yrs agoVue
5
1
Last reply by Shibbir 3yrs ago
AltheaGiam's avatar

Search/Pagination

Hello, I am working on a simple page to show search results in a table format from a database. I have managed to get the search function working correctly and used Laravel's built in Pagination feature to limit the results to 5 per page, with the associated links available. The issue I am running into, is when I click on page 2, to see the next 5 results, it clears the search a

AltheaGiam's avatar
AltheaGiam's avatar Lumethys3yrs agoLaravel
15
1
Last reply by Lumethys 3yrs ago
Syed1980's avatar

I'm getting this error "Method Illuminate\Database\Eloquent\Collection::links does not exist.".

Hello All, I'm getting this error "Collection::links does not exist." while trying to perform a simple search with pagination in my Laravel application. I don't know what's wrong with my code, can anyone please check and advise? public function index(Request $request){ $products = Product::paginate(10); if($request->has('search')){ $products =

Syed1980's avatar
Syed1980's avatar Syed19803yrs agoLaravel
5
1
Last reply by Syed1980 3yrs ago
boyjarv's avatar

Unexpected mutation of Prop

Please help, I get: error Unexpected mutation of "pagination" prop vue/no-mutating-props I am following a similar style to what is done here: https://github.com/sm-jahangir/essential-laravel-vuejs/blob/master/resources/js/components/partials/PaginationComponent.vue Pease help here is my PaginateItems component: <template> <nav aria-label="..."&g

boyjarv's avatar
boyjarv's avatar boyjarv3yrs agoVue
12
1
Last reply by boyjarv 3yrs ago
eys's avatar

Data table server side in Laravel 8

how to put pagination and search bar in a table connected to MySQL in laravel 8?

eys's avatar
eys's avatar Sinnbeck3yrs agoLaravel
2
1
Last reply by Sinnbeck 3yrs ago
colinlongworth's avatar

Get the most recent, distinct record for a User

I have a User model which has many Invoices. class User extends Authenticatable { public function invoices() { return $this->hasMany(Invoice::class); } } As part of the dashboard, I want to paginate a list of invoices but only show each user once e.g. If a user has multiple invoices, they should only appear on the list once. In addition, I want to

colinlongworth's avatar
colinlongworth's avatar vincent150...3yrs agoEloquent
9
1
Last reply by vincent15000 3yrs ago
shimana's avatar

Collection::paginate does not exist

I'm using this package to like system, https://github.com/renoki-co/befriended And in this way, I show the posts that the user likes. $liking = $this->user->liking(Post::class)->where('status',5)->get() I want to display the last posts that have been liked - so I used the function -> reverse() Illuminate\Database\Eloquent\Collection {#1773 ▼ #items: array:16

shimana's avatar
shimana's avatar jlrdw3yrs agoLaravel
9
1
Last reply by jlrdw 3yrs ago
ShamiCanCode's avatar

Gate and multi role

I have two users admin and agent and there is a transaction table.In admin panel i want to show all transactions while in agent panel i want to show only those transactions made by logged in agent. I am restricting agent by not showing him that row but on the other hand pagination is working. Like if 100 rows of transactions in which agents transactions are 5 admin see these

ShamiCanCode's avatar
ShamiCanCode's avatar ShamiCanCo...3yrs agoLaravel
4
1
Last reply by ShamiCanCode 3yrs ago
ivymasterman's avatar

Any hacks or speeding up a query with multiple joins?

This is a more theoretical question. I have multiple data tables: users, user_details, projects, project_details,... I need to make an overview page, where I would paginate by users. In past, I would create eloquent relationships, and pull the data. But, on this overview page, sorting needs to be done on columns, which are spread across every mentioned table. Because of that, I

ivymasterman's avatar
ivymasterman's avatar ivymasterm...3yrs agoGeneral
22
1
Last reply by ivymasterman 3yrs ago
Emokores's avatar

Show more than one paginated data object in inertiaJS with React

Is there a way to show more than one paginated table in inertia? Inertia provides a { data } object, and apparently, you can only have one per page. How can I show another table with backend pagination on the same page? I am working with tabs and I need to display a table per tab on the same page.

Emokores's avatar
Emokores's avatar Emokores3yrs agoInertia
7
1
Last reply by Emokores 3yrs ago
Adams_'s avatar

The GET method is not supported for this route. Supported methods: POST.

So I have this livewire component with filters, search and pagination features, and everything is working fine, but after searching or filtering when I click next page on the pagination I get this error The GET method is not supported for this route. Supported methods: POST. so I read on the documentation you have to reset the page with $this->resetPage() on updatedPropert

Adams_'s avatar
Adams_'s avatar Adams_3yrs agoLivewire
3
1
Last reply by Adams_ 3yrs ago
ZoroCuba's avatar

How to use Alpine and Livewire to select multiple records from a paginated data table using checkbox?

I am implementing the functionality of selecting multiple records in a datatable and for this I use Livewire and Alpine together. In the view I use x-model to sync the value of selected checkboxes into an array using Alpine and that array is automatically synced with its corresponding counterpart in the Livewire component via @entangle(). The table records are paginated with Li

ZoroCuba's avatar
ZoroCuba's avatar ZoroCuba3yrs agoJavaScript
0
1
kenprogrammer's avatar

InertiaJS Admin LTE Images disappear after route navigation

I've integrated AdminLTE template with Inertia App (Laravel+Svelte). The app is a backend used to manage accounts or tenants in a SAAS app. When I navigate on homepage(/) or /accounts routes the images are visible but when I navigate to any other route e.g. /create the images are not loaded. When I inspect the app I see 404 errors. See images below: On home or accounts route A

kenprogrammer's avatar
kenprogrammer's avatar kenprogram...3yrs agoInertia
9
1
Last reply by kenprogrammer 3yrs ago
anjanesh's avatar

$posts->links() is hidden by default

app/Http/Controllers/CompanyController.php $companies = Company::latest()->paginate(5); resources/views/company/index.blade.php <div> {{ $companies->links() }} </div> There are 7 items and there should be pagination (2 pages) - which exist in the nav's DOM. For some reason the child DIVs of nav are hidden. Why is this hidden automatically ?

anjanesh's avatar
anjanesh's avatar ramonrietd...3yrs agoLaravel
1
1
Last reply by ramonrietdijk 3yrs ago
Reysa's avatar

Multiple filtering data with Model::query()

Hello , I'm so so sorry for title if it's bad I couldn't find better one :D My problem is I want to show a data from db but with multiple filtering I'm doing it with model::query() now but I have a big problem this is my code: $qry = Raid::query(); $first = $qry->whereIn('status', [1,4])->where('type_id', 1)->paginate(20, ['*'], 'first'); $second = $qry->whereIn('st

Reysa's avatar
Reysa's avatar Sinnbeck3yrs agoEloquent
9
1
Last reply by Sinnbeck 3yrs ago
rohansinghrawat's avatar

Ajax loading taking too much time on datatable

I am using codeigniter 3 and enabled one data table for users list ,simple stuff done here . Yes i know that this is not in laravel or any relevant platform specific problem but i think this problem is not framework specific instead it is general mysql related problem and it can be observed in any framework so hoping for help here There is one data table which fetches data on p

rohansinghrawat's avatar
rohansinghrawat's avatar rohansingh...3yrs agoGeneral
17
1
Last reply by rohansinghrawat 3yrs ago
automica's avatar

Changing links and meta in api response

I'm building a series of endpoints that we want to validate to json:api spec. In the controller i am using the following: public function __invoke(): AnonymousResourceCollection { return ClientBillingSetupResource::collection($this->provider->getData()); } The response from here returns a link and a meta object. { "links": { "firs

automica's avatar
automica's avatar automica3yrs agoCode Review
0
1
Ligonsker's avatar

Laravel Paginator and fitlering table results

If I have a table with pagination, and I need to search in the dataset - will it work? The pagination docs don't have much information about it. so if for example I have 1000 results with pagination of 10 results per page, and I add search box in the table in the frontend - will it be able to search for data not on current page?

Ligonsker's avatar
Ligonsker's avatar Ligonsker3yrs agoCode Review
2
1
Last reply by Ligonsker 3yrs ago
uniqueginun's avatar

laravel LengthAwarePaginator with API Resource

Hello there. I have this issue in my Laravel 8 app. I created a UserResource which extends Illuminate\Http\Resources\Json\JsonResource class public function toArray($request) { return [ 'id' => $this->id, 'department_id' => $this->department_id, ]; } in my controller when I do this I suppose to see pagination meta data like links and other stuff.

uniqueginun's avatar
uniqueginun's avatar uniqueginu...3yrs agoLaravel
0
2
stigo-rigo's avatar

I'm trying to implement an Ldap authentication in my laravel application, and I'm using laravel 9 and LdapRecord-laravel package

When I run the php artisan ldap:test command, I get an unsuccessful connection with the following message dap_bind(): Unable to bind to server: Can't contact LDAP server. Error Code: [-1] Diagnostic Message: null This is the .env configuration LDAP_LOGGING=true LDAP_CONNECTION=default LDAP_HOST=127.0.0.1 LDAP_USERNAME="cn=user,dc=local,dc=com" LDAP_PASSWORD=secret LDA

stigo-rigo's avatar
stigo-rigo's avatar Sinnbeck3yrs agoLaravel
4
1
Last reply by Sinnbeck 3yrs ago
Mick79's avatar

Advice on making my code more efficient

My app is... let's call it a music repository. I am at the stage now where some of my clients are storing hundreds of tracks. I never expected this when I started this thing as a hobby / weekend fuckabout project - however here we are. Some of my power users are getting timeout errors now when they view their tracks page as the system is away getting hundreds of tracks plus som

Mick79's avatar
Mick79's avatar Mick793yrs agoGeneral
2
1
Last reply by Mick79 3yrs ago
combat008's avatar

Paginator not getting styled despite tailwindcss being installed

I added pagination on my controller and index page and it did appear there, the problem is its not styled at all and I heard by default its using tailwindcss for styling yet its not being styled at all despite my project having tailwindcss installed. I ran npm run dev multiple times as well as npm run watch, "webpack compiled successfully" every time yet paginator sti

combat008's avatar
combat008's avatar combat0083yrs agoLaravel
2
1
Last reply by combat008 3yrs ago
aurelianspodarec's avatar

SEO domain.com/houses?house=flat or domain.com/houses/flat

Hi there! So I've been working on my filter, and I've though of SEO. Is it better to do this: domain.com/houses/flat or domain.com/houses?house=flat I think the first option. That should show in the google, where the below one wont right? In my case I also ran into an issue where this ?house=flat the house is a page which fights with the page pagination. I think the first URL

aurelianspodarec's avatar
aurelianspodarec's avatar johnDoe2203yrs agoGeneral
1
1
Last reply by johnDoe220 3yrs ago
LaraBABA's avatar

From normal DB query to Eloquent

Hi all, I would like to know which steps would you use to convert this into an Eloquent query please, do you know of any convertor? I have 2 problems in keeping this query this way: 1)I need pagination 2)I need to use ->where() as ->when($variable, function ($query) use ($variable) { $query->where('C1.sent', '=', $variable);

LaraBABA's avatar
LaraBABA's avatar sr574yrs agoEloquent
7
1
Last reply by sr57 4yrs ago
fcno's avatar

Next and previous using paginate(1)

I have an index page with thousands of records (let's use the 'cars' model as an example). They are being displayed paginated. On this index page, there is a link to the show page where the car is displayed in more detail. On the show page there is a next and previous button to allow the user to navigate between the records without having to go back to the index. However, calcu

fcno's avatar
fcno's avatar jlrdw4yrs agoLaravel
8
1
Last reply by jlrdw 4yrs ago
pix3x's avatar

Why one API route doesn't work while others work?

The table categories has 6 records. The table services has 2 records. bichon.shop/api/category-list (total_items: 6) works fine and returns all 6 records from DB. BUT bichon.shop/api/service-list (total_items: 0) returns zero items... what can be a problem here? Please help. routes/api.php Route::get('category-list',[API\CategoryController::class,'getCategoryList']); Route::get

pix3x's avatar
pix3x's avatar automica4yrs agoLaravel
7
1
Last reply by automica 4yrs ago
Dhruv Sompura's avatar

How to paginate API response and display on front end

Basically i am fetching data from shopify and displaying on front end. How to display users in pagination ?

Dhruv Sompura's avatar
Dhruv Sompura's avatar tykus4yrs agoLaravel
1
1
Last reply by tykus 4yrs ago
daveb2's avatar

How to access model fields in ->leftJoin query?

Having an issue using left joins in queries involving multiple tables with fields of the same name. I'm using the Spatie laravel permission module (https://spatie.be/docs/laravel-permission/v5/introduction), and I am trying to sort my users by their roles. I'm also paginating the results, but the last line can be removed and replaced with a ->get() to remove pagination. My e

daveb2's avatar
daveb2's avatar daveb24yrs agoEloquent
2
1
Last reply by daveb2 4yrs ago
croftCoder's avatar

Laravel Livewire Nested Components

trying to nest a livewire component into another but getting the error: Livewire component's [table] public property [members] must be of type: [numeric, string, array, null, or boolean]. Only protected or private properties can be set as other types because JavaScript doesn't need to access them. LiveTable Livewire Component class LiveTable extends Component { use WithPagi

croftCoder's avatar
croftCoder's avatar putera4yrs agoLivewire
1
1
Last reply by putera 4yrs ago
folium's avatar

How to return $model->links() From a Controller

I'm trying to return a pagination from the controller using the link function, through ajax but It return an empty value. What could be the problem? your reply must be appreciated. Thanks. $models= Model::paginate(5); $str= ""; foreach($models as $key => $model){ $str .= $model->name; } return response()->json([ 'rows' => $str, 'link

folium's avatar
folium's avatar gfbdy1yr agoLaravel
14
3
Last reply by gfbdy 1yr ago
User1980's avatar

Question about mastering Laravel

Hi all, I would like to get better with Laravel(to a master level) but I feel like videos are not enough as they only cover specific fields. I also feel like a big loss in confidence with eloquent's powers because I never see proper complex examples like reordering sub queries, pagination with POST request(rather than GET), and many more like getting data from one relation whil

User1980's avatar
User1980's avatar User19804yrs agoLaravel
38
4
Last reply by User1980 4yrs ago
hcastillo's avatar

Fetch remaining data from paginated respond in Vue SPA

how i could make to bring all data in once on pagination data response without create another end-point? Example // Laravel method public function getCars() { return Car::paginated(); } // Vue SPA // Using paginated data | work perfect const getCars = async (page = 1) => { const { data } = await httpClient.get("cars?page=" + page) return dat

hcastillo's avatar
hcastillo's avatar jlrdw4yrs agoVue
4
1
Last reply by jlrdw 4yrs ago
iamsubingyawali's avatar

Fetching paginated comments with replies

Hi, I am building an API where I have comments and single level replies i.e. a comment can have replies, but replies can't have any replies. My implementation has a single comments table where replies and comments are identified by parent_id column. I am trying to fetch all comments in a post such that, first a parent comment is fetched, and their replies are fetched and when r

iamsubingyawali's avatar
iamsubingyawali's avatar jlrdw4yrs agoEloquent
13
1
Last reply by jlrdw 4yrs ago
mstdmstd's avatar

Can I work in view templates with array of data ?

I review my laravel/blade/livewire code for better performance and I try to remove any objects from blade files, like $item->related_subitems->count or foreach( $item->related_subitems() as ... ) also I think it is better to pass to view template array of data, not object or collections. But trying to implemented it, I encountered that to use pagination of listing I

mstdmstd's avatar
mstdmstd's avatar Snapey4yrs agoLaravel
4
1
Last reply by Snapey 4yrs ago
Mikegk's avatar

Removing "?page" from paginated livewire view

Hey guys 🤗, simple question: Can mute a livewire pagination somehow so that there won't be any visible url-query changes? I never found out how to achieve that 😬... Thank you for any help.

Mikegk's avatar
Mikegk's avatar Mikegk3yrs agoLivewire
5
1
Last reply by Mikegk 3yrs ago
PetroGromovo's avatar

Having some data in Redis how to implement dynamic listing of data?

Working with "predis/predis": 1.1 in laravel 9 app I managed to read data with Redis::get and no data found to read it from database and write it into redis with Redis::set( method. When related data are saved under admin area I make update of these data in redis with Redis::del and Redis::set( methods. It works ok when I need to read some data by unique key or uniqu

PetroGromovo's avatar
PetroGromovo's avatar PetroGromo...4yrs agoGeneral
0
1
shimana's avatar

resetPage not work in livewire

i have a query , I tried two methods for pagination. The page reset works in the first method but does not work in the second method. methods one: public function render() { $images = Gallery::query() ->when($this->selected, function($query) { return $query->where('status', $this->selected); })->paginate($th

shimana's avatar
shimana's avatar Snapey4yrs agoLivewire
2
1
Last reply by Snapey 4yrs ago
Patel's avatar

Querying a lot of data from multiple tables using UNION

Hi, I have a requirement where I have to union 5 tables and show records to the user between a certain time limit (Eg : a whole day) When I do a union on all the 5 tables it gives a lot of data and makes it slow (sometimes giving timeout error), so I tried putting a limit of 100 records on every table and using pagination to display 100 records at a time. This is faster but giv

Patel's avatar
Patel's avatar sr574yrs agoLaravel
6
1
Last reply by sr57 4yrs ago
salman15's avatar

Order products by categories with the highest count.

I'm try to order my products by categories with the highest count. So for example, if there are 3 categories which have products assigned to them like here: Electronics: 3 Clothing: 6 Foods: 2 I would like the products with the category clothing to appear at the start of my result, followed by electronics and ended by foods. Currently I have: $categories = Category::with(['prod

salman15's avatar
salman15's avatar salman154yrs agoLaravel
4
1
Last reply by salman15 4yrs ago
OurBG's avatar

Handling multiple filters with Inertia and Vue

I'm following Jeffrey's tutorial on the filtering and search. However, there's only search and I have multiple filters on my page. I'll show my code and then tell you what problems I'm encountering; <template v-slot:top> <Input placeholder="Search ..." v-model="search" /> </template> <div class='sm:fl

OurBG's avatar
OurBG's avatar undeported...4yrs agoInertia
14
1
Last reply by undeportedmexican 4yrs ago
Deekshith's avatar

Laravel combine followers and following users

i have a relationship like below, User.php public function followers() { return $this->belongsToMany('App\User', 'followers', 'leader_id', 'follower_id')->withPivot('status'); } public function following() { return $this->belongsToMany('App\User', 'followers', 'follower_id', 'leader_id'); } now in controller i can fetch followers a

Deekshith's avatar
Deekshith's avatar sr574yrs agoLaravel
1
1
Last reply by sr57 4yrs ago
Mike P's avatar

Using functions inside the Eloquent query in a clean way, help

Hello, Help me clean up the code? Need to call the function which has to be written separately, not in the Eloquent query. I need to make a transform on the pagination object (apparently it can be done with through() method) in order to get the preview text for my list of Posts with some clean-up to the source text. What I want is to put the function name in the query, not the

Mike P's avatar
Mike P's avatar Mike P4yrs agoLaravel
11
1
Last reply by Mike P 4yrs ago
Ahmadnoori's avatar

How to add ->index() on enum('draft', 'pending', 'published')

I have 200k+ posts and I want to get all posts that are published. I have also applied pagination with a limit 20 $table->enum('status', ['draft','pending_review','published','trash']); this is my column schema. How to index the status column that are published? Should I use: $table->enum('status', ['draft','pending_review','published','trash'])-index(); Please guide I

Ahmadnoori's avatar
Ahmadnoori's avatar manojo1234yrs agoLaravel
2
1
Last reply by manojo123 4yrs ago

Want us to email you occasionally with Laracasts news?

Nine out of ten doctors recommend Laracasts over competing brands. Come inside, see for yourself, and massively level up your development skills in the process.

Learn
BrowseSeriesCreatorSeriesLaravel PathLarabitsPlayground
Discuss
ForumPodcastSupport
Extras
Gift CertificatesApparelFAQiOS AppTerms
Social
X(Twitter)TikTokYoutube

© Laracasts 2026. All rights reserved. Yes, all of them. That means you, Todd.

Proudly hosted with Laravel Forge and DigitalOcean.

Want us to email you occasionally with Laracasts news?

Nine out of ten doctors recommend Laracasts over competing brands. Come inside, see for yourself, and massively level up your development skills in the process.

Learn
BrowseSeriesCreatorSeriesLaravel PathLarabitsPlayground
Discuss
ForumPodcastSupport
Extras
Gift CertificatesApparelFAQiOS AppTerms
Social
X(Twitter)TikTokYoutube

© Laracasts 2026. All rights reserved. Yes, all of them. That means you, Todd.

Proudly hosted with Laravel Forge and DigitalOcean.