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
-
2
votes2
answers706
viewsValidation in Laravel 5 in array fields?
Through site collaborators I managed to ask a question Do a custom validation on Laravel 5 on validation in Laravel, where it was possible, validate a field input text only if a Combobox was…
-
2
votes1
answer639
viewsIs there a nomenclature standard for table index names in Mysql?
It seems simple this question, but wanted to know how to set a pattern. Usually using the Mysql Workbench a default is set automatically, as in the example below: fk_tabela1_tabela2_idx Note: I am…
-
2
votes1
answer887
viewsLaravel Update With Relationships - Good Practice
I created an Update for a Products table that is related to another table that is the Article(product_info) of this product. Only when I do Update I change the Product information, delete the…
-
2
votes1
answer259
viewsToo Loud for Too Many?
I have this model public function exercicio() { return $this->belongsToMany(Exercicio::class); } and public function treino() { return $this->belongsToMany(Treino::class); } My Controller…
-
2
votes0
answers64
viewsWhat is the difference between Guard() and Middleware()?
I’ve been noticing that they both basically do the same thing... I may have misunderstood, but what would be the difference between the two in Laravel?
-
2
votes1
answer82
viewsError creating Vagrant box Laseble/Homestead: TCP Connection reset by peer
So community, I’m setting up a PHP development environment and came across this error TCP connection reset by peer, I don’t have a clue what’s going on. virtualbox has been installed perfectly. I…
-
2
votes2
answers343
viewsError installing JWT/Laravel
I’m trying to install the JWTAuth in my project. I updated my composer.json as documented: Composer.json: "require": { "tymon/jwt-auth": "0.5.*" } I ran the Composer update command and presented the…
-
2
votes1
answer375
viewsCreate Model from a Migration
I created Migrations from the command migrate:generate of dependence https://github.com/Xethron/migrations-generator Is there any way to generate models from these migrations?…
-
2
votes1
answer271
viewsHow to upload image to Ckeditor interface?
I built a small blog with help from Laravel 5.3 framework. In the area of creating posts I’m using the Ckeditor, but I’m struggling to build an efficient upload "method/scheme". There are many…
-
2
votes1
answer644
viewsHow to get the result of the query executed in Eloquent?
How do I get the result of query which will be executed in the database? Example: foreach ($prestadores as $prestador){ $achou = \DB::table('modulo_pr_espelho') ->where('prestador_id','=',…
-
2
votes1
answer3317
viewsError trying to migrate bd from Laravel to Postgresql
I’m using Postgresql "5.4.*" Using Mysql, after the php artisan migrate tdo ok. But now I need to use Postgresql in the project, but after changing the DB: DB_CONNECTION=pgsql DB_HOST=127.0.0.1…
-
2
votes1
answer309
viewsMultiple Nvironment Portable
How do I create multiple Nvironment and mute at runtime the Nvironment I’m using in Laravel 5.5?
-
2
votes1
answer1038
viewsCorrect alternative that implements a validator for a date field in Laravel
to. $this->validate($request, [ 'data_nascimento' => 'regex:ddmmyyyy', ]); b. $this->validate($request, [ 'data_nascimento' => 'required|date', ]); c. $this->validate($request, […
-
2
votes1
answer933
viewsRunning a git project on my machine
I put a Laravel project of my machine into git with git ignore default. Then to use it on another PC I downloaded it from git from the command line and tried to install Composer: composer install…
-
2
votes2
answers2166
viewsCheck Empty Fields - Orange 5.3
I have an entire field and a date field that are not mandatory and are programmed to accept NULL, but when I send the form data without filling it in my controller receives the empty value instead…
-
2
votes1
answer967
viewsPHP: How to convert a number into a string?
I have an application that generates a PDF receipt. But in the bank the values have to be converted into words BD | PHP 10 | TEN 15 | FIFTEEN 7 | SEVEN there is some function that returns the string…
-
2
votes1
answer484
viewsUploading image to server does not work
When I upload locally, using WAMP64, everything happens normally. However, when I upload by the site, which is on the production server, the following error message is displayed. Nowritableexception…
-
2
votes1
answer312
viewsChange column names used to save timestamp
When I store or edit data in a table by Larable this creates a timestamp using the fields created_at and updated_at But I have to store the data in a table shared with another system, and this uses…
-
2
votes2
answers98
viewsHow to relate two records in an elegant way?
At a certain point of my application I am creating a post and relating this to the session user: public function adicionar(CadEditPost $request) { $request->merge(['user_id' =>…
-
2
votes1
answer1335
viewsView in select database attributes and edit with Laravel
I was able to include the attributes through an auxiliary table by this question: Save multiple attributes to the same object in Laravel It would now need that what was set in this auxiliary table…
-
2
votes1
answer81
viewsOptimizing Middleware Standard Behavior
I have the following middleware: class OwnerOrAdmin { public function handle($request, Closure $next) { $user = \Auth::user(); $postId = $request->route('post'); $post =…
-
2
votes1
answer584
viewsSelf-relationship with Eloquent in Laravel 5:3
I am building an immigrant control application and I own an imigrants table that has 3 self relationships. Its structure is as follows. id -> pk first_name -> varchar last_name -> varchar…
-
2
votes2
answers1025
viewsSum with SUM()
Two days ago I’m banging head with a query in the database marrying tables and returning the sum of values, I can perform the query by the quiet Phpmyadmin. Follows the query that works on…
-
2
votes0
answers310
viewsPermission denied Laravel 5.5
I’m trying to create my first Windows project with vuejs. I installed apache on Ubuntu 16.04 and navigated to the /var/www/html folder. I’ve circled the following command: composer create-project…
-
2
votes1
answer248
viewsSplit sum and Count output in the same Query?
The code below works, but I wanted to know how to do it all query, and if the way I’m riding her is really the best way. $query = Avaliar::select(DB::raw('COUNT(id) as contar'), DB::raw('SUM(nota)…
-
2
votes1
answer1599
viewsSave files with storeAs out of Storage folder
I have in an API in Laravel for file storage $request->file("file$i")->storeAs('categories', $nameFile) As it is it stores the data correctly in the address…
-
2
votes0
answers196
viewsRecognize Laravel Email Sending Error
Good morning. I’m making a cron with Laravel 5.2 for sending emails to my company, I am using sending Mail of Laravel and would like to know if there is a way for Laravel to recognize that the email…
-
2
votes0
answers1878
viewsConfigure Laravel Virtual Host in Ubuntu
When I access a project that does not use Lockable, it works normal, but when some access uses, does not load anything and shows an empty screen. Its configuration has to be different from the…
-
2
votes0
answers37
viewsWhat is the advantage of saving whole in the field that I want to save prices?
I was reading about building RESTFUL API with Laravel, and I noticed an interesting flame that I once wondered if the way I always saved "money" in the database. Is there a problem in saving as…
-
2
votes4
answers1209
viewsInput type datetime error
Good afternoon, I have a problem that I can not solve, I wanted to change the format of my form to "datetime", but when I test in my browser appears as if it were text. <div…
-
2
votes3
answers2508
viewsHow to take a variable that is in the controller and put inside a view (Adjustable)
I’m messing with Lockable and from there came the following doubt. I need to take a variable that is in the controller and put inside a view. In case I am sending an email with data contained in a…
-
2
votes1
answer2141
viewsHost website in Aravel
I have a project in Laravel. When I put my files to my hosting server and access the domain, it shows me the files and folders instead of redirecting me to the index. On my machine I create a…
-
2
votes1
answer125
viewsHow to set up an Anonymous Global Scopes in Laravel?
Inside my model I’m using a Anonymous Global Scopes to miss some operations: protected static function boot() { parent::boot(); static::addGlobalScope('owner', function (Builder $builder) {…
laravelasked 6 years, 9 months ago Fábio Jânio 3,407 -
2
votes0
answers1319
views -
2
votes1
answer407
viewsMulti-table heritage in Laravel
I have an entity Resource, which in turn has several implementations, for example, VideoResource and MarkdownResource. Resource has several properties shared, the other two examples in turn have…
-
2
votes2
answers50
viewsWhere should a globally used method be located?
I have a method called parser, in short your code is: public function parser($local) { $file = storage_path($local); $csv = Reader::createFromPath($file); // remove cabeçalho (ignora a primeira…
-
2
votes1
answer6457
viewsClass not found Laravel
Good afternoon, I’m starting with my studies in Laravel, the moment I entered the Eloquent ORM I started having problems. This is my controller <?php namespace App\Http\Controllers; use…
-
2
votes1
answer997
viewsBlade in Laravel 5.4 - How to work with class="active" in the menu links of a page in this scenario?
I have a menu with 3 possibilities: pg1, pg2 or pg3. The page is generated in Blade, using bootstrap. <a href="#" class="active">pg1</a> <a href="#">pg2</a> <a…
laravelasked 7 years, 8 months ago zwitterion 2,876 -
2
votes1
answer3314
viewsList and display images in the Laravel 5.3 Storage
I develop an application with Laravel 5.3, where the _DocumentRoot_ stays in the folder public. Upload images are in storage/app/public, but I don’t know how to list these images in a view, I can…
-
2
votes3
answers4047
viewsHow to translate Laravel?
clone that repository https://github.com/caouecs/Laravel-lang.git with language pack for Laravel, copied the en-BR folder to Resources/lang, changed the locale and fallback_locale to en-BR, but my…
-
2
votes1
answer298
viewsHow to use Bootstrap shortcuts in Vscode on. Blade files?
There is an extension called Bootstrap 3 Snippets, but it only executes snippets in HTML files. How to make it work in other extensions files?
-
2
votes1
answer705
viewsCalculate age in Standard
I want to calculate the age through the date of birth, I will leave the processing in the database, I am new in Laravel and I am not able to execute the following query: SELECT…
laravelasked 6 years, 7 months ago Sr. Bigode 511 -
2
votes1
answer1124
viewsPassing data from a table to an Laravel and Ajax modal
I have a table that brings my results from a search via Ajax. But I need to open a modal with more details about the table items, but I can’t pass the data to the modal. Follow the code: Contents of…
-
2
votes1
answer292
viewsError sending files to aws S3 server in Laravel
I am trying to send a file to the S3 server of Amazon, followed the documentation of Laravel 5.4 that talks about Filesystems. But it returns the error: Error executing "ListObjects" on…
-
2
votes2
answers985
viewsError Laravel migrate
I’m having trouble turning the remote php artisan migrate in the terminal, a monstrous error appeared that I don’t understand because it occurred, I’ll send the link from github for you to take a…
laravelasked 6 years, 7 months ago Thaynan Breno 27 -
2
votes1
answer1298
viewsLaravel Authentication 5.4
Talk guys, so, recently I started studying Laravel through some books/ video lessons, and I’m nodding my head with something related to authentication. When I take command php artisan make:auth The…
-
2
votes1
answer254
viewsWhat convention is used to organize Views of Laravel?
I would like to know how to organize the views in Laravel, in which directory it is best to leave the includes, templates and main views. Also what is better to put in includes (navbar? layouts?…
-
2
votes2
answers109
viewsAjax parameters are coming as Undefined
I would like to say that I searched the forum and found some similar questions, but no answer solved my problem. Follow my own doubt: Doubt: I am trying to delete a notification by ajax, but the…
-
2
votes2
answers397
viewsProblems with HTTPS and WWW Redirection
I’m struggling with something, I have various conditions to meet in mine. htaccess but I can never answer them at once, just once or twice. I have a project in Laravel on the way…
-
2
votes1
answer1277
viewsJoin no Eloquent - Join no Eloquent?
I’m learning Laravel now, and out of curiosity I came across the following problem, performing a Join between two tables, in my case, "categorias" and "subcategorias", when I will list the…