Most voted "laravel-5" questions
Laravel is an open-source framework for developing web applications and services with PHP. Use this tag for specific questions about Laravel 5 or later.
Learn more…751 questions
Sort by count of
-
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 5 years, 11 months ago Sidiclei F. Almeida 307 -
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
answer315
viewsRedirect unauthorized user Laravel
When 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
votes1
answer207
viewsFormat data before saving to the database
I’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
votes1
answer263
viewshref Laravel and Vue.js
I 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
answers874
viewsSelect specific columns from two related tables
I 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
votes0
answers38
viewsWhat is this error when running php Artisan migrate
Hello, I created an application with Laravel 5.7 and running php Artisan migrate shows this error What this error means and how to correct? Follow my.php database <?php return [ 'default' =>…
-
3
votes2
answers155
viewsPerform action before saving?
I’m getting the requests form and putting everything at once to save using the protected $fillable = ['nome', 'idade', 'cep', 'nr_casa']; of Laravel I’m getting it like this: public function…
-
3
votes2
answers2119
viewsDisplay creation date (created_at) in Laravel 5.5 post
Good morning guys, I am very beginner in Lisbon and I have a small problem that I am not able to solve. In a post view, I need to display the date the post was created. In the database it would be…
-
2
votes1
answer592
viewsLaravel validation
I need to do a data validation coming from an XML, have as I use a Validation Request? Or Validation Request only for data coming from a form?
-
2
votes1
answer446
viewsTaking data from the checkbox and sending it to the bank
I am creating a form and need to send to the bank the selected checkbox. I have the table conta, conta_categoria and categoria. In the conta_categoria have the id_conta and the id_categoria. How…
-
2
votes2
answers522
viewsRecovering value in the pivot table as property of a relationship part
I have the relationship manyToMany amid Grupos and Usuarios and a pivot table grupo_usuario which stores the keys and an extra field aprovador, boolean, which serves to indicate whether the user in…
-
2
votes1
answer878
viewsWhy does creating the model not create Migration for me?
I’m starting at Laravel 5 and then this tutorial. By creating the model php artisan make:model Tarefa he does not create me to Migration in database/migrations/ as it would be supposed, someone…
-
2
votes3
answers445
viewsHow to make the relationship of an extra field (pivot) in belongsToMany
Currently I have the following situation: 1 User can belong to several municipalities Within that relationship - municipios_usuarios - I also need to save who made this relationship, ie usuario_id…
-
2
votes1
answer781
viewsLaravel 5 improve filter
I created a filter in my view index, when I put something inside one of the filter inputs enters ifs but I think it’s not good this way, someone knows somehow better? public function index() {…
-
2
votes1
answer411
views@Yield does not display content
I am learning Laravel 5.1, I came across a mistake while using the @yield. I can’t move the contents from another archive to the archive where I want to include. Next I have the content I want to…
-
2
votes1
answer757
viewsModelfactory is not generating $Faker data for some tables
I’m using the ModelFactory standard of Laravel 5 some time ago, and everything was going ok, but from a few days to here stopped generating data from the library faker for some tables, although…
-
2
votes1
answer987
viewsHow to redirect to auth/login in Laravel 5.1 if visitor is not logged in?
I am using Laravel 5.1 native authentication but when accessing a protected route the system does not redirect me to the login screen, instead it shows me the message "You don’t have permission to…
-
2
votes2
answers1244
viewsHow to work with scripts and style sheets in Laravel 5.1
I’m new to Laravel 5.1 (actually any Laravel) and I’m having a hard time understanding how to work with style sheets and simple scripts. On several sites, I see that I need to add an element to my…
-
2
votes1
answer2502
viewsHow to use Laravel Excel Library
I have a .csv where I need to import your data into the database. I am using an Laravel library to import it. What is this one: https://github.com/Maatwebsite/Laravel-Excel In the code I’m doing…
-
2
votes1
answer79
viewsMultiple Schema based on Laravel 5.1 subdomain
I am creating an application that, when the customer is creating the structure of his store, he will get a subdomain (which he will choose himself) and the database that Laravel will search for will…
laravel-5asked 9 years ago LeandroLuk 4,989 -
2
votes1
answer357
viewsDoubt Laravel 5 - Libraries and Functions
<?php namespace App\Http\Controllers; use App\Http\Requests; use App\Http\Controllers\Controller; use App\ListaProduto; use App\Produto; use Input; use Illuminate\Support\Facades\Request; use…
-
2
votes1
answer788
viewsCreating and using Libraries in Laravel 5.1
I am new to Laravel 5.1 (I come from Codeigniter) and I have my own libraries that I would like to implement in it. In Codeigniter, we have the folder libraries where I can play all my libraries…
-
2
votes2
answers355
viewsTokenmismatchexception after any ajax error on Laravel 5.1
I have been working with Laravel for a short time and am having a problem when using ajax requests. When my application returns any error and I try to send another request, Laravel sends me this…
-
2
votes2
answers2912
viewsWrite to two different tables using the same View
I am registering suppliers, and I need to record it in a table and your address in another. I use a single view suppliers. to fill in all the data. How can I separate this data to save it to their…
-
2
votes1
answer2455
viewsFolder for Models Laravel 5.1
Good morning, different from Laravel 4, the version 5.1 creates the Models directly in the folder App, wanted to know if it will influence something if I create folders to better organize these…
-
2
votes1
answer254
viewsModel, View and Controller "Multipurpose" - Laravel 5.1
Good morning, I have in my application 10 different tables, but it has the same structure... id | nome | descricao. For each table I have in the Model, the Controller and the Views registration,…
-
2
votes1
answer200
viewsEmail return:null Laravel Socilite - Facebook/Github
I am trying to register/login a system via Facebook using the Socialite in the Laravel 5, but the problem is that the user’s email always returns as null. I also tested with the Github and the…
laravel-5asked 9 years ago Guilherme Dambros 172 -
2
votes1
answer1061
viewsArtisan command not to lose data from database
Hello I am starting to work with Laravel 5 and I am having a problem when I run the migrate commands the data is lost in the database, this is expected? the command php artisan migrate works on the…
-
2
votes2
answers100
viewsDefault record if no other - mysql
Is it possible to program the database to have a default record if there is no other record in the table? making the table impossible to be empty. then if there are other records it ignores the…
-
2
votes1
answer353
viewsIs there any way to run Laravel on the command line in interactive mode?
In PHP, I know it is possible to rotate it interactively on the command line, which is via the command php -a. Even better would be using the library psysh. But when it comes to not just running…
-
2
votes0
answers90
viewsImplementation of Doctrine 2.5 in Laravel 5.1 using mysql database configuration
I started using the Larable recently and managed to configure almost everything, but when configuring the database, soon after the installation of Doctrine, it returns me this error:…
-
2
votes1
answer1882
viewsPick up specific columns with Laravel querybuilder
Consider that my table in DB has many columns. However, for a specific query I do not need all of them. As I would in Laravel ( using both Eloquent and Querybuilder to pick up only the columns I…
-
2
votes2
answers1956
viewsHTTP 500 error when putting an orange project5.1 into production
I developed a project in Laravel 5.1.In Localhost everything works fine, but when I go up to the client server, which is not shared and is with PHP 5.6, it doesn’t work. Error appears HTTP ERROR…
-
2
votes1
answer175
viewsError while uploading site
Guys I just uploaded a site of mine made in Laravel 5.2 with Pho 5.6 locally. I went up to a shared hosting in Locaweb that I have. I configured PHP 5.6 correctly and I went up the site here giving…
-
2
votes1
answer904
viewsSingle record with 2 fields verification - Laravel 5.1
I have a table with columns id, nome, descricao and tipo. In my Request I have: 'nome' => 'required|unique:edificacoes' So far so good, I can not register anything with the same name, but as I…
-
2
votes2
answers2873
viewsLaravel - How popular a combobox in the 'on load' event of a view (Blade)
I need to popular a combobox with database data, but this fill should occur while loading the view. Since the view is not the right place to write code, how to feed the combobox? Through a method in…
-
2
votes1
answer127
viewsIs it possible to customize the return of the Laravel validation when using Request?
When I use a request post and check the data using Request in Laravel 5.2 via ajax, the data is automatically returned to javascript. I wonder if there is a way for me to capture and customize this…
-
2
votes1
answer785
viewsWith creating a Request with namespace in Laravel
I tried to create a Request with a subnamespace in Laravel 5, but to no avail. When I turn the remote php artisan make:request Temp\OsRequest, instead of creating a file called OsRequest inside a…
-
2
votes1
answer853
viewsHow to consume authenticated API in Laravel with Vuejs?
I need to consume an API with Vuejs in Laravel 5.2, but it is authenticated, some hint for this process ?
-
2
votes1
answer173
viewsHow to Sort Related Model Data?
I have the following relationship in my application: Model Client: class Cliente extends Model { protected $table = 'clientes'; public function Usuario(){ return…
-
2
votes0
answers254
views -
2
votes2
answers97
viewsLaravel 5 Querybuilder, simplified collection results
I’m using the method get() of Laravel’s Querybuilder and would like to know if it is possible to return the id’s in a simple one-dimensional array, for example: [35,45] Instead of:…
-
2
votes1
answer241
viewsHow to make a "select distinct" on a model in Laravel?
I’m pulling the data from a table to a select, but I have fields where the information is equal, for example: Controller: $amostragens = Amostragem::all(); View: @foreach($amostragens as…
-
2
votes1
answer607
viewsChanging the content of Modal Laravel 5.1
I have a Grid with the edit button when I click it accesses the Controller and brings the data of a certain user in a Modal. But it’s only bringing from the first user I click. Follows the code:…
-
2
votes1
answer217
viewsLaravel 5.2 $errors empty
I am using Laravel 5.2 and am trying to create a validation for user record. In Usercontroller.php I have: public function postSignUp(Request $request){ $this->validate($request, [ 'email' =>…
-
2
votes3
answers1906
viewsHow to find the Laravel base url?
I remember that when I used the Codeigniter framework, I could find out what the base url of the application was by simply calling base_url(). On Laravel 3, I wore URL::base(). But now, on the…
-
2
votes1
answer559
viewsLaravel - Not log in after registration....?
How to remove automatic login after registering? I commented the following line from the Registerusers file: public function register(Request $request) { $validator =…
-
2
votes1
answer772
viewsI can’t do Laravel Authentication 5.2
I’ve been trying for some time to make an authentication and I can’t, I’m a beginner in the business, who is willing to help me know that you will be practically saving my life, because I’ve thought…
-
2
votes2
answers3109
viewsMethodnotallowedhttpexception in Routecollection.php - Laravel 5.2
Developing an application using Laravel 5.2, PHP7.0, Apache2 and Centos 7, I am having the following error: Methodnotallowedhttpexception. On the local server it works normally... when I publish on…