Questions tagged as 'laravel-eloquent'

2
answers

Remove quotation marks from Laravel Result 5.4

I'm getting a result via Request in Laravel like this: "2.1", I need to remove the double quotation marks from the result, because when I enter as a parameter in the query the whereIn understands as string ao instead...
asked by 02.10.2017 / 15:55
1
answer

Use sum with Eloquent

I have the following query: SELECT P.ID ,P.NR_CRACHA CRACHA ,P.NM_CLIENTE NOME ,E.DS_EMPRESA EMPRESA ,SUM( R.VL_PRECO ) VALOR FROM registro R JOIN pessoa P JOIN empresa E WHERE P.CD_PESSO...
asked by 24.11.2017 / 18:00
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
1
answer

BelongsToMany Laravel 5.4 Class 'Department :: class' not found

I have several 4 tables Starting with Users - > Departments - > category_department - > category - > postings; Where the department_category table it serves as pivo for many to many relationship between the departments table and the...
asked by 11.09.2017 / 19:06
1
answer

Insert Many To Many Laravel 5.4

I have a situation as follows. I have 4 tables users - > department - > category_department - > category - > postings Where in my view I have a select where it shows a data relation about ex department: Thisinformationalreadycome...
asked by 12.09.2017 / 01:12
1
answer

How to save a foreign key in laravel 5.3?

I'm having trouble saving the foreign key in the database. I'm working PHP , Laravel 5.3 and MySQL , below goes the code: Product Controller namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Produtos...
asked by 30.07.2017 / 03:20
2
answers

Laravel 5.4: List information from 4 tables related to the WITH clause

As you can see in the controller , I am listing the information for each agreement, along with information that is in other tables (phones, address ), to list the specialty and type of service of each. Unlike the phones and address tabl...
asked by 02.08.2017 / 21:52
1
answer

Mass assignment in Laravel

use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\DB; class Sale extends Model { protected $guarded = ['id']; public function vendor() { return $this->hasMany('App\Vendor'); } public functi...
asked by 22.07.2017 / 22:09
1
answer

Laravel: how to recover the primary key of a model after saving it [closed]

I wonder if it is possible to retrieve the ID of a template at the time it is saved to the database. I'm using the following Eloquent method: $modelo = Modelo::create(['ATT1' => 'valor1', 'ATT2'=>'valor2']); The template is saved, but...
asked by 18.08.2017 / 15:41
1
answer

Relationships Laravel OneToOne? [duplicate]

I am doing some exercises, but there is one where I can not understand why it is not working when I make another name in the method. I have a method in Model Location , where it does relationships of OneToOne . When I cal...
asked by 16.08.2017 / 21:29