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
- 
		3 votes1 answer416 viewsProtecting a route used by a single domainI have an Laravel application hosted in a subdomain and need to allow your API (which has a single POST route) to be used solely by the application hosted in the main domain. What is the simplest… 
- 
		3 votes2 answers2510 viewsPass string to uppercase - StandardGood afternoon. I have the following code that saves perfectly. public function store(Request $request) { $this->validate($request, [ 'servidor' => 'required|unique:servidors|max:255', //… 
- 
		3 votes1 answer809 viewsPHP Sqlserver Stored Procedure does not run correctlyHello, I am developing an application using Laravel Framework Handler from my Backend and found the following error. My Sqlserver Express 2008 R2 database has a stored Procedure that performs a… php sql-server laravel stored-procedures sql-server-2008asked 8 years, 10 months ago Jonatan Pietroski 109
- 
		3 votes1 answer985 viewsDowngrade of package in LaravelI’m facing a problem to run the composer install due to a package that is incompatible with the version of the Laravel that I currently use; The version I have is 4.1 with php 5.6, but when I run… 
- 
		3 votes2 answers230 viewsIs there a way to clear the field formatting before going through validation?I’m trying to search the net how I solve this and it’s taking a long time, it seems to be something simple but I’m breaking my head, I decided to create a post here. I’m using Laravel 5.3 with Mysql… 
- 
		3 votes1 answer144 viewsSend Command variable from Laravel ControllerToday I call a command for controler perfectly, but I would like to send variables as well. In controller, call the command that way: \Artisan::call('syncustomer:sav'); The name attribute of the… 
- 
		3 votes1 answer141 viewscall method in the Laravel queryI have this query here: SELECT p.descr, p.dt_hr, f.id_friend FROM users u JOIN friends f ON u.id = f.id_user JOIN posts p ON p.id_user = f.id_friend WHERE u.id = 1 She returns it to me: I’m wanting… 
- 
		3 votes1 answer186 viewsFunction extension on the LaravelI’m using the Laravel 5.3 and apparently I have a Controller calling the function: (new AnuncioRepository())->getListagemAnuncios() and the SQL for that is: return DB::select(' SELECT anuncio.id,… 
- 
		3 votes1 answer10458 viewsHow to use Inner Join in Laravel 5?I have the following loop in a view table @foreach ($filme as $f) <tr> <td>{{ $f->fil_id }}</td> <td>{{ $f->fil_filme }}</td> <td>{{ $f->fil_sinopse… 
- 
		3 votes2 answers1007 viewsBlade and Angular JS Incompatibility in Laravel 5I’m having trouble using Angularjs along with Laravel’s Blade. After researching this site myself, I discovered that to resolve the conflict with Laravel the latest method is using the @{{}} in the… 
- 
		3 votes4 answers342 viewsLaravel 5.3 - Model that can be created by multiple ControllersGood afternoon, use Laravel 5.3 as back-end of a project and I will try to explain in the most succinct way the problem. Problem: In my project I have the Duplicate model and the Contract. A… 
- 
		3 votes1 answer324 viewsRequired_if with more than one field in Laravel 5.3I have the following situation: I want one field to be mandatory only if the other two are null, if one of the other two is not null this field is no longer mandatory. I thought I’d use the… 
- 
		3 votes2 answers417 viewsVagrant error up windows 10I am using Homestead and Vagrant to create a Virtual Machine and run my web projects. However, I cannot log into my hosts (ex: meusite.dev), all are already properly configured on Homestead.yaml and… 
- 
		3 votes1 answer222 viewsPage Controller Pattern vs Front ControllerWhat is Page Controller? What is Front Controller? From what I read, page controller means a controller that is embedded in the html/jsf page facelet. However in the Front Controller the controller… 
- 
		3 votes2 answers675 viewsRequest a form with Standard not workingI’m making a request from my controller for a form in the view, is giving this error. I tried several methods, but none solved. Controller: public function store(Request $request) { $NomeDaEmpresa =… 
- 
		3 votes1 answer340 viewsHow to change Laravel’s relationship keywordI have the following problem, I entered a project where the database already existed and is in production, so all foreign keys of this bank are with the nomenclature fk_ and the Eloquent of Laravel,… 
- 
		3 votes2 answers234 viewsHow to globally set the default date output in Laravel 5?I remember well when I used the Laravel 4 that it was possible to convert globally the formats of created_at and updated_at, for display in JSON replies or even in direct call {{… 
- 
		3 votes1 answer1571 viewsWhat does "{{ __('Login') }}" mean in the Laravel layouts file?In the archive \resources\layouts\app.blade.php has the following line 37: {{ __('Login') }} It seems that this is a Helper. But what is its meaning/functioning? I ask this because depending on the… laravelasked 7 years, 7 months ago Fábio Jânio 3,407
- 
		3 votes1 answer60 viewsSyntax ':value' in the arrayI saw this syntax in the 'Resources/lang' area, where authentication messages are preset. And I came across the following code: <?php return [ 'throttle' => 'Too many login attempts. Please… 
- 
		3 votes1 answer80 viewsWhen using back() in the Laravel this should be preceded by redirect()?Observing many implementations I saw that the staff uses with a certain frequency return redirect()->back()... My question is: What’s the difference between return redirect()->back()... and… laravelasked 7 years, 7 months ago Fábio Jânio 3,407
- 
		3 votes3 answers5888 viewsDifference between the create and Fill method - StandardI was developing a web service with Laravel, and I realized that I can save the data in my database in two ways: Product::create($request->all()); or else: $product = new Product();… 
- 
		3 votes2 answers549 viewsI cannot extract the information from Json on LaravelI get a request like this... public function store(Request $request) { return response()->json($request->all()); } That’s the way out: anexoPdfGuia: {} guiaFiscal:… 
- 
		3 votes2 answers994 viewsJoin in Laravel 5.x in two tables?I have two tables that are already listed on MySQL and use Laravel, I am already persisting the information in the bank. When I record a news, it is already assigned to the author normally (tables… 
- 
		3 votes1 answer4474 viewsMany Relationship for ManyWell I tried to read the documentation and develop this relationship but could not, actually I need to inform what is the name of the type of user. The database model is thus : MODELS involved… 
- 
		3 votes1 answer508 viewsWhat is the difference between Request::wantsJson() and Request::ajax()?In Laravel 4, I used to use the method Request::ajax() to know and the request was an XHR. When I started using the Laravel 5, I realized that it was being used more in the Request::wantsJson(). But… 
- 
		3 votes2 answers339 viewsHow to validate integrity when trying to save duplicate data to the database?Context: When trying to register the object Structure checklist the following error occurred: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '6-5' for key… 
- 
		3 votes1 answer100 viewsMultiple App Laravel using the same App tableI have in my scenario 3 servers http running the same application Laravel and sharing the same database, where the first server LoadBalance using nginx, basically with the same load weight. The… 
- 
		3 votes3 answers4175 viewsHow to change a PHP array’s keyI need to change the key of an array $task=array('Title' => 'Test', 'Description' => 'Description test') I need to change the key name Description Is there any way? I’m working with the… 
- 
		3 votes3 answers451 viewsPermissive issues when creating Linux server folders using mkdirI have a PHP system using Laravel 4.2 where I use the mkdir command to create a folder in the Storage/pdf directory, the command works in the Windows Dev environment, but when climbing to the UOL… 
- 
		3 votes0 answers28 viewsLocal environment does not process some requestsI am working with 2 sites in Laravel, where requests to the server import and export large bases in Excel. When I make changes to these bases, I cannot test them on my local machine, I must go up to… 
- 
		3 votes2 answers369 viewsTraverse arrays with dates and compare with the current dateI need to create a method that compares in two or more arrays if the current date is greater than the due dates (date_paymentX) that exist in these arrays and returns how many occurrences there are.… 
- 
		3 votes1 answer2086 viewsHow to create functions available globally in the Standard?I would like to create functions that are globally available to reuse the code. What would be the best way to do this, in the Standard... The flow I need would be like this.: I’ll get a requisition… laravel laravel-5 laravel-eloquent laravel-5.3 laravel-bladeasked 6 years, 10 months ago Sidiclei F. Almeida 307
- 
		3 votes1 answer1445 viewsSelect model methods in the Laravel controller index method?I have an index method that searches all events in the database and shows in a table Model Event: namespace App\Models; use Illuminate\Database\Eloquent\Model; class Event extends Model { protected… 
- 
		3 votes1 answer196 viewsConcatenate multiple Sass/css files into one final cssI am using Laravel 5.4, which by default brings a file webpack.mix.js which will be the files to be concatenated and their destination. My problem is concatenating files scss with css, what I have… 
- 
		3 votes1 answer557 viewsValidate composite key with Laravel?I have a table where employees of a company are inserted with the following fields; id, name, email, use_id, role_id. user_id is the id of the company the employee works for. The validation I need… 
- 
		3 votes1 answer315 viewsRedirect unauthorized user LaravelWhen a page that is with the middleware auth attempts to be accessed by an unauthenticated user, Laravel redirects it to the 'login' route. How to change this so it redirects to another route?… 
- 
		3 votes2 answers1804 viewsDompdf API for PDF generation in PHPI use the laragon software that already comes with Windows and integrated Composer to the project, ran the line: Note: I have not preoccupied myself with good practices yet, I want to make it work… 
- 
		3 votes1 answer207 viewsFormat data before saving to the databaseI’m using the Laravel to develop a system, but I have a problem with data coming from a form, I need to format a data in the following format (#.##) to perform certain calculations, the problem that… 
- 
		3 votes2 answers78 viewsIs it correct and or indicated to merge in a 5.x Laravel project with the components developed in Vuejs 2 all within the same directory?It is known that the integration between Laravel and Vue is good, however it would be indicated to use the Vue components within a Modular project? each time the application grows will be more tied… 
- 
		3 votes1 answer263 viewshref Laravel and Vue.jsI am doing the list of registered phonesetters and in each line there is an edit button, in href, I need to use Encrypt and pass id, but this id comes from Vue.js and Blade with the use of {{ }}… 
- 
		3 votes2 answers172 viewsIs it worth 'shuffle' ID that will be passed via URL?We were talking about database security. Came the question: worth encrypting Ids coming from the database to the frontend? E.g.: I click on a client from a list where the link goes… 
- 
		3 votes1 answer280 viewsWhere x whereRaw What’s the difference?I tried to read Laravel’s documentation, but I didn’t really understand the difference. I also tried to search for other links but, I usually see topics in forums asking for help on the use and… 
- 
		3 votes1 answer343 viewsError when using POST in Laravel APII’m learning how to build an API using Laravel 5.4.*. In the Api.php: $this->get('products', 'API\ProductController@index', ['except' => [ 'create', 'edit' ]]); In the Product.php: class… 
- 
		3 votes1 answer466 viewsCreating routes for pagingI created a Restfull api in Laravel. In the project I have javascript and html in a folder that calls the API. Soon I created a pagination in the proper Laravel that I called in my own project in… 
- 
		3 votes1 answer89 viewsHow to delete all Mongodb Collections in LaravelA good practice in TDD is to keep the database clean between tests. For this, Laravel uses the Trait RefreshDatabase. However, this still doesn’t work for the Mongodb database. My idea is to delete… 
- 
		3 votes4 answers7452 viewsFormatting date with LaravelI’m unable to change the date format using the laravel 5.4 My model is like this: class Feriado extends Model{ protected $fillable = ['id', 'data', 'descricao', 'created_at', 'updated_at' ];… 
- 
		3 votes2 answers874 viewsSelect specific columns from two related tablesI have an N x 1 relationship, Post x User, have a relationship like the following: Post.php (model): .... public function user() { return $this->belongsTo('User'); } .... What I want is to select… 
- 
		3 votes2 answers107 viewsList Birthday Kids of the Day Using LaravelI use the code below that gives me a list of birthdays per month, but would need for the current date. Example: today 09/04 and the list display. $aniversariantesDoMes =… 
- 
		3 votes1 answer5901 viewsGeneral error: 1215 Cannot add Foreign key ConstraintI am trying to add a foreign key to this table with the following code block public function up() { Schema::create('registros', function (Blueprint $table) { $table->increments('id');… 
- 
		3 votes3 answers2003 viewsWhat is the correct way to pass two or more parameters on the route?I am trying to pass two parameters on the route, however, I get this error: "Route Pattern "/fiche/{id}/client/{id}" cannot Reference variable name "id" more than Once." The route used:…