Questions tagged as 'laravel-eloquent'

0
answers

Arrange json with Eloquent [closed]

My question is this: I want to organize my json so that I can see the Animal and Farm table, but organized, for example: { "animais": { "id": 1, "nome": "Mimosa", "data_nascimento": "2017-04-11 00:00:00", "codigo_bri...
asked by 13.02.2018 / 15:00
1
answer

Error connecting to sqlite in laravel

Internally everyone is working, migrations , tinker , sqlite3 , but in the server application it always queries mysql instead of sqlite for all operations, ie it is using Connector.php instead of% with%...
asked by 01.03.2018 / 00:58
0
answers

How to do a select depending on some conditions that comes by parameters in laravel 4.2?

My problem is as follows .... I have a route that receives the year and month to get some information in the bank. When the month does not come I need to make the sum of all the months of the requested year. if($month == 0){ $dbRegis...
asked by 26.01.2018 / 11:32
1
answer

Value of checkbox is nil, Column 'situation' can not be null

I have a $table->enum('situacao', ['ativo', 'exonerado']); field. I created a checkbox to do the registration, but it returns the following error:    1048 Column 'situation' can not be null. How can I resolve? The checkb...
asked by 22.12.2017 / 15:56
0
answers

How to create ForeignKey without data with laravel

I'm creating a system and I have two columns: empresas and usuarios . The usuarios.id_empresa does is the foreign key of empresas.id_empresa , however, some data of the two tables are filled in simultaneously and after...
asked by 30.12.2017 / 17:14
0
answers

Find bigger field in a table with Eloquent

I'm using Laravel for an API In my DB I have a table called tbmanifestacao and in this table I have a column called nrmanifestacao I would like my controller to return the highest nrmanifestacao I tried this way:...
asked by 12.12.2017 / 20:43
0
answers

Inserting data on side 1 of the ratio 1: N - Laravel 5

I have the following tables, Condominios and CondominiosTaxas , which are a 1:N relationship, respectively, my relationship in the Condominium model: public function Taxas() { return $this->hasMany('WebCondom\Models\...
asked by 06.11.2017 / 11:57
0
answers

How to use Eloquent without losing performance (51.39%) in Lumen 5.4?

Developing an API that must handle a high-performance website. By doing a few tests, I noticed that Eloquent usage is lowering the performance of requests in the MySQL database in 51.39% (more than half). The OS is ubuntu 16.04 and the fra...
asked by 12.10.2017 / 15:42
1
answer

How to do pagination in a table that is related Laravel 5.4

There are 2 tables and a pivot where it makes the ManyToMany relationship between 2 tables . A table is called Postagems and the other table is named Departamentos , so I'm trying to do a related search by depart...
asked by 01.10.2017 / 00:00
1
answer

Reference in Related Tables | Laravel 5.4

I have the following relationship on a test system I'm doing. :: MODEL EMPLOYEE public function users(){ return $this->hasMany('lbo\User'); } :: MODEL USER public function employees(){ return $this->belongsTo('lbo\Employe...
asked by 05.07.2017 / 18:54