Questions tagged as 'laravel-eloquent'

1
answer

How to configure remote database in laravel 5.4

I'm setting up a bank in Laravel 5.4, but the same is hosted on another server, set up in Navicat is accessing normally, but Laravel does not connect. APP_NAME=Laravel APP_ENV=local APP_KEY=......... APP_DEBUG=true APP_LOG_LEVEL=debug APP_URL=...
asked by 03.10.2017 / 16:42
1
answer

Help with a simple join

Good night, I do not know what I'm doing wrong, I have two models, in the migration I created it so Schema::create('endereco_tipos', function (Blueprint $table) { $table->increments('id'); $table->string('nome');...
asked by 13.09.2017 / 06:20
1
answer

Use WhereRaw with DateDiff

I need to get the difference in days between the current date and the date stored in the database, subtract this difference by 90 and then check if the result is equal to 7. Where is the error? whereRaw("90 - (DATEDIFF(now(), 'updated_at')) =...
asked by 30.10.2017 / 22:49
1
answer

RelationsShips Larval 5.4

I have 3 tables, [Users - > Departments - > Postings] where the Users table has many Departments Departments have many Postings. My question is: How do I relate the 3 tables with the with () method where (where () () is this logged in w...
asked by 23.08.2017 / 19:42
1
answer

trashed () returning 'true' after restore ()?

I have a Manifestation template that uses SoftDeletingTrait to keep them inactive in the database and in ManifestationController I have the following destroy() method: $manifestation = Manifestation::findOrFail($id)...
asked by 16.01.2017 / 19:28
2
answers

Make sum with SUM ()

The query that works in PhpMyAdmin: Select sum(D.CargaHoraria) as CargaHorariaTotal, C.NomeCurso, C.CursoId, A.Imagem from Curso C inner join Disciplina D on D.CursoId = C.CursoId...
asked by 22.12.2016 / 13:29
0
answers

Create Groups and Group Items Within

I have the following problem, I have a table with items and I need to create groups and name each item to its due group. I already distribute them by categories, which in the case I call 'families', however I need now to group them respectively...
asked by 07.11.2018 / 12:59
2
answers

How to make two WHERE clauses inside a nested WITH

I have the following code snippet $sectors = Sector::where('company_id', $id) ->where('status', '0') ->with('charges.levels') ->get(); I need 3 conditions sector status is 0...
asked by 19.09.2018 / 16:04
2
answers

How to pass data to the view automatically on the Laravel Resource Controller?

I'm using Laravel 5.6 with Resource Controller. My show method: public function show(Artigo $artigo) { $artigo = $artigo->first(); return view('painel.revista.detalhes', compact('artigo')); } Would it be possible to ignore the li...
asked by 20.03.2018 / 21:26
2
answers

List Tree Categories in Laravel 5.1

I'm starting with Laravel 5.1 and I'm a bit lost yet. I need to list categories, subcategories and "sub-subcategories". Table: Categorias ------------------------ id | int nome | varchar categoria_pai | int Data:...
asked by 11.08.2015 / 19:53