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

Gabotronix's avatar

Can't access data property from parent in slot child component

I have two components rad-list and rad-card, I placed a slot element in rad-list where I will place rad-card, now rad-card receices an object from computedResults array (in parent scope) and iterates through them and pass result to item prop in rad-card, but since computedResults is defined in parent component my rad-card instance doesn't have access to it? <rad-list model=

Gabotronix's avatar
Gabotronix's avatar piljac16yrs agoGeneral
1
1
Last reply by piljac1 6yrs ago
Gabotronix's avatar

Vue: Access parent component data in slotted child component?

I have two components rad-list and rad-card, I placed a slot element in rad-list where I will place rad-card, now rad-card needs to access a computedResults data from parent rad-list component, how can I access it using vue slots, is it possible? RAD LIST <template> <div class="RADlist_maincontainer"> <layout-pagination-1 v-show="pagination.las

Gabotronix's avatar
Gabotronix's avatar Gabotronix6yrs agoGeneral
0
1
MysZon's avatar

How to use search query in the view?

I wana pass search query to laravel view, for now i try use compact and compatct-> with but still results it's this same "Undefined variable: query" I try pass hard code like single query "abc" , "bcd" etc. it's work /kategoria?query=abc&page=2, but when i wana make some like wildcart then i cant pass variable query to view. Search Controlle

MysZon's avatar
MysZon's avatar MysZon6yrs agoLaravel
2
1
Last reply by MysZon 6yrs ago
trifek's avatar

Links() not working in Laravel 5.8

Hi, I'a beginner in Laravel. I use Laravel 5.8 in my project. I have problem with pagination. I have this code: class ForumCategory extends Model { use scopeActiveTrait; protected $quarded = ['id']; protected $fillable = ['company_id', 'enable', 'name', 'url_address', 'enable']; public $timestamps = false; public function themes() { return $thi

trifek's avatar
trifek's avatar Sinnbeck6yrs agoLaravel
1
1
Last reply by Sinnbeck 6yrs ago
Medala's avatar

How to paginate while using custom Filter class?

Hi, I have a ProductFilters class for a dynamic filter function as shown here: https://laracasts.com/series/eloquent-techniques/episodes/4. Pagination and the filters are working if applied separately. This does not append {{ $products->appends(request()->query())->links() }} Neither this {{ $products->appends(Request::except('page'))->links() }} What should I do

Medala's avatar
Medala's avatar Medala6yrs agoLaravel
6
1
Last reply by Medala 6yrs ago
nikankad's avatar

how do i get the value from a dropdown menu to a controller

i want to use the value of a dropdown to filter records in a table My view <div class="mm-select-lbl" style="">Subject</div> <form action="" method="post"> <select class="form-control required mm-select-menu" id="subject" name="subjec

nikankad's avatar
nikankad's avatar Tray26yrs agoLaravel
1
1
Last reply by Tray2 6yrs ago
AwadGorg's avatar

Coverting from jquery to javascript

