Questions tagged as 'laravel-eloquent'

1
answer

eager loading and custom queries

This question is a follow up this and this . But I'll try to make them independent. I have the following tables, weathers : +--------+-------+---------+ | id | temp | id_freg | +--------+-------+---------+ | 337 | 12.36 |...
asked by 19.04.2018 / 19:46
1
answer

Laravel / Eloquent - Query on more than one table

I have the following Tabelas/Models and I am not able to make a query: Model 1 id | Name ---+--------------- 1 | Model1.1 2 | Model1.2 3 | Model1.3 Model 2 id | Name | model1_id ---+----------+---------- 1 | Mode...
asked by 07.10.2017 / 21:33
0
answers

Limit relation by common attribute

I'm working on Laravel and I have 3 tables (users, administrations and real estate). I would like to know, what would be the best way to relate (associate) users and properties belonging to the same administration? What would be the best w...
asked by 18.04.2018 / 12:53
0
answers

Large error 5.6 "Undefined property"

I'm trying to list an association table, in my case it's the class table, which associates officials (teachers) and students. I gave a good researched before posting this question but I could not solve the problem. Role model <?ph...
asked by 10.04.2018 / 06:51
1
answer

Error PHP Artisan Migrate

I'm having the following error when executing the command.    In Connection.php line 647:       SQLSTATE [HY000] [1049] Unknown database 'localhost' (SQL: select *   from information_schema.tables where table_schem a = localhost and   table_...
asked by 15.03.2018 / 11:51
1
answer

Group By Days Laravel Eloquent

I am not able to group data for different days. I have some communications registered and with the default Created_at and Updated_at I would like to show these separate releases day by day .. VIEW @foreach($messages as $message) <...
asked by 21.03.2018 / 22:25
1
answer

Warning when calling the orderBy method statically

In the PHPStorm interface a warning message appears stating that I'm calling the orderBy method statically, but it is not static. My call: Artigo::orderBy('edicao', 'desc')->paginate(25); Would this be "wrong"? Or would have to do: (ne...
asked by 21.03.2018 / 02:03
1
answer

Open existing project Laravel

I need to open a project previously made in laravel. I've never worked with laravel, so I do not know where I might be going wrong. The project came in a .zip file when I unzipped it it created a folder called engraf182-my-project-6609a7d5...
asked by 26.02.2018 / 18:11
0
answers

query with many-to-many polymorphic laravel?

I have a polymorphic m-m relationship in my bank where:    class (id, name)       student (id, name)       lesson (id, name)       classable (class_id, classable_id, classable_type) A class has several students and several lessons. a s...
asked by 20.02.2018 / 20:52
1
answer

Trying to get property 'name' of non-object Laravel Eloquent Error pulling foreign key data [duplicate]

I'm trying to use relationships to display data on the screen but I get the following error:    Trying to get property 'name' of non-object In this command $recebimento->planoconta()->get()->first()->nome MODEL ACCOUNT...
asked by 15.02.2018 / 14:28