Questions tagged as 'laravel-eloquent'

1
answer

Search cross-results in related tables

I created several tables: Users: chave primária email senha Physical Detail: user_id altura Personal Information: user_id estado_civil Now I'm having trouble fetching cross-results. Example: Find users with altura =...
asked by 01.09.2014 / 05:36
1
answer

how to do a search with several filters as a parameter in laravel?

I have a question about how to search for clients with multiple filters. Example: nome cliente , tipo de cliente , status do cliente , endereço , cidade . Detail: All these filters are in different fields....
asked by 31.08.2014 / 05:46
1
answer

Throwing Exceptions in Eloquent ORM Observers

I have the following code in my model: public static function boot(){ parent::boot(); // Não deixa excluir caso possua registros vinculados. static::deleting(function($content_area){ if($total = $content_area->contents-...
asked by 12.05.2014 / 18:04
2
answers

Query in related tables

As would be an example of querying a bd with related tables and inserting data into them. I have the tables: Produtos Tamanhos Generos I need to display in the view produtos.blade.php a list with all the registered products a...
asked by 07.02.2014 / 18:07
1
answer

I can not make search work with eloquent and relationship !!! Laravel 5.5 and mysql

I am doing a search by taking a word part and playing in a search type LIKE for fields fields. I use Eloquent and relationships, but it does not bring the data. { $pesquisa = $dataForm['pesquisa']; $atestados = Atestad...
asked by 19.12.2018 / 12:07
2
answers

Error using many to many laravel

I have a group of Users that have Many To Many relationship, to create this relationship I made a beLongsToMany function within the Users model. But every time I call this function I get the following message:   Uncaught exception 'BadMethodC...
asked by 20.09.2018 / 20:10
1
answer

Filter records within a one-month interval

I have several items sold in a month and I would like to display only the items sold in the current month. Example: In September I had a total of 30 items sold, and in August, 20 items. How do I pick up the current date and check the quant...
asked by 04.09.2018 / 01:07
1
answer

Eloquent does not return the same results as SQL

I have this SQL code that when running directly in the database works fine, but I had to convert it to the laravel format. It performs but returns no results. Where am I going wrong? It seems that the problem is there in% w / o% of% w / o...
asked by 06.08.2018 / 14:35
1
answer

Does not display relationship data within WITH [duplicate]

I have a Polymorphic Relationship between the Customer and Car Class. Client Class: public function carros() { return $this->morphMany(Carro::class, 'dono'); } Car Class: public function dono() { return $this->morphTo...
asked by 16.04.2018 / 20:41
1
answer

Form select with Laravel

I have this code working, but I would like to know if I would have a more elegant way of writing the following code in the view, through Laravel's forms: <div class="row"> <div class="col-xs-12 form-group"> <label fo...
asked by 07.05.2018 / 04:06