Questions tagged as 'laravel-eloquent'

0
answers

Uploading the file inside the ajax request

I am trying to capture data via ajax request, for file upload and is not returning value for the photo. Can anyone help me? Ajax: Outputtothedataconsole(thephotopathisselected!): PersonControl:publicfunctionpostStatePath(Request$request){...
asked by 13.09.2018 / 20:48
0
answers

Create table validation many to many in Laravel

I need to do a validation so that the database does not write repeated data to a table, which is an intermediate table of a many to many relationship, not having an id. Below is the code. public function invite(Event $event) { request()-&g...
asked by 30.08.2018 / 20:34
0
answers

local.ERROR: SQLSTATE [23000]: Integrity constraint violation: 1452

Expensive, Please help me with this error: local.ERROR: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails ('clima'.'tbl_consenso', CONSTRAINT 'tbl_consenso_opcao_id_foreig...
asked by 03.09.2018 / 14:01
0
answers

initial SQL to list clients (PF and PJ). How to migrate a pure SQL Query to Eloquent from Laravel?

I set up an initial SQL to pull the data. It is working in pure SQL. I need to migrate this code to Laravel's eloquent pattern. Can someone help me? Thank you! Here is the sample SQL: Code: SELECT c.cod_cliente, p.cpf, p.nome, ct_m...
asked by 29.08.2018 / 16:56
1
answer

How to not pass the ID of an element by the laravel URL

This is my route Route :: get ('companies / delete / {notice}', 'CompanyController @ delete'); this is the button action This is my role in controlling What happens if I pass this url right into the browser localhost: 8000 / bus...
asked by 23.08.2018 / 02:42
1
answer

Eloquent ORM select with respect toToToMany

User table usuarioid | nome 1 | joão 2 | jose 3 | maria Network Table redeid | nome 1 | Subway 2 | McDonald's 3 | Burguer King User_Network table id | redeid | usuarioid 1 | 1 | 2 2 |...
asked by 24.08.2018 / 00:23
0
answers

Eloquent Laravel - Where in relation Many to Many

I'm developing a site for a project, and on my users screen, I've implemented a filter for access levels. On my screen I have a select with a value 'author' and another value 'admin'. Only the 'user' and 'role' relationship is a Many to Many...
asked by 27.08.2018 / 18:07
0
answers

How to create a migrate and add a calculated column to a table already in the database?

I have the table evaluations that have the columns nota1, nota2, nota3, nota4 created in the database and wanted to create a media column that already calculated the media automatically, how to create this column calculate using migrate from lar...
asked by 03.08.2018 / 16:50
0
answers

Relationship in Model with Column Name Alias

I'm doing a query with union in Laravel. $first = Friendship::selectRaw('id, userid, friendid, friendid as friend') ->where('userid', '=', $idUser) ->where('confirmed_friendship', '=', 1) ->whereHas('user_friends', functio...
asked by 01.08.2018 / 14:47
1
answer

Relationship error and method not found

I am studying Laravel and I have difficulties to perform the relationship of an associative table linking 3 domain tables. example of my template: The problem is that I can not map from my command to other entities. Here is my code:...
asked by 18.07.2018 / 16:07