All Questions
100 questions
0
votes
0
answers
106
views
Laravel query not returning correct values
I am building an expense managing web app.
I have a section analytics and I am working on filters for that page.
The filter parameters are sent to the server correctly, but the problem is that the raw ...
0
votes
1
answer
42
views
Polymorph relationship wont let me reach to the parts table
So I have a database that has : Ad Model that polymorphs to Vehicle, Parts and Equipment model. Now I am trying to do some filtering with checkboxes, heres my front end code with Vue.js
import {Link, ...
0
votes
0
answers
51
views
Architecture with infinite scroll user feed to avoid duplication (Vue & Laravel)
I am creating a new app/product with Vue as the frontend & Laravel as the backend, which has a requirement for a social media type feature with posting & infinite feed, with things like ...
0
votes
0
answers
41
views
How to keep an id accessible throw different routes without passing it in every route?
I trying to implement a CRUD web-app that shows specific products to specific customers. I made the customer_id a foreign key to the products, and the relationship between customers and products one ...
0
votes
1
answer
2k
views
Best way to live database search in Inertia/Vue with Laravel
I want to search the customers list and change the component as is.
At the moment I use this link to search for a specific customer /customer/$searchColumn/$searchTerm?page=4
This is what my ...
0
votes
0
answers
54
views
How to define a route to display data for a specific customer?
I am creating a CRUD web-app that can also show customers their contracts. I am trying to fetch data (contracts) for a specific customer using Laravel Eloquent and vue. I am getting an empty form. I ...
1
vote
1
answer
56
views
Why can't I send data properly to Controller?
i have a problem with sending data from vue component through api to controller.
I have a function like that in component (this.selectedItems is an array of objects):
async getEntries() {
try {
...
0
votes
0
answers
81
views
How can I solve model error in php laravel with vue?
I am learning laravel, when running a page I get the following error.
It says that I need a model, but I don't know in which part.
I get the following error
TypeError: Cannot read properties of ...
0
votes
1
answer
64
views
pass data to edit from the controller to the view in a many to many relationship
Hi everyone i have a many-to-many relationship between the turnos table and the dias table like this:
Currently, I'm doing the CRUD of the turnos table and for each turnos I have to assign many dias, ...
0
votes
2
answers
123
views
Retrieving data from hasMany Relationship
I want to show data from 'personas' (parent table) that has at least one 'residente' (child table), its a one to many relationship, and i want to show data of that residente too.
I was trying to do ...
-3
votes
1
answer
311
views
How to add a mailing feature on laravel 8
I am taking over a project and a client wants me to add a mailing feature like a gmail with inbox, sent messages and the user can also reply to emails from outside the system and the people receiving ...
0
votes
1
answer
145
views
How to get only one specific row data from nested relationship in Laravel Eloquent?
I have 3 models connected by simple one-to-many relationships:
One Client(has many) Points,
One Point (has many) order_powers. The order_powers table has value and date_from columns. date_from is the ...
0
votes
1
answer
187
views
FormData not being read by laravel on backend
This qn is related to vue and alravel, I try to make and api request on vue with const response = await http.put("api/v1/vehicles/" + vehicleId,formData);. I see the data going on payload, ...
1
vote
0
answers
51
views
Data Pass from controller to view
I want to display the sum of column debit. When I pass data after sum value of the debit column and store it in a variable, I pass the data from controller to my view but laravel says it's undefined. ...
0
votes
2
answers
3k
views
Argument #3 ($constraints) must be of type Closure, array given
I am trying to render all ads from users. Users have latitude and longitude saved in his table, so what I am trying to do is a filter of places that will paint the ads/posts of those users in that ...
2
votes
1
answer
793
views
Laravel eloquent not fetching the data properly
In my laravel vue application I have two tables, user table and user_document table.
In my user_document table, I have a column called, added_by.
This column stores the ids of the users.
There are ...
1
vote
1
answer
58
views
Laravel select not working properly inside the "WITH"
I have following controller in my laravel application, to fetch and send data to my vue component.
I recently added new column called added_by which stores the user id of the user who add the record. ...
0
votes
1
answer
578
views
How to pass user data into vue in laravel
I am able to log my user data in console log,
if I try to display the data on Contalist page it dosen't return anything. Please, I am new to using vue I just need to implement it to my projects. Here ...
-3
votes
1
answer
733
views
Laravel why get element by id is not working
When i am entering hard coded id in Laravel controller, i am able to get data but when
i enter same value in text box data i am getting error.
working Laravel controller which shows value against id ...
0
votes
1
answer
33
views
Laravel Eloquent Query containing pivots and relations
I want to make graphs based on values i get from my questionnaire. This is how my database looks like (Only showing the ones I need):
questionnaires
id
client_id
questionnaire_answers
id
...
1
vote
3
answers
256
views
Laravel hasManyThrough giving error when nesting
I essentially have 3 tables that I want to nest, 2 already work but I can't get hasManyThough to work.
My tables :
tablename : measurements
id
client_id (not important for now.)
...
1
vote
1
answer
234
views
Laravel API Eloquent Where Clause with Vue not working
My question is, why doesn't my where clause work?
I use a Laravel API for my vue (with vuex) project.
Here's the Controller function
public function specific_client(Request $request) {
...
0
votes
1
answer
107
views
How to use Laravel relationships to create a table?
as you see on the diagram :
the task belong to a user and a project on the same time.
the user and project can have multiple tasks.
how can i use laravel relationships to create a task?
0
votes
0
answers
43
views
How can i use Laravel relationships to get the value i want?
As you see on the UML diagram, one or more users can be in charge of one project thats why i had to create user_projects table.
my situation i need create a controller that get a request that contain ...
0
votes
2
answers
940
views
Filter data for genres (with a select) in Vue.js
I'm using Laravel api.php routes and I need to filter musicians based on their common genre, so after the select is clicked I want to switch page and go to a page where I've got all the musicians with ...
0
votes
0
answers
73
views
laravel when() helper function executes the function when the value is false
public function getStudents(Request $request)
{
return User::where('role','student')
->where('is_enrolled',false)
->when(request('category') != 0, function ($q){
...
0
votes
1
answer
80
views
Laravel ::when on paginate, length undefined
I want to have a dynamic sizing of my pagination, I'm using laravel vue and inertiaJS, I receive the value but can't make it work on paginate inside when.
This is the query.
Group::where('company_id', ...
0
votes
2
answers
1k
views
Use vue to access a Laravel model method in a v-for loop
I am learning how to use vue with laravel. I have basic loops working well to pull direct model relationships, but I can't figure out how to access model methods in a loop. Many of my Larvel models ...
0
votes
1
answer
209
views
Laravel Eloquent returning model with all relations
When I use User model to return the data I need it gave me list of objects with all the relations.
User Model
class User extends Model implements AuthenticatableContract, AuthorizableContract
{
...
0
votes
1
answer
887
views
How to merge collection and Query builder then use paginate on it Laravel 8
I have a builder object and a collection and i want to combine them and use paginate of laravel.
How can i do that ?
public function getRequests(){
$closedRequests = request::join('...
0
votes
1
answer
96
views
laravel ajax returns whole object of joined table
I just want to get name from table users but it returns the whole user object in network tab which leaks private information like phone (which is just in users table)
Admin Model:
class Admin extends ...
0
votes
1
answer
287
views
Eloquent 3 tables relationship in Vue component
I have got this relationships:
CUSTOMER
id
name
ADDRESS
id
name
customer_id
country_id
COUNTRY
id
name
My Customer model:
class Customer extends Model
{
...
1
vote
1
answer
332
views
How can I paginate data in laravel&Vue?
I am making site with laravel and vuejs.
I use complex Eloquent query for getting data from DB as follows.
$query->with([
'deviceAssignment.deviceSetting.sim',
'deviceAssignment....
1
vote
1
answer
136
views
Eloquent 'with()' returns null
I have a simple relationship between two models: User and Prescription. A user has many prescriptions. In the PrescriptionsController, when I try to get the user that the prescriptions belongs to, it ...
0
votes
1
answer
514
views
Laravel - Get data between tables using foreign key in Eloquent
I want to get a fields from a controller with the data of another class using foreign key with Eloquent. I'm not sure if it's possible or not.
The scenario
Model Job
class Job extends Model
{
use ...
1
vote
1
answer
240
views
Laravel 7: Cannot update record in users table
I've searched but couldn't find a working solution. I simply cannot update a specific field (status) in users table. I've added two additional fields in Laravel's auth users original table.
Here is ...
0
votes
1
answer
144
views
Laravel Attach Files Duplicates Database Record
I am using: Laravel, Vue JS, dropzone.
Works fine with one file being uploaded but when 3 files are uploaded it create a new homework record, like so:
Homework ID: 1, Files: 1, 2
Homework ID: 2, ...
1
vote
1
answer
334
views
Laravel group by day and paginate?
I want to group my posts by day, sort by latest, and include pagination for a timeline that will also contain infinite scroll for a vue spa on the frontend:
RecordController
public function userFeed($...
0
votes
1
answer
653
views
Filter a value in all properties with Laravel
This question is very similar to Laravel filter a value in all columns. Sorry, if it turns out as a duplicate later on, but I have another working code to provide.
What does work is filtering on the ...
4
votes
1
answer
8k
views
How to update image with PUT method in Laravel REST API?
I am trying to build a REST API with Laravel where users need to update their image. But, If I use PUT method in postman it does not update the image or store the image in designated folder. If I use ...
0
votes
1
answer
1k
views
Adding Data to Belongs to resource using TextField laravel Nova
Hi is there any way to insert data in two tables in one request laravel nova belongsTo relation
What I am trying to achieve is that
I have two models first is the user model & the second one is ...
3
votes
2
answers
763
views
Post method is not supported for route in vuejs and laravel
I want to update status on confirm click to 1. i am using vue js and laravel. i used axios.post for hit the API. but when i click on confirm to update status, i get error message for route post is not ...
0
votes
3
answers
194
views
Laravel query not using where clause for date
I have made a laravel query which gets all the data but does not use the where clause for $startdate.
$user->studentGroups()->with([
'GroupTasks' => function ($queryTwo) use ($...
1
vote
1
answer
1k
views
Laravel inertia return all posts with limited number on columns and adding the user from a belongsTo relationship
Using Laravel, inertia, vue I would like to return all Posts with only the necessary columns in my index but I would like to add the user from a belongsTo relationship
Here is what I tried
Test one : ...
0
votes
1
answer
95
views
Laravel and vue router
I am new to using Vue as a frontend and Laravel has a backend.
I have 2 related models that are namely a Users model and a Posts model.
Users can have many posts and a post belongs to one user.
I can ...
0
votes
0
answers
673
views
Load many to many eloquent relationships data on vue component
I am stuck in filling the form automatically during update in a Laravel Vue SPA.
I successfully have added the data during create. But I am lagging idea on how the related data can be filled during ...
0
votes
3
answers
1k
views
Saving Dynamic Select Values in database - Laravel
I am working an multiple select Boxes in a form which are rendered dynamically.
Here in the below scenario I am mapping the selecttion to the parent title.
The example result is { "1": [ 2 ]...
0
votes
1
answer
70
views
How to make:folder in folder in folder... to the infinity in Laravel
I need to make the option that in folder you can create new folder,then a new folder inside the new folder... and so on indefinitely. Like we can do it on a desktop.
I can't find anything similar in ...
0
votes
4
answers
94
views
How can I get sum of tasks that belongs to project in Laravel?
I have Tasks that belongTo the List, and a Lists that belongsTo Project.
I have no task-project relation.
I need to find the sum of all the tasks in the project with whereHas function, and display ...