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
-
5
votes2
answers112
viewsCustom request validating Unique field on update
Good morning. Guys, I have a request created for user validation, but when I update a record it validates the Unique field I set in validation.. I tried to pass $this->id along so that it…
-
4
votes2
answers3535
viewsDisplaying authenticated user data in the view
I have a problem that I believe is quite simple... I need to display the username logged in to my views... how do I do that? this is one of the views @extends('layouts.template') @section('body')…
-
4
votes3
answers1374
viewsShould I use routes or controllers in Laravel 4?
I’m a beginner in Laravel and I have doubts about the use of controllers, I read several examples/ tutorials and see the vast majority use the routes for example for a form request, to display…
-
4
votes3
answers1822
viewsI cannot access object property. Laravel/Eloquent ORM
I cannot access the properties of the related object. Well, I have a class calling for FileClass, she has the following relationship with class FileServico: Fileclass.php public function…
-
4
votes1
answer82
views"stdin is not a terminal" when I run Envoy - Laravel 4.2
A month ago everything is working fine, until I went to deploy a project and... When you execute the command envoy run deploy, using the settings below... @servers([ 'mt' => '[email protected]'…
-
4
votes1
answer541
viewsUsing ajax serialize in Laravel
What I need When the user clicks on the submit button the ajax will call a method of a class to check if the typed text already exists and in a table. It returns the result, if it is false it lets…
-
4
votes1
answer3410
viewsAPI in Laravel receive POST JSON and write to database
I will receive through the API a JSON with this structure: {"leads": [{"id":"1", "email":"[email protected]", "name":"Bruno Ghisi", "company":"Resultados Digitais", "job_title":"IT",…
laravelasked 9 years, 8 months ago David Santos 528 -
4
votes1
answer918
views -
4
votes1
answer2054
viewsInstall Pagseguro/PHP in Laravel
In the composer.php I’m putting it like this: "require": { "laravel/framework": "4.2.*", "pagseguro/php": "dev-master", #"pagseguro/php": "2.5.0", "cagartner/correios-consulta": "0.1.*",…
-
4
votes1
answer2084
viewsSet Laravel to Standard Level/Directory
I have an app Laravel and do the deploy from git to my server. But the problem is that the server always plays deploy inside the public folder, and the Laravel originally is to stay one level above.…
-
4
votes2
answers1319
viewsLaravel error in installation
Guys, I am using mac and trying to install Laravel. I have already installed the composer, surround the command line documented in the framework : composer global require "laravel/installer=~1.1" He…
-
4
votes1
answer260
viewsPagination hasMany Laravel 5.1
I have the following relationship in my Model Client: public function Usuario(){ return $this->hasMany('SIST\Models\Admin\Usuario', 'id_cliente'); } I pass the customer data through my…
-
4
votes0
answers2049
viewsPhp Laravel with Jasper report
I’m using the framework, and jasperphp to generate the report, but I can’t pass the pro database, most use mysql to generate the report, only I’m using Mssql, someone give me a light with that…
-
4
votes3
answers309
viewsPostgres SQLSTATE[42725]: Ambiguous Function
I am trying to perform the update to follow using Postgres but I am coming across the following message. Does anyone know a way to resolve? "SQLSTATE[42725]: Ambiguous Function: 7 ERROR: operator is…
-
4
votes2
answers357
viewsPortable blade and performance
In the Laravel, we usually use the Blade in order to write a view. Example: @unless($variable) <p>Nenhum dado encontrado</p> @else @foreach($variable as $v) <p>{{ $v }} </p>…
-
4
votes2
answers422
viewsCorrect use of Laravel Mutators 5.1. Is it possible to use it in this way described below?
Hello, I’m using Laravel 5.1 at the moment and I came up with a question. I have a grid that shows values of a given CRUD and I search through Table::all(), which returns something like: array:5 [▼…
laravelasked 9 years, 1 month ago MauricioLGJunior 45 -
4
votes1
answer400
viewsCheck which field already exists in the table
I’m making a query in Laravel to see if the user with the email, CPF or username entered already exists in the database. # Verificar se Usuário Já Existe na Base de Dados $verUser =…
-
4
votes2
answers250
viewsHow to join the query string in Laravel 4 pagination?
How do I join query string in the 4-way pagination? For example: I have a data listing and on this screen I have a search filter. When I send a get to request the filter in the list by the url…
-
4
votes1
answer462
viewsJson with relationship Manytomany - Laravel
I created a relationship between my tables using ManyToMany and currently I need to return a Json with the information, but my tables meet this way; // 1. Produtos +-------------+ | id | | name | |…
-
4
votes1
answer688
viewsAmbiguous column - Laravel 5.1
Good morning! Here’s the thing... I have these 2 tables in my postgresql database: tipos_risco --id --nome agentes_risco --id --nome --id_tipo_risco (foreign key) The problem is I’m not getting the…
-
4
votes1
answer324
viewsInitial Value Sequences Postgresql - Laravel 5.1
Good morning, I am running some tests on my application, but I have the following problem: After the migrate and the db:seed, whenever I will enter some record by applying a duplicated primary key…
-
4
votes1
answer347
viewsTwo __Construct() Functions in the Same Project
I can’t have two functions __Construct() in my project Laravel ? There is one in Controller.php and wanted to build one __Construct in another Controller. Just give me variable errors on the…
laravelasked 8 years, 6 months ago Diego Souza 16,524 -
4
votes1
answer978
viewsPass a view JSON to the route
I’m trying to send a JSON of view for a route, but I’m not getting it. Unfortunately I know little about JSON, ajax, GET and POST. In the view, the json: var json = { "numeroMesa": numeroMesa,…
-
4
votes1
answer398
viewsSaving data with hasMany relationship
I’m trying to do an update and three tables related to Laravel, the past data comes from a single view, and the relationships have been made, should be the update action of my controller that is not…
laravelasked 8 years, 10 months ago Bruno Santos 103 -
4
votes1
answer595
viewsHow to get a PHP object in an ajax function
I have the code below that does a check on my controller and it returns me a Count of my request. What I wanted is that in the sucess of my ajax Jquery I capture this value to make some negotiations…
-
4
votes2
answers2630
viewsSee total records in Laravel
In certain part of my application written in Laravel I have this consultation: $counts = User::select(\DB::raw('count(*) as status_count, status')) ->groupBy('status') ->get(); It returns me…
-
4
votes1
answer1000
viewsHow does Laravel 5 make an instance to be passed automatically if we just set Type Hinting in the parameter in a function?
I believe that this is a fully valid curiosity, since it greatly facilitates and speeds up development. I always analyze the code of the frameworks I use, such as Cakephp 2, Laravel 4 and Symfony 2.…
-
4
votes1
answer624
viewsLaravel 5.2 with pagination
I have the following function inside the controller public function home() { $igrejas = Igreja::paginate(3); $igrejas->setPath('igrejas'); return view('admin/igrejas/home')->with('igrejas',…
-
4
votes1
answer405
viewsHow to validate login without redirecting the page?
I have the following login form in a dropdown, my question is the following, how to validate the login without redirecting the page? Currently when the user informs a wrong password he is redirected…
-
4
votes3
answers145
viewsBlade default value Laravel 5.2
I have the following code <strong class="primary-font">Complemento</strong> <p>{{ $produto->complemento or 'Esta produto não tem complemento' }}</p> I need that if the…
laravel laravel-eloquent laravel-blade laravel-5.2asked 8 years, 4 months ago Danilo Tiago Thai Santos 409 -
4
votes3
answers684
viewsUpdate registration with Laravel 5.2?
I have the following function : public function alterar($id) { $produto = Produto::find($id); $params = $request->all(); $produto->fill($params)->save(); return…
-
4
votes1
answer854
viewsLaravel Undefined column: 7 ERROR: column "1" does not exist
In the join, I am passing a direct value, and Laravel is trying to "read" this value as if it were a table. function ($join) { $join ->on('e.pee_fk_pes_codigo', '=', 'p.pes_codigo')…
-
4
votes2
answers3070
viewsHow to see the queries that were executed by the eloquent in Laravel?
How can I find out which queries were executed in Laravel? For example, I have the following query: $usuarios = Usuario::with('nivel')->where(['status' => 1])->get(); I would like to know…
php laravel laravel-5 laravel-4 laravel-eloquentasked 8 years, 3 months ago Wallace Maxters 102,340 -
4
votes1
answer1467
viewsCSS and JS files in Laravel
By "default", the CSS and JS files in Laravel are in the folder public. But when I create dependencies with Bower, it creates the component folder in the folder vendor. I can change the vendor for…
-
4
votes3
answers13726
viewsError while running Composer
I created a virtual machine with Vagrant and used Puphpet. However when I run Composer I have as return only this list of error,I have created 4 different machines and always the same error. Someone…
-
4
votes1
answer664
viewsUse 'WHERE' if value is different from 'NULL' in a search system
I’m trying to make a simple search system with some text fields: $nome = $request->nome; $email = $request->email; $bairro = $request->bairro; $request = Contato::where('nome', 'like',…
-
4
votes1
answer575
viewsLaravel Auth::Atempt() always returns false
I tried to authenticate, but it always comes back false in the method Auth::attempt() of Laravel: $prontuario = Input::get('prontuario'); $senha = Input::get('senhas'); if…
-
4
votes2
answers719
viewsHow to keep foreign key restriction using softdelete?
How can I maintain the integrity of my database when using softdelete? Example: try to exclude a person which is linked to a account through a foreign key, in normal ways this will not be possible…
-
4
votes1
answer122
viewsDo a Hasmany per date with Laravel 5.3?
Is there any way to make a HasMany bringing records by date? public function despesas() { return $this->hasMany(Despesa::class); //registros apenas desse mês } I tried to use the following, but…
-
4
votes1
answer58
viewsField code in option value attribute
I have a table CategoriaCNH with the following fields CodCategoriaCNH and Descricao. and I have this piece of code html: <select name="categoriaCnh"> <option value="" disabled…
-
4
votes1
answer982
viewsHow to use Laravel Facades outside of its structure?
I am trying to use some classes of the "Laravel structure" in other files, but I am not succeeding. For example: I created a file public/teste.php with the following code: require…
laravelasked 8 years, 6 months ago AndersonSouza 339 -
4
votes1
answer7065
viewsLEFT JOIN com AND no Eloquent Laravel 5
I have a query with Left Join with AND I’m not able to implement it in Laravel 5. A snippet of the query: LEFT JOIN visitante v ON a.codigo = v.id AND v.data BETWEEN '2015-06-01' and '2016-05-31'…
-
4
votes1
answer954
viewsConnection Progress database by PHP (Laravel framework), PDO
I need to connect to a Progress database via php I am using the framework Laravel 5.2 however the same according to the documentation only has support for Mysql, Postgres, Sqlite and SQL Server…
-
4
votes1
answer674
viewsInstall Laravel Site on Windows Server
I’ve never had this experience of putting a website on the air using Windows Server 2012 at Locaweb. I put the site in a folder called 'new site'. And when I run the site like this: HTTP Error 500.0…
-
4
votes2
answers592
viewsVirtual hosts configuration in Vagrant Homestead/Laravel
I’m starting to Laravel and would like to organize my development environment using some "hosts" for my projects. I created the first Larable and after suffering a little with its installation, it…
-
4
votes2
answers2598
viewsHow to Insert Taking Data from FORM in Laravel 5.2?
I’m looking at the Laravel documentation on dbquery, in the Insert case. I need to do Insert outside of the Resource method (manually. Type: DB::table('users')->insert( ['email' =>…
-
4
votes1
answer1453
viewsDoubt in the method of using Distinct and Count together!
I have a requested table as the example below: Id | Cliente | Status 1 | XPTO | Proposta 2 | ABCD | Proposta 3 | XPTO | Venceu 4 | XPTO | Perdeu And I want to present a result like this: Cliente |…
-
4
votes2
answers249
viewsWhat’s the difference between Http Requests and Request App
What difference in Laravel, to use use App\Http\Requests for use Request?
-
4
votes2
answers2123
viewsLaravel checkbox checked or not checked according to Database
I need some help on Laravel on how to "check checkboxes" on a form. I have a table colors, today with 12 different colors but can be as many as I want. And a table corproduto. The colors.id =…
-
4
votes1
answer1650
viewsSearch for relationship whereHas Laravel?
I have a Query in my Criteria that returns the id belonging to the relationship amid models if ($this->request->has('notin_portal')) { $portal = $this->request->get('notin_portal'); if…