Hello I have this code in jquery and I want to cover it to pure javascript cuz does not make any sense for me to use 80k liberty to just make a small task can anyone help please am very bad when it comes to js but kind of good at jquery. Jquery <script async> $(document).on('click', '.pagination a', function(event){ event.preventDefault();

AwadGorg's avatar
AwadGorg's avatar AwadGorg6yrs agoJavaScript
10
1
Last reply by AwadGorg 6yrs ago
nikankad's avatar

my variable is not being passed to my view

im using two tables, so im using two models this is my controller namespace App\Http\Controllers\PastPaperControllesr; use App\PastPapers; use App\DropDown; use Illuminate\Http\Request; use App\Http\Controllers\Controller; class IGCSEController extends Controller { /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ p

nikankad's avatar
nikankad's avatar Tray26yrs agoLaravel
6
1
Last reply by Tray2 6yrs ago
uccdev's avatar

Is it possible to paginate two different tables on the same view?

So I have a laravel project that fetches data from not one, but two API endpoints. API endpoints like Canvas, so I cannot use any DB::table queries or other tricks. It gets the data from a Courses endpoint as well as a Users endpoint. I've been requested to fit the data of both tables on the same view. Displaying all the data is fine, I'm able to collect the data from both tabl

uccdev's avatar
uccdev's avatar uccdev6yrs agoLaravel
8
1
Last reply by uccdev 6yrs ago
jlrdw's avatar

Paginate collection simple example (Guide)

Another question also recently came up on the length aware paginator usage. in controller add at top use Illuminate\Support\Collection; use Illuminate\Pagination\LengthAwarePaginator; A controller method just to test: public function colPaginate() { $page = !empty(Request::input('page')) ? Request::input('page') : '1'; $perPage = "1";

jlrdw's avatar
jlrdw's avatar jlrdw3yrs agoGuides
4
1
Last reply by jlrdw 3yrs ago
Gabotronix's avatar

Paginate polymorphic relationship, topic->comments()

Hi everybody, I'm building a basic forum, there are many topics and each topic has comments, a comment or "commentable" can be a a comment or a reply (commented a comment), this is because I want to have nested comments, that's where parent_id is useful. I'm wondering if my polymorphic relationship is the best way to achieve this so I'm open to any suggestions. The fi

Gabotronix's avatar
Gabotronix's avatar Wraith6yrs agoGeneral
1
1
Last reply by Wraith 6yrs ago
shahajahancse's avatar

How to solve 422 (Unprocessable Entity), laravel and vuejsI am using Laravel 6.2 and 2.5.17, to communicate with a mysql database. When I am able to properly POST request send on the without body, I get error 422 (Unprocessable Entity)

I am using Laravel 6.2 and vuejs 2.5.17, to communicate with a mysql database. When I am able to properly POST request send on the without body, I get error 422 (Unprocessable Entity) My API Controller: public function store(Request $request) { $this->validate($request, [ 'name' => 'required', 'email' => 'required|email|unique:customers', 'p

shahajahancse's avatar
shahajahancse's avatar shahajahan...6yrs agoVue
2
1
Last reply by shahajahancse 6yrs ago
farshadf's avatar

how to remove duplicates from 2 joins in laravel

hi , i am using spatie laravel query builder to make some filters for my project and i have the code as below : public function scopeFilter() { $data = QueryBuilder::for(Accommodation::class) ->allowedFilters([ AllowedFilter::scope('bed_count'), AllowedFilter::scope('filter_price'), AllowedFilter::scope(

farshadf's avatar
farshadf's avatar Tray25yrs agoLaravel
4
1
Last reply by Tray2 5yrs ago
farshadf's avatar

how to chunk a join query in laravel

Somewhere in my Laravel application, the following query is likely to return a very large results set: $data = $query->join('accommodation_rooms', 'accommodations.id', '=', 'accommodation_rooms.accommodation_id') ->join('discounts', 'accommodation_rooms.id', '=', 'discounts.accommodation_room_id') ->select('accommodation_rooms.id') ->orderBy('discounts.a

farshadf's avatar
farshadf's avatar jlrdw6yrs agoLaravel
10
3
Last reply by jlrdw 6yrs ago
Dunzo's avatar

how to paginate nested comments...

i watch this video https://laracasts.com/series/how-do-i/episodes/9 it shows how to do nested comments. but how to do pagination on these nested comments like reddit.

Dunzo's avatar
Dunzo's avatar bobbybouwm...6yrs agoLaravel
1
1
Last reply by bobbybouwmann 6yrs ago
morganchorlton3's avatar

Laravel Set Active class

Hi all Im tyring to create a set active method for my category selection on my site so far i have the following <li class="{{ setActiveCategory($category->slug) }}"><a href="{{ route('shop.index', ['category' => $category->slug]) }}">{{$category->name}}</a></li> function setActiveCategory($category, $output = 'active'){

morganchorlton3's avatar
morganchorlton3's avatar bobbybouwm...6yrs agoLaravel
1
1
Last reply by bobbybouwmann 6yrs ago
COACHTHEM's avatar

Paginate() with custom data.

Here is my use case. I have to fetch blog data by writing sql query and the data needs to be paginated. The data fetched from above query needs to be looped to create image url for each blog. After looping each blog record I create a new dimensional array which has all the blog details along with image url below is the code sample with which I want to fetch all blog data with

COACHTHEM's avatar
COACHTHEM's avatar jlrdw6yrs agoLaravel
2
1
Last reply by jlrdw 6yrs ago
nhayder's avatar

stuck on how to paginate nested relationship

it's been a couple of day trying to get my pagination code straight, thought i was told that laravel do not support nested relationship out of the box. BUT i seriously hope that somebody will has been through this before and he made a fix for this case. because i have 0 solution so far. Basically i need to paginate articles that are being loaded in widgets with nested relashios

nhayder's avatar
nhayder's avatar GHDSPORTS6yrs agoLaravel
3
1
Last reply by GHDSPORTS 6yrs ago
nhayder's avatar

how to paginate a relationship inside eloquent model

i'm trying to paginate list of articles inside my app news page withen main query like this public static function getPageWidgets($id, $lang) { $pageWidget = Cache::rememberForever('page-'.$id, function () use ($id,$lang) { return Widget::with( ['wsubcats','buttons', 'content', 'content.linkedPage', 'content.linkedAr

nhayder's avatar
nhayder's avatar Snapey6yrs agoEloquent
12
1
Last reply by Snapey 6yrs ago
murilo's avatar

Vuex , how make a betther code

Hello Guys , I wold like to know if has any way to re use codes , or expand a class inside VUEX . I know that in VUE we have mixins , but I dont know if that it is possible to use in VUEX . I have many VUEX CRUD modules . and in all those modules I have those actions ( they are the same )- set_filters: ({commit}) => { } , store: ({commit} , data ) => { } update: ({com

murilo's avatar
murilo's avatar murilo6yrs agoVue
2
1
Last reply by murilo 6yrs ago
rider's avatar

Laravel

Iam trying to attach a new value in the API response $notifications = Auth::user()->notifications()->paginate(env('RECORDS_PER_PAGE')); return $notifications; Now i need to attach module_url as a new param with the existing response the above response looks like { "current_page": 1,

rider's avatar
rider's avatar rider6yrs agoLaravel
4
1
Last reply by rider 6yrs ago
talhaatsix's avatar

Get Group Members | many to many | api | prepare response

I have Users and Groups tables . Group have many members . So i create middle table group_member user_id group_id enum( status : pending/member/admin) users and groups have many to many relation Problem : i want get only members of a group with pagination

talhaatsix's avatar
talhaatsix's avatar talhaatsix6yrs agoEloquent
2
1
Last reply by talhaatsix 6yrs ago
SupunSam's avatar

Laravel CRUD Delete function using Ajax

Hi Friends, I have created a basic app with CRUD features and I've used ajax for some of the functionality since I'm using Datatables. But unfortunately, I am unable to trigger the Delete action in this app. I have very limited knowledge with AJAX hence kindly request your help to solve this. My Controller: public function getJobs() { return datatables()->of

SupunSam's avatar
SupunSam's avatar charlessyk...6yrs agoLaravel
8
1
Last reply by charlessykes 6yrs ago
GodziLaravel's avatar

how to sort in vue table 2 for scope column

Hello , I have the column "full name" composed by two values : first_name, last_name. it works very well except for the order , when I click the header column 'Full name' it returns no order . ! <span slot="fullName" slot-scope="{row}"> {{row.last_name}} {{row.first_name}} </span> col

GodziLaravel's avatar
GodziLaravel's avatar GodziLarav...6yrs agoGeneral
0
1
hungtranm's avatar

Method Illuminate\Database\Eloquent\Collection::links not exist

Hi, I'm a new in laravel, I got an issue with creating links pagination. Please help. This is my code: public static function search($params = []) { $query = self::paginate(10); if (isset($params['category_id']) && $params['category_id']) { return $query->where('category_id', $params['category_id']); } return $query;

hungtranm's avatar
hungtranm's avatar hungtranm6yrs agoLaravel
2
1
Last reply by hungtranm 6yrs ago
GodziLaravel's avatar

Vue table 2 : how to get the nested array

First the column of name works , but permissions and users column return "undefined" . My question is : How to get permissions names list (with comma separator) in permissions column How to get users names list (with comma separator) in users column Here is the table options : columns: ['name','users','permissions', 'actions'], rows:

GodziLaravel's avatar
GodziLaravel's avatar realrandya...6yrs agoVue
1
1
Last reply by realrandyallen 6yrs ago
GodziLaravel's avatar

remove row from vue-table 2

Hello, I would like to remove a specific row when I click delete button and after axios return answer , in deletePermission(id) method : how to do ? <template> <div class="card w-100"> <!-- Modal --> <div class="modal fade" id="confirmDeleteModal" tabindex="-1" role="dialog" aria-labe

GodziLaravel's avatar
GodziLaravel's avatar jtrod5yrs agoVue
2
1
Last reply by jtrod 5yrs ago
GodziLaravel's avatar

vue-table 2 : how to add actions column?

Hello , How to add one extra column 'Actions' with two buttons: delete and update ? <template> <v-client-table :selected-to="selectedRow" :data="rows" :columns="columns" :options="options"></v-client-table> </template> <script> export default { name: "Users", data() {

GodziLaravel's avatar
GodziLaravel's avatar imsyuan3yrs agoVue
2
1
Last reply by imsyuan 3yrs ago
Kitephx's avatar

How to filter data with axios laravel query builder

Hello everyone ! I am stuck at a point and want to know your point of view. I want to create a list and be able to filter the list with multi-select. From this point, controller has been created. Below a summary of my controller $this->per_page = 5; $events = Event::isActive() ->whereDate('from_date', '=', $now) ->whereDat

Kitephx's avatar
Kitephx's avatar Kitephx6yrs agoLaravel
0
1
4xjbh's avatar

Preselecting options in an remotely-sourced (AJAX) Select2

I am having trouble working out how to get the request with ManagerID value to ajax when I open a edit form. All of the other controls populate with the correct data. How do I pass the request data that includes 'ManagerID' value to the ajax fetch below? OR Am I going about this the wrong way? TY. Setup the control $('#ManagerID').select2({ placeholder:

4xjbh's avatar
4xjbh's avatar 4xjbh6yrs agoGeneral
0
1
nizam0786's avatar

Prevent multiple request being sent and listed as pending in network tab

Hi Guys, I created a pagination component for a table using vue and it's working fine however, when I click on the right arrow multiple times and quickly to go to the next page or if I click the left arrow to go back a page. It calls axios to fetch the new data. However, It sends multiple requests and kind of messes up the data being loaded in the table. It loads eventually but

nizam0786's avatar
nizam0786's avatar nizam07866yrs agoVue
5
1
Last reply by nizam0786 6yrs ago
AO's avatar

Route not defined?

Hello. I'm trying to make a search on the same page in my admin dashboard. here's what I did in my controller: public function search(){ $q = Input::get ( 'q' ); if($q != ""){ $case = Case::where ( 'donation_title', 'LIKE', '%' . $q . '%' )->orWhere ( 'donation_story', 'LIKE', '%' . $q . '%' )->paginate (5)->setPath ( '' );

AO's avatar
AO's avatar munazzil6yrs agoLaravel
8
1
Last reply by munazzil 6yrs ago
PetroGromovo's avatar

if paypal plan has “inactive” status?

Hello, Testing pagination in laravel 5 app with request Working with Update Plan API http://paypal.github.io/PayPal-PHP-SDK/sample/doc/billing/UpdatePlan.html I did not find if plan has “inactive” state and which key have I to use for it? I made : $value = new PayPalModel('{ "state":"INACTIVE" }'); But got error : Requested state change is in

PetroGromovo's avatar
PetroGromovo's avatar PetroGromo...6yrs agoGeneral
0
1
nhayder's avatar

can't paginate search result records?

this is the form <form action="{{route('rp')}}" method="GET" role="search" enctype="multipart/form-data"> @csrf <input type="text" name="search" class="search-input form-control" placeholder="@lang('translation.search')" required="true"/> </form> and i have thi

nhayder's avatar
nhayder's avatar Snapey6yrs agoLaravel
2
1
Last reply by Snapey 6yrs ago
adhik13th's avatar

datatables can showing data/result but sometimes often get error 404

I have a table and showing data and using Datatables Yajra to get search and pagination . This datatables is work ,showing data , all function is OK . But if i reload this page,search some words , is often to showing error : DataTables warning: table id=table1 - Ajax error. For more information about this error, please see http://datatables.net/tn/7 But , if i load again its

adhik13th's avatar
adhik13th's avatar adhik13th6yrs agoLaravel
3
1
Last reply by adhik13th 6yrs ago
aarad's avatar

v-for on multi component generate wrong data - solved!

I write a <Product> component and each component has own data, but on pagination, same indexed " data" i wrong. Product: <script> export default { name: "Product", props: ['product'], data(){ return{ count: '', } }, computed: { InventoryCount(){

aarad's avatar
aarad's avatar reshared6yrs agoVue
2
1
Last reply by reshared 6yrs ago
cristian9509's avatar

Abstracting around the Query Builder for Controller and Jobs

I want to move all the logic of my application into Service classes. Once I do that there should no longer be any usage of the Models outside of the service classes. Currently my app has an API and a console app for running jobs. I see my service classes being able to work with both the api and the jobs by providing the right methods. I want to have on the service class a metho

cristian9509's avatar
cristian9509's avatar cristian95...6yrs agoEloquent
0
1
thamibn's avatar

Handle big data Laravel and Vuejs

Hi, can someone please help me, I need a proper way to handle big data like millions of records, I want to populate a frontend table which has filtering, sorting and pagination on it, I want all this features to handled by laravel. I am using vuejs as frontend. Please advise on how can I approach this in a proper and best way. Thanks

thamibn's avatar
thamibn's avatar Tray26yrs agoLaravel
1
1
Last reply by Tray2 6yrs ago
duckz1209's avatar

other methods for all()

is there any other method for all()? im getting a big collection and paginate is not working. it only gets the first page of pagination heres my code controller: $payments = Payment::paginate(20); blade: <?php foreach($payments as $payment){ if($client->id == $payment->id){ $pay+= $payment->loan_interest+$payment->loan_amount+$payment->

duckz1209's avatar
duckz1209's avatar bobbybouwm...6yrs agoLaravel
7
1
Last reply by bobbybouwmann 6yrs ago
princeoo7's avatar

Paginate BelongsToMany relationship records if more than set limit

How do we paginate records for belongsToMany relationship ? i was watching laracasts lesson: Laravel From Scratch: Part 31 - Sorting Posts By Tags url : https://youtu.be/Lq9rOAYW-S0 but there is not part talking about pagination for relational records : ( my code is as below: public function index(Category $category) { $posts = $category->posts; dd($po

princeoo7's avatar
princeoo7's avatar princeoo76yrs agoLaravel
4
1
Last reply by princeoo7 6yrs ago
PiotrG's avatar

API Resource Related Model Filtering

Hello! I am having trouble understanding how to filter a model resource relationship. \Resources\User.php <?php namespace App\Http\Resources; use App\Http\Resources\Termin as TerminResource; use Illuminate\Http\Resources\Json\JsonResource; class Benutzer extends JsonResource { /** * Transform the resource into an array. * * @param \Illuminate\Http\Requ

PiotrG's avatar
PiotrG's avatar PiotrG6yrs agoCode Review
10
1
Last reply by PiotrG 6yrs ago
Sultenhest's avatar

Querying a hasMany through a belongsToMany

Hi guys I'm currently practicing my Laravel skills by building a Twitter clone and i'm still relatively new at building eloquent queries. I'm stuck building the "feed", which should consists of the statuses of the other user profiles the given user is following. This is what my models looks like: User.php public function statuses() { return $this->hasMany(Statu

Sultenhest's avatar
Sultenhest's avatar bobbybouwm...6yrs agoEloquent
6
2
Last reply by bobbybouwmann 6yrs ago
victor999's avatar

i try to mount a component in a component vue

i i try to mount a component in a component, this component its a partial, in especifict its a paginator, which i need to integrate, i use props in the paginate component. but i have a problem, in the console appears the next messagge "Failed to mount component: template or render function not defined." i am new in vue js, i using router-view i don´t know if this it i

victor999's avatar
victor999's avatar victor9996yrs agoVue
0
1
dionarap's avatar

Sort feature returns to default

I have a search system that returns products, it has a sort feature where i can sort the results on user ratings or A-Z etc; this feature is handled by AJAX as is the pagination. I am having one issue with this system and that is that when i click onto a product page and then return to the results page by clicking the back browser button it will forget what value the results w

dionarap's avatar
dionarap's avatar dionarap7yrs agoLaravel
2
1
Last reply by dionarap 7yrs ago
bootstrapguru's avatar

Create temporary table and assign it to model

I have a model called SaleTemp which needs a temporary table sales_temp that creates an on the fly by joining 5 or more other tables like sales, sale_items, customers, sale_payments, sale_taxes. I have added the raw query to the construct method of the model to create a temporary table before the model initializes, but with that approach, when I try to get sales by pagination

bootstrapguru's avatar
bootstrapguru's avatar rthunoli3yrs agoEloquent
1
1
Last reply by rthunoli 3yrs ago
nicolaszein's avatar

Paginate but add linked content

I have a very sticky problem i cannot seem to find a solution to. I have a db that provides me with a paginated list of tasks that it sends back to my vue JS front end via an api. That works beautifully, however, my data that is displayed in a table is a bunch of tasks that can be children of another todo that has a flag called 'group', meaning that if that task is a group it w

nicolaszein's avatar
nicolaszein's avatar nicolaszei...6yrs agoLaravel
9
1
Last reply by nicolaszein 6yrs ago
PetroGromovo's avatar

Error with style definitions for vuejs-paginate

Hello, Working with Laravel 5.7 / Vuejs 2.6 / Bootstrap 4.3 app I use "vuejs-paginate": "^2.1.0" and I have styles problems, that defining in the same vue file paginate component ans css definitions, like <div class="row p-0 pl-3 pr-3 m-0"> <paginate :page-count="getPagesCount"

PetroGromovo's avatar
PetroGromovo's avatar PetroGromo...7yrs agoVue
0
1
JOHNMAC's avatar

search method in laravel isn't working

hello, the search in Laravel isn't working, nothing shown in results an in developers mode it shows error about pagination which is working fine, Error: found in ---> <RenderlessLaravelVuePagination> <Pagination> <Users> at resources/js/components/Users.vue <Root> search: <div class="input-group input-gro

JOHNMAC's avatar
JOHNMAC's avatar jlrdw7yrs agoLaravel
1
1
Last reply by jlrdw 7yrs ago
brigman's avatar

Laravel DB::query to eloquent

Hello, I've the follow DB query, but, I want to convert to Eloquent to use "with" statement for some childs and use in master/detail grid. It's possible ? I've tried some ideas, without success. $items = DB::table('pessoa_fisica as pf') ->join('atend as a', 'a.pefi_id', '=', 'pf.pefi_id') ->join('atend_servico as ateser', 'ateser.atend_id

brigman's avatar
brigman's avatar jlrdw7yrs agoEloquent
4
1
Last reply by jlrdw 7yrs ago
itstrueimryan's avatar

Static properties on a Model class

I'm trying to create a standard index() method for most of my controllers that combines search, pagination, and sorting into one retrieve all listings functionality. I'm using a trait for those controllers which contains an index method, and that method uses some static properties defined on the associated model to know which columns to search and so on. For example, my User.

itstrueimryan's avatar
itstrueimryan's avatar Talinon7yrs agoLaravel
1
1
Last reply by Talinon 7yrs 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.