Questions tagged as 'laravel-eloquent'

1
answer

Using Eloquent hasManyThrough

// Modelo Cliente public function plano() { return $this->hasManyThrough('App\Plano', 'App\Plano_cliente','cliente_id','id','plano_id'); } //Modelo Plano public function cliente() { return $this->hasMan...
asked by 05.04.2016 / 18:09
1
answer

Eloquent giving 500 error with many results [closed]

I'm doing a query in my database with some LEFT JOIN and some WHERE clauses, however, I'm having a lot of difficulties regarding the return of this query, which, having many results, simply after a certain processing time gives 500 error For exa...
asked by 26.01.2016 / 16:20
1
answer

Filter a query using an attribute in Laravel

I have, in short, the following structure: Suppliers : id | cnpj | razao_social | endereco_id People : id | nome | tipo_pessoa | fornecedor_id Model - Supplier: public function endereco() { return $this->hasOne('...
asked by 15.09.2015 / 17:54
1
answer

Eloquent + Object loading

I have always used Eloquent very well with static methods. Yesterday, when creating a new session log concept for a new project, I came across a question I could not clarify. I have a "Session" template that points to a table with the same na...
asked by 20.08.2014 / 15:40
2
answers

Model delete method does not delete the record

I have the code below on the route, but it does not work! What am I doing wrong? It is returning users correctly, but it does not delete. $Usuario = User::find(2); $Usuario->delete(); return User::orderBy('username', 'asc')->take(4)->...
asked by 17.08.2014 / 16:56
2
answers

How to bring Model by IDS and order at the same time

I have the ids returned from an immense query to bring the posts with a searched term ... It is already working to bring the posts through the Model by the selected IDS but it always brings by ID and what I need to order by date ... In the huge...
asked by 11.07.2014 / 22:52
0
answers

Result of relationship with self-relationship?

Using the self-relationship with you the following result.: Collection {#335 ▼ #items: array:7 [▼ 0 => Post {#266 ▶} 1 => Post {#267 ▼ #fillable: array:3 [▶] +incrementing: false #connection: "sqlite" #t...
asked by 05.01.2019 / 01:38
0
answers

How to call a Postgres Store Procedures in laravel

I'm not able to call a Function from my Postgres code on my Laravel system. CREATE OR REPLACE FUNCTION usuario.funsetsessao( login_p text, ip_p text, sistema_p text, logar_p boolean) RETURNS boolean AS $BODY$ BEGIN DROP...
asked by 27.12.2018 / 13:59
1
answer

Form :: model + checkbox in view edit

I'm using form::model to edit data. It works correctly but the checkboxes return empty. How do I return the ones saved in bd? I want them to show the ones that are registered. For example: in the course register I marked Morning and af...
asked by 04.03.2014 / 21:22
1
answer

Relationship Eloquent / Laravel Onetomany

Good afternoon, I'm using Laravel 5.7 to create an ordering system. So I have 3 tables: customers, products and orders. My Database: For the time being my migrations look like this: Migrations: migration clients: Schema::cre...
asked by 11.12.2018 / 18:42