Most voted "laravel-eloquent" questions
Eloquent is the Laravel ORM. Use this tag for questions specific to the use of Eloquent and its related models
Learn more…425 questions
Sort by count of
-
-1
votes2
answers223
viewsData insertion error : String data, right truncated: 1406
I am trying to save Checklist data from protocol, but the following error is occurring at the time of saving: The expectation is that this happens: In the description of the error it says that the…
-
-1
votes1
answer772
viewsLaravel - Hasone 5.8
I have no problems with registering related data in Hasone I have doubt about registering 2 hasOne data... I know that to register two hasOne data is as follows example: $users = User::create([…
-
-1
votes1
answer114
viewsLaravel 5.8 - Relationship listing
I have the following code in my controller funcionarios::with('user', 'rh')->get()returns all beautiful related data but only the first record is really related sure the others in the RH…
-
-1
votes1
answer636
viewsHow to use the SUM in the Laravel?
MODEL CUSTOMERS public function titulo() { return $this->hasMany('App\Models\Titulo'); } MODEL TITLE public function cliente() { return $this->belongsTo('App\Models\Cliente'); } MIGRATION…
-
-1
votes2
answers71
viewsI have the following query using PDO, but how do I switch to Eloquent Laravel?
This serves for me to report through a timestamp in the column dating if my data has any modification. foreach ($lista_cnae as $cnpj => $lista) { $lista = "'" . implode("','", $lista) . "'";…
-
-1
votes1
answer46
viewsLaravel - loading data into an array when performing loop querys
I’m performing querys in a loop on a controller and need to go loading the information in a array to then send to a view and print. Turns out I don’t know how to input the data as follows…
-
-1
votes2
answers89
viewsConsultation Laravel Eloquent 3 belongtomany tables
1 2 3 I have 3 tables, Users, Roles and Permissions Example: User Carlos has 1 Role Admin and 1 Role Admin has 2 Permissions admin and user count(Auth::user() ->roles() ->with('permissions')…
-
-1
votes1
answer312
viewsHow to pick up the selected data from a checkbox by the checkbox
Hello, all right? I have the following form: <div class="form-group"> <label for="stock_options">Opções de Estoque</label> @foreach($stockOptions as $stockOption) <div…
-
-1
votes1
answer85
viewsMount Array with categories and subcategories that are in the same table
I am trying to assemble an array, but I am not getting, before the following table, I need to assemble the array as in the example below the photo. 6.x Standard design in the'categoria_id 'columns…
-
-1
votes1
answer27
viewsLaravel 8 - bootstrapswitch - Change output before sending to Bank
Next people I’m new to Laravel and I’m half crazy with that kkk Help I am sending a Form to my Database and using a bootstrapswitch checkbox. Follow my INPUT: <div class="col-md-12 col-xs-12">…
php javascript laravel-eloquent laravel-blade laravel-8asked 3 years, 7 months ago Isac Bandeira 11 -
-1
votes0
answers7
viewsHow do I blur the table "X" act when saving Document in Table "Y"?
I need that when saving a subject to a student, the request for said subject is deleted. i access requests through the Solicitudcontroller public function solicitudes() {…
-
-1
votes0
answers23
viewsQuery exceeding server limit, but in the local is ok, Orange
I wonder if you have how to optimize this query, not have to change server for now. $enterprisesIds = Survey::select('survey_enterprise.enterprise_id') ->join('survey_enterprise',…
-
-2
votes1
answer598
viewsBest Practice for Mass Assignment
To obtain the facilities that the framework proposes, in the specific case of saving data in a table of a database, we can use the mass assignment resource, which means, in free translation, 'mass…
-
-2
votes1
answer31
viewsError while doing update in the Standard
When trying to perform the following update: $criterios = Criterios::find(1); $criterios->update( [ 'criterios' => $request->criterios 'editado_por' => $user->id ] ); I get the error:…
-
-2
votes3
answers945
viewsRegister user with Laravel
I am setting up an application, where it is made registration of an employee, and this employee belongs to a company, which comes from the table users. When I do the registration process, the…
-
-2
votes1
answer606
viewsLaravel Database name error seems incorrect how to resolve?
I recently created a Previder service, which kind of works. however when I will capture the database data using Produtos::all(); I get the following error: Database name seems incorrect You’re using…
-
-2
votes2
answers63
viewsHello, I’m trying to search the Laravel, who can help me
I have a Model called Record, This Model has a method like HasOne who is called Item, I’m implementing a search, but here’s the problem. All the methods work normally, the problem is the following,…
-
-2
votes1
answer33
viewsSelection-based field options update with Laravel
From of this article I found an interesting way to create dynamic checkboxes. I was able to adapt it to my case by adding to/web.php routes Route::post('select-ajax',…
php ajax laravel laravel-eloquent html-selectasked 3 years, 8 months ago Tiago Martins Peres 李大仁 236 -
-2
votes3
answers45
viewsSymfony Component Httpkernel Exception Methodnotallowedhttpexception The PUT method is not supported for this route. Supported methods: GET, HEAD, POS
My Blade <form action="{{route('Update.afiliados', $users->id)}}" method="POST"> @csrf @method('put') <button class="btn btn-block btn-flat btn-primary" method="post"> <span…
-
-2
votes1
answer23
viewsLaravel - Use JOIN + COUNT
I have two tables, one for users (users) and another for companies (Companies). I need to select the data of each company and know the amount of users per company. This select in mysql works the way…
-
-3
votes1
answer328
viewsConsult children objects that satisfy condition in parent objects, Relationship with eloquent
I have in my project two tables that relate, but I would like to make a query Consult that brings all children entities that a field is equal to parent entity, being for all parent entities that…
-
-3
votes1
answer86
viewsI need to return this JSON with Laravel eloquent
Meu Json: { "data":[ { "data":{ "name":"Documents", "size":"75kb", "type":"Folder" }, "children":[ { "data":{ "name":"Work", "size":"55kb", "type":"Folder" }, "children":[ { "data":{…
-
-3
votes1
answer256
viewsCrud with Eloquent Laravel
I’m trying to do a CRUD with Eloquent Laravel in 2 tables with FK AND PK, but I’m not succeeding, already have the models just missing the CRUD function even, someone can help me? This is model with…
-
-4
votes3
answers89
viewsWith putting together a query on Eloquent?
How do I put this query in Eloquent? SELECT juros FROM tbl_parcelas WHERE 2500 BETWEEN tbl_parcelas.valor_min AND tbl_parcelas.valor_max CODE: DB::table('SELECT juros FROM tbl_parcelas WHERE 2500…
-
-5
votes1
answer67
viewsHow to use the ROUND function in Laravel
insira o código aquiI have the following query in PHP: $transferencia = $conecta->rawSelect( 'SELECT * FROM register WHERE ROUND(valor,2)="' . $json->VALORLIQUIDO . '" ' ); How I perform this…