Most voted "laravel" questions
Laravel is an open-source framework for developing web applications and services with PHP. Before asking consult the official documentation of Laravel.
Learn more…2,777 questions
Sort by count of
-
1
votes1
answer2989
viewsWhat is the key:generate command for Laravel?
I always see this command as a requirement to run cloned projects, but what is its purpose?
-
1
votes0
answers28
viewsLumen project creation error: Application ready! Build Something Amazing
I did the installation following the indications of the documentation, but when running Lumen new [project] it simply returns the message: Application ready! Build Something Amazing. , creates…
-
1
votes0
answers17
viewsError trying to log in with updated profile photo
I made a user photo exchange system, when I change the photo, I undress and try to log in again, it comes back to me with this error: This is my line 11: <img src="images/uploads/avatars/{{…
-
1
votes0
answers296
viewsRequest Variable returning null
Good afternoon guys, I’m new to frameworks but I have the following little problem: the request ta returning empty for my query thanks in advance "select * from `usuarios` where `cep` = ?" my…
-
1
votes1
answer26
viewsSearch data via SQL using Laravel
I need to select to return all users who have the initials of a name. Example: I type in my search input field: "paulo" returns to me all users who have this word. I did some research and used it:…
-
1
votes1
answer188
views -
1
votes3
answers146
viewsLaravel 5.5: same field in multiple rows on Seeds
As can be seen in the code below, the field created_at is the same in all, the only thing that changes is the nome. Would you have some way of writing the created_at only once, but insert in all…
-
1
votes1
answer289
viewsMore of a relationship with the table below
I have a Receivables table that has a relationship with the Customer Table and TWO relationships with a Chart of Accounts table* I searched the Eloquent documentation but couldn’t find out how to…
-
1
votes1
answer247
viewsWhat is the right way to import css and javascript in a project view?
I saw on the internet that puts the files in the public folder and calls in the view the Asset function of Blade... but this is currently correct ? why I see that in the project the js and css files…
-
1
votes3
answers781
viewsProblem with CORS using Ionic and Lumen
I’m developing an app with Ionic and using Lumen in the backend API. I am having problems with 'CORS', already configured the server (both using the internal PHP server and Apache, and the same…
-
1
votes1
answer6901
viewsUse sum with Eloquent
I have the following appointment: 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_PESSOA =…
-
1
votes1
answer263
viewsL5-Repository Package Validators
1º Is it possible to validate using the package itself? Currently, I use the package only to return the rules, example: Validator::make($data, $this->getRules())->validate(); Onde: $data: São…
laravelasked 6 years, 11 months ago Cauê Prado 13 -
1
votes1
answer445
viewsFind the best-selling products (Laravel / eloquent)
In the Table, assuming there is a 'Product' model (whose table is products), an 'Account' model (whose table is accounts), and an N:N relationship between accounts and products, in the Product…
-
1
votes1
answer31
viewsNested middleware
I would like to allow access to some pages only if user is logged in. I did so: Route::group( ['middleware' => 'usuario'], function (){ /* Minhas páginas */ }); So far so good, but I would like…
-
1
votes1
answer949
viewspagination with ajax in the Laravel
How could I make an adaptation of my code to make the paging work without updating the page with ajax? My functional paging code is like this: defined route Route::get('/home',…
-
1
votes1
answer654
viewsSession in Laravel 5
In my controller, log in as follows: if(!empty($input['user'])) { $result = $this->userRepository->searchuser($input['user']); //Busca o usuario pelo login // dd($result['data']['user']); if…
-
1
votes1
answer106
viewsLaravel - Doubt about @foreach?
I have the following code: @foreach($listaProdutos as $key => $listaProduto) @if(...) ... @endif @endforeach Is there any command or way to jump to the next record of $listaProduto if the…
-
1
votes2
answers41
viewsDo not display variable value in the Laravel view
@foreach ($respostas as $resposta) @if($reclamacao->id == $resposta->reclamacao_id) <td>{{$resposta->resposta}}</td> {{$i++}} @endif @endforeach When I run this code snippet,…
-
1
votes1
answer67
viewsCSS file in Laravel
I’m starting a new project in Laravel, following the instructions, but I’m having difficulty accessing my project’s css file. It’s saved in the CSS folder, inside the public folder, and I’m calling…
-
1
votes2
answers18
viewsHow to fix redirecting to subdomains that are on different servers?
I am working on an Arabic api that when they access the url of the api by the browser the user is redirected to the front-end. the problem is that the url of fron-end is concatenated with the url of…
-
1
votes1
answer14
viewsHow to create confirms Artisan Command Laravel recursively?
Want to increment one more? (yes/no) [no]: yes counter = 1 Want to increment one more? (yes/no) [no]: yes counter = 2 Want to increment one more? (yes/no) [no]: in the Completed search.…
-
1
votes1
answer38
viewsRelating 3 Standard Tables
Hello. I have a small model attached here. My task is from users, to get the records of Orders that have some record in the payment with the id of that order and the id of that user. Basically, an…
-
1
votes1
answer600
viewsUse the Laravel diff in two Collections
I am trying to fetch items that are not in a particular product. I therefore have a model Produto, each product has several items, and another model Item. I’m trying to use Collections of Laravel,…
-
1
votes1
answer433
viewsProblems when creating Migrations - Laravel
I’m in trouble ,to create a Migration in the terminal displays this... [Symfony\Component\Console\Exception\CommandNotFoundException] Command "make:migrations" is not defined. Did you mean one of…
-
1
votes0
answers168
viewsHow to use Scheduler in the Laravel
I am following the documentation of the Standard to create a Scheduler, but I’m having difficulty. Someone could give a light? In that command: php /path-to-your-project/artisan schedule:run…
-
1
votes1
answer882
viewsSQLSTATE[08001] - Named Pipes Provider - Laravel
I’m getting an error when connecting the application to the bank. The file . env is configured correctly with the database settings, the error I have as return: SQLSTATE[08001]: [Microsoft][ODBC…
-
1
votes1
answer445
viewsUpdate form registration with Laravel photo
All right, here’s the deal, I have a registration system in Windows, in the edit part, the form loads the fields filled with the photo, if I click update and do not choose an image file again…
-
1
votes1
answer191
viewsLaravel 5.5: Pick name of each table in select Union
I need to make a select in two tables and join them with the union, until then, but I also need to take the name of the two View. I’ve tried using the getTable() in each select, but it returns me…
-
1
votes1
answer42
viewsList 4 bank tables and account
Hello I have 4 tables: Employees, Companies, Salaries and Discounts. I would like to present a kind of Holerite. My initial idea was to bring all the information together and treat the view as…
-
1
votes1
answer61
viewsDoubt about Aravel; How does he execute this code?
I’m learning about Laravel and I was intrigued to learn how part of the code works framework concerning Seeder and the question is about the code to follow: public function run() {…
-
1
votes1
answer121
viewsIncorrectly formed foreign key retribution Migration
use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateMenusTable extends Migration { /** * Run the migrations. *…
-
1
votes0
answers421
viewsFile upload with Standard 5.4
I’m following the documentation to upload files to the folder storage however the path that the function returns is not the same path in which the file was stored, see in the documentation: $path =…
-
1
votes1
answer981
viewsHow to name table pivot Many-to-Many
How to name pivot tables in Laravel, so that it is not necessary to inform its name in the relationship method (belongsToMany)? In the documentation I found this reference: Many-to-Many Relations…
laravelasked 6 years, 8 months ago Fábio Jânio 3,407 -
1
votes0
answers66
viewsReceive an array of objects in a php controller
I want to send one array of objects for my controller PHP and I’ve done it this way $http({ method: 'POST', url: "payment/pagamento", data: $.param(vm.listProdsCar), headers: {'Content-Type':…
-
1
votes1
answer28
viewsmake an equal ID group
Well, I have a table that returns 5 users, and among these 5 may be equal teamID, example: usuario1 = teamid: 51 usuario2 = teamid: 51 usuario3 = teamid: 55 usuario4 = teamid: 55 usuario5 = teamid:…
-
1
votes1
answer218
viewsMethodnotallowedhttpexception($others) Laravel Send form via Ajax
I have a simple form and I am sending it to the controller by Ajax, but my problem is that after clicking the Submit button it does not call the Ajax request in my Jquery and already forwards…
-
1
votes1
answer681
viewsPass array in Laravel route
I need to pass an array to a controller. I did it as below but it returns the error: Missing required parameters for [Route: site.add.cart] [URI: adiciona-carrinho/{product}/{option}]. (View:…
-
1
votes1
answer57
viewsTransaction in different banks
In a certain part of the system I need to do the transaction control, but this operation involves tables that are in different databases. I made a test by inserting two tables in different banks and…
-
1
votes0
answers48
viewsOrganize json with Eloquent
My question is this: I want to organize my json for me to consult the table Animal and Hacienda, but organized, example: { "animais": { "id": 1, "nome": "Mimosa", "data_nascimento": "2017-04-11…
-
1
votes1
answer746
viewsCoverage of Unit Tests in Laravel
By starting a repository with a new Laravel 5.5 installation and setting up test coverage and Coveralls for this, despite having only scaffolded the framework authentication and not written a single…
-
1
votes0
answers49
viewsquery with Many-to-Many polymorphic Laravel?
I have a polymorphic m-m relationship in my bank where: class(id, name) student(id, name) Lesson(id, name) classeable(classe_id, classeable_id, classeable_type) a class has several Students and…
-
1
votes0
answers221
viewsCSS and JS of the Laravel project does not work on NGINX
configuration /etc/Nginx/sites-avaliable/default server { listen 80 default_server; listen [::]:80 default_server; root /var/www/html/; index index.php index.html index.htm index.nginx-debian.html;…
-
1
votes1
answer428
viewsLaravel Cors blocking requisicoes Xios
The configuration of my Laravel Cors is this. 'supportsCredentials' => false, 'allowedOrigins' => ['*'], 'allowedHeaders' => ['*'], 'allowedMethods' => ['*'], 'exposedHeaders' => [],…
-
1
votes1
answer537
viewsError when connecting with sqlite in the Laravel
Internally everyone is working, migrations, tinker, sqlite3, but in the server application it always queries the mysql instead of the sqlite for all operations, ie he is using Connector.php instead…
-
1
votes1
answer729
viewsLaravel consuming API and transforming object to array
Next I’m making a requisition like get and is returning me one objeto and would like this to be an array , have tried using $dados= Array.of($response->getBody()->getContents()); but of error!…
-
1
votes1
answer1001
viewsSending two or more request by form with ajax
Good afternoon guys, I want to know how I can send more than one form request to my Controller to do the relationship in the bank ? I have a relationship N:M with User and Group, only when I give…
-
1
votes1
answer101
viewsHow to make an alert close to the return date?
I am developing a library system for an institution, but I am having difficulty making an alert when the return date is near or leave the fields in red when a student does not deliver the book on…
-
1
votes1
answer348
viewsHow to structure a good controller with Laravel Socialite?
I’m using the Socialite to provide authentication via account providers (Facebook, Twitter, Linkedin...). In my application, when authenticating via provider, if there is already an association of…
laravelasked 6 years, 7 months ago Fábio Jânio 3,407 -
1
votes1
answer221
viewsHow to determine the most suitable data type for a fixed-size numerical field?
I’m having a doubt about the characteristic of some attributes of my table. Problem: I have to keep an identification number of my items, this is always composed of 3 digits (zero left in case of…
-
1
votes1
answer72
viewsMutator as Standard Attribute
I have a mutator similar to this: public function getLastTotalAttribute() { return $this->produto->sold_on_register; } I want the last_total attribute to be automatically generated in the…
laravelasked 6 years, 7 months ago David Dias 995