Questions tagged as 'laravel-eloquent'

1
answer

I can not find the model generated by the artisan

I used the command php artisan make:model Exemplo and could not find where it saved this generated model so I could change it. I looked at the app / html folder and found nothing. My db is ready, so I do not need to use migrate, but I...
asked by 13.10.2017 / 16:25
1
answer

Error passing array as parameter to Eloquent object

I'm having trouble inserting a record of type 1: N using Eloquent. When I pass the array with the attributes to the object as the documentation guides an error is thrown and when I print the error with echo $ex->getMessage() the only t...
asked by 22.08.2017 / 22:30
1
answer

Laravel / Eloquent: How to create a primary key composed of two foreign keys?

I am creating a simple system for school management and I will have a table named 'student_class', where the primary key must be composed of the student id and class id, which are foreign keys of the 'student' and 'class' tables respectively . I...
asked by 06.08.2017 / 19:11
3
answers

Update with Laravel does not take the model id

I'm trying to perform a simple function to change the password of the user logged in using the code: $user = User::find(\Auth::user()->idusuario); $user->password = bcrypt($request['novasenha']); $user->save(); But, it does not wor...
asked by 06.09.2016 / 14:11
1
answer

How to use the hasmany relationship in laravel 5.2?

I have 3 tables of funcionário , apontamentos and horastrabalhadas . My relationship is hasmany 1 employee has multiple apontamentos . When I show the result with a dd() , the employee data comes twic...
asked by 28.12.2016 / 18:34
1
answer

How to create functions available globally in laravel?

I would like to create functions that are globally available to reuse the code. What would be the best way to do this, in laravel ... The flow I need would be like this: I will receive a "Route" request    Then I'll process > "Con...
asked by 02.01.2019 / 00:12
1
answer

Integrity constraint violation in "Many to Many" create - Laravel

Context: By registering a company, by being "attached" several clients to it and that same customer can be "attached" in other companies. I have the following database structure: Model "Client": public function enterprises() { return...
asked by 12.12.2018 / 14:54
1
answer

Improvement of image insertion in bd

How would one minimize this image insertion code in the database? // controller/GaleriasController.php public function addGaleria { $galeria = new Galeria; $galeria->descricao = "galeria 1"; $galeria->img1 = Input::file('img1');...
asked by 11.02.2014 / 02:33
1
answer

Laravel Relationship in Datatable server side

Would there be any way to pass the model relationship to the columns of the Datatable server side? For example in the Datatable script: columns: [ { data: 'marca_id', name: 'marca_id' }, { data: 'automovel_modelo', name: 'automovel_...
asked by 19.09.2018 / 13:36
1
answer

Eloquent ORM ManytoMany constraint error 1452

I'm developing an application using Eloquent ORM, but I'm having a problem with the N to N relationship, The relationship is this: TherecordsI'musingasatestintheProductGroupstable: TherecordsI'musingasatestintheSubassemblyTabletable: Asyouca...
asked by 17.07.2018 / 23:09