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
answer293
viewsWhat is the correct way to pass the view data to the model?
Using Laravel, what is the best way to pass data from view to model? For example, form data and etc... A while ago, I used Codeigniter and sent the data by ajax. In the case of Laravel, it would be…
-
1
votes1
answer106
viewsFailed to register a package created in Laravel 5.1
I am developing a package for Laravel 5.1 and I have identified a problem that I could not find the solution. Displays the following error: FatalErrorException in ProviderRepository.php line 146:…
-
1
votes0
answers97
viewsIn Laravel 4, how do I convert the Model output to XML?
In Laravel, how could I transform the following result below to an XML structure? $usuarios = Usuario::with('nivel')->where(['status' => 1])->get()->toArray(); // Resultado: [ 'usuarios'…
-
1
votes1
answer637
viewsEloquent Relationship of Laravel
I have 3 tables: -- tipos id nome -- usuarios id tipo_id nome email -- atividades id usuario_id descricao I’m using Eloquent to capture activity and activity user data: $results =…
-
1
votes1
answer2091
viewsPHP Artisan command does not work
There was a demand in the job where I had to take an Laravel 5 project from a client and start changing it. I had some problems at the time to put to run, but now it is going, except for the command…
-
1
votes1
answer1739
viewsHow to use "Sync" from Laravel 5.1?
I recently discovered a feature of eloquent called sync, I saw that he kind of compares the data passed with the data that’s in the database and deletes or inserts what’s different. I wanted to…
-
1
votes2
answers4863
viewsLaravel Eloquent pick only one field of a record
I’m new to the Laravel and I have a little problem $profile_id = Profile::where("customer_id",$data["customer_id"])->where('is_default', 1)->select('id')->first()->get(); from this…
-
1
votes1
answer1597
viewsActivate Laravel Maintenance Mode 5.1 No Artisan
I know there’s a command php artisan down to activate the maintenance mode, but I have my application hosted and do not know how to give this command. Would you have any other way to do this?…
-
1
votes1
answer136
viewsCall Laravel 4 method using Angularjs
I have the following heading structure at the angle: .when('/', { redirectTo: '/pages/signin' }) .when('/:page', { // we can enable ngAnimate and implement the fix here, but it's a bit laggy…
-
1
votes1
answer102
viewsProblems entering entire data into Sybase using Laravel
Hello, I’m having trouble inserting values into tables with entire data type columns using Laravel 5.1 and Sybase. Error 257 is listed when the exception is thrown. In the Sybase manuals it seems to…
php laravel laravel-eloquent laravel-5 sybaseasked 9 years, 2 months ago Ademir Mazer Jr - Nuno 2,258 -
1
votes3
answers566
viewsCall construction class
Actually, this way, is it very wrong? I’m not really understanding the typing: class FinanceiroController extends Controller { /** * @var ChamadosFinanceirosRepository */ private…
-
1
votes2
answers2281
viewsHow to list routes in Laravel (No Artisan)?
In the Laravel 4 i know how to list all routes through the command line. Just do php artisan routes. However, now, I have need to do this in the source code of my application. That is, I need to…
-
1
votes0
answers89
viewsLaravel 5 whereRaw returns error but the final query is executed correctly in postgres
You are returning the following error when running my query using whereRaw: SQLSTATE[42P18]: Indeterminate datatype: 7 ERROR: could not determine data type of Parameter $2. The code snippet…
-
1
votes1
answer609
viewsRelationship N:N in Laravel does not record object attributes
My tables have, briefly, the following structure: minutes: id | vigencia products: id | nome | descricao ata_produto: ata_id | produto_id | vlr_produto | qtd_produto The same product may have…
-
1
votes2
answers501
viewsSend data to sidebar.blade.php only
I need to build a menu using the registered categories. How can I do this without using a view? I have my layout.blade.php with a @include('sidebar') My consultation works on view…
-
1
votes3
answers93
viewsError "Class Swift_keycache_simplekeycacheinputstream does not exist"
I’m trying to email with Laravel 5.1, but I always get the message below. Reflectionexception in Dependencycontainer.php line 309: Class Swift_keycache_simplekeycacheinputstream does not exist My…
laravelasked 9 years, 1 month ago Pedro Soares 1,136 -
1
votes2
answers601
viewsIs there an Laravel Blade Statement Tag (instead of just printing)?
I was wondering if there’s any way to create expressions with Blade’s tags Laravel. I mean, the same way we use {{ $valor }} to be able to print something, it would be possible to use the Blade…
-
1
votes0
answers75
viewsIs It Possible to Make Two Authentications in the Same Laravel Project?
In Laravel we have the function Auth() that works with every part that an authentication needs. I am developing a project that will be logged in to the Front-End (for individual customer use) and…
laravelasked 8 years, 8 months ago Diego Souza 16,524 -
1
votes1
answer70
viewsCreate Fake Relationship/Relationship in Laravel model
I have a model for my post table, it looks like this: $post = Post::where('titulo_url', $titulo_url)->first(); //$post->id //$post->categoria_id //$post->titulo_url //$post->titulo…
-
1
votes1
answer943
viewsOrange Permissions 5 using Homestead
I’m using Laravel 5 with a Homestead box using Vagrant and virtualbox for this, as demonstrated in the framework documentation: http://laravel.com/docs/5.1/homestead#installation-and-setup the…
-
1
votes1
answer779
viewsHow to restrict access to user registration page?
Following people I am creating a project in Aravel 5.2 I used the auth classes of the Aravel itself. And I’d like to know how I can be setting up the same for that page /register is accessed only…
-
1
votes3
answers1452
viewsURL problem with Toolbar /
In Laravel it is very common to use friendly URL and also very easy to use. The system is already ready for this. However, I have a problem that so far has not mattered. And now I want to know why.…
-
1
votes1
answer1150
viewsColumn not found: 1054
My code returns this error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'postagens.id' in 'where clause' (SQL: select * from `postagens` where `postagens`.`id` = 1 limit 1) follow my code…
-
1
votes1
answer1057
viewsDelete Directory Image - Laravel 5.1
I have in my method the following code: try{ Tecnico::find($id_tecnico)->delete(); DB::commit(); return Redirect::back()->with('message', true); }catch (\Exception $e){ DB::rollback(); return…
-
1
votes1
answer122
viewsCondition To Run __Construct Function
I created a function __construct in the Controller.php of Laravel 5. And this function is obviously running even on the Login screen, on Auth. Is there any way I can put as a condition, run the…
-
1
votes1
answer686
viewsLaravel 5 authentication shows no errors
Good afternoon, I am using Laravel 5 to redo a system and on the login screen when authentication is not made the user is redirected to the form again but I can not return any error. Model User…
laravelasked 8 years, 11 months ago Matheus Ilário 361 -
1
votes3
answers1218
viewsHow does Laravel "guard" the routes?
In the Laravel, both in 4 and 5, we can use a class called Route in order to create certain routes. My curiosity is: how does the Laravel (or other frameworks) do to "know" which given route…
-
1
votes3
answers719
viewsSaving data with relationship (Onetomany) Lavarel 5.1
Good afternoon! I created an application in Laravel where I need to save the data of a particular product, it has a relationship one to n. I’d like to know the best way to do that. I’m trying the…
-
1
votes2
answers1972
viewsRoute does not execute controller method
Good afternoon. I have a problem with my php code developed in Laravel 4. I have a Javascript function that executes an action using $.post and if successful, calls another Javascript function, this…
-
1
votes1
answer183
viewsHow to return difference after running update on Laravel 4?
Can anyone tell me how to return only the changed fields and values in an update to the Standard? ex: a table containing a name field with value John, let’s assume that I change this field to John…
-
1
votes1
answer4611
viewsHow to add a Foreign key with Migration?
I’m learning now how to use the Migrationof Laravel. I managed to understand well the functioning, but still do not know how to add a foreign_key I have the following Migration:…
-
1
votes1
answer511
viewsSet name for a Foreign Key created from a Migration in Laravel
I am building an application using Laravel 5.1 and in my ER Diagram it is very deep and detailed (even with index nomenclature). I need to know how to create a Foreign Key using the Migration…
laravelasked 8 years, 10 months ago LeandroLuk 4,989 -
1
votes1
answer85
viewsLaravel 5.1 ERROR: Fatalerrorexception in Model.php line 852: Class 'App Vendor' not found
good afternoon! I am trying to relate two tables: Services and Suppliers, follow the templates created: Model Servico use Illuminate\Database\Eloquent\Model; class Servico extends Model { protected…
laravelasked 8 years, 9 months ago Junior Morais 27 -
1
votes1
answer368
viewsFill textfield with the description corresponding to the value selected in a combobox
I have in my view a select that receives data from functions and lists. <select id="id_mfuncao" name="id_mfuncao" class="form-control"> <option value=""><< selecione…
-
1
votes0
answers60
viewsError while Sending E-mail
How do I deal with that mistake ? This error is when I try to send an email via Localhost on Laravel. Online works. But I’m afraid that online error will happen too. I want to be able to handle;…
laravelasked 8 years, 5 months ago Diego Souza 16,524 -
1
votes2
answers860
viewsArray of unique values with foreach
I got the following foreach to pick up the id of the devices that were used in each sector: @foreach($relatorio->Empresa->SetorEmpresa as $setor) {{ $collection[] =…
-
1
votes1
answer211
viewsSorting the results of a query - Laravel 5.1
I currently have a code that receives data from registered companies and for each company it lists their reports as follows: @foreach($empresas as $empresa) // Recebe as empresas…
-
1
votes0
answers168
viewsHow to find out select without Where in one application
Guys I’m having a problem and I can’t identify at which point the Portable is doing a select without Where in a table with many records, someone can help me?
-
1
votes1
answer51
viewsBring Existing and Non-existent Records
I got the next thing: $consulta = Dealer::find(1); No Model # Serviços public function dealer_servicos(){ return $this->hasMany('App\DealerService', 'id_concessionaria'); } So if I do:…
-
1
votes1
answer660
viewsSave Relationships in Bank - Laravel 5.2
What is the correct way to save related data in Laravel 5.2? I have a small application where I need to register data of a company and its address. When trying to save the data I get the error:…
-
1
votes1
answer201
viewsHow to work with the $http service of Angularjs synchronously?
How to work with Angularjs $http service synchronously? In this case I’m using Angularjs + Laravel and 3 tables to save a questionnaire (where an evaluation has several questions, and each question…
-
1
votes0
answers57
viewsNumber of queries to check user in the Standard
I have a system of user authentication, where do I use the API sentinel in the Laravel 5.2. When I do the Check_user() in the middleware to see if the user is logged in and has access to the route,…
-
1
votes2
answers661
views(Laravel) method $.get can’t find route
Eae guys, all right? I would really like your help because I’ve been stuck in this problem for a couple of days and I couldn’t figure it out on my own. I have a multi-row table with a checkbox on…
-
1
votes1
answer56
viewsHow do I set up Laravel 4 to automatically detect which environment I’m in (production and development)?
In the Laravel 4, we have a configuration file on app/config/database.php. And in the folder app/config/local/database.php you have another file. The Laravel 4 has a mechanism to be able to detect…
-
1
votes1
answer5291
viewsLaravel Project Deploy by Git
I need to deploy an Laravel project installed on a dev pc on a Linux server. After downloading everything via Git, some folders are ignored by .gitignore. How do I run Composer to reinstall all…
-
1
votes2
answers842
viewsError: No supported Encrypter found. The Cipher and / or key length are invalid
Personal I am using Laravel 5.2 and went to perform an authentication, but when I run the command php artisan make:auth works perfectly, but in practice does not... When I click on login or Register…
-
1
votes1
answer1832
viewsHow to customize the Laravel 4 error page?
When an error occurs in Laravel 4, with the configuration of app.debug equal to false, the following page is returned: In that case, so much for mistakes 500 how much to 404, this page is displayed.…
-
1
votes1
answer166
viewsHow to escape a key/braces on Blade?
In Blade, the key (or key) characters are intended to add the purpose of printing the content. It is complicated to a echo. But I was wondering if I really needed to display a piece of content,…
-
1
votes4
answers1058
viewsGet the first 2 user names
Let’s say my selected user name is "Raylan Soares Campos", how do I display only the first two names? In the case "Raylan Soares". I’m using Laravel 5.2, I don’t know if you have any facilitator or…
-
1
votes2
answers332
viewsSave Date in UTC Brazil Table
I’m making an insert into a Mysql table that contains several date fields. I left in the default column created_at table the value current_timestamp. If I make one INSERT now, it is inserting:…