Questions tagged as 'laravel-eloquent'

1
answer

Undefined offset 0 - Laravel

I have a list of users, each user has their 'role' (role / function inside the system, such as 'user' and 'admin') and this role has to be shown in the users list screen, which I I did it using the code block below. @foreach ($users as $key =&...
asked by 20.09.2018 / 20:40
1
answer

Redirect failure Laravel

Expensive, Can you help me with this laravel redirect? I created a method where it re-evaluates the data and redirects, on the other hand at the time of redirect I get the error Route [climate.consensus.visual.ID] not defined, only that I def...
asked by 11.09.2018 / 19:35
2
answers

Regex in CPF with Laravel

The system I'm servicing has CPFs registered in two ways, with and without punctuation, due to poor start-up that did not impose a standard. The problem is that the CPF can not be repeated, and when the user types a CPF with no punctuation, if i...
asked by 03.03.2017 / 15:31
1
answer

How to hide fields in queries using eloquent laravel using Join method

Of a question, I was given a way to query with child objects using the Join of eloquent, The query is below: $dados = Roda::join('veiculos', function($query) { $query->on('veiculos.id', '=', 'rodas.veiculo_id'); $query->where('ve...
asked by 17.10.2017 / 14:12
2
answers

Consultations in Laravel

I'm trying to run a query in Laravel , the terminal works perfectly, but when I enter in Laravel , it returns me empty, eg: Query: SELECT MAX(positions.id), devices.name, positions.deviceid, positions.ser...
asked by 07.03.2018 / 19:13
1
answer

How to make specific queries in sql using Laravel?

I need to make an appointment at the bank to see the birthday of the current month. Such a query, see:    SELECT * FROM membros WHERE day(dataNasc) = day(CURRENT_DATE) and month(dataNasc) = month(CURRENT_DATE); How could I make thi...
asked by 04.09.2017 / 04:37
1
answer

Class not found Laravel

Good afternoon, I'm starting with studies in laravel, the moment I joined Eloquent ORM I began to have problems. This is my controller. <?php namespace App\Http\Controllers; use Illuminate\Support\Facades\DB; use estoque\Produto; use Reque...
asked by 12.03.2017 / 21:55
1
answer

How to do inner join with Laravel?

I'm studying Laravel and I'm not able to how to join and display the data. All students who are in a class with the names, class code and description of the final situation.    Model: TurmasHasEstudantes public funct...
asked by 25.03.2018 / 21:46
1
answer

How to create a relationship between 3 tables Laravel?

I have 3 tables that you need to join to access the information. By the relation of Laravel I can create simple relations, such as belongsTo . I'm trying to access the information from the first table with the id of the thi...
asked by 03.06.2017 / 14:27
2
answers

Specify columns in a relationship with Laravel

I have a relationship of User with Role . User::with('role')->get() In this case, User has the columns: id , name, role_id , created_at and updated_at . And Role has: id , name...
asked by 27.01.2017 / 10:18