Questions tagged [laravel]

The Laravel framework is an open-sourced PHP web framework that allows developers to create dynamic and scalable web applications. The source code of Laravel is hosted on GitHub and released under the MIT license.

Laravel is an open-sourced MVC framework for PHP web development released under the MIT license. Laravel helps you create applications with expressive, elegant syntax. The current Laravel version is 10.x. For all Laravel releases, bug fixes are provided for 18 months, and security fixes are provided for two years. Major framework releases are released yearly, while minor and patch releases may be released weekly.

Feature Overview

  • Model–View–Controller (MVC) framework
  • Simple routing using Closures or Controllers
  • Views and templating
  • Built-in Blade templating engine
  • Driver-based session and cache handling
  • URL Routing Configuration
  • Database abstraction with query builder
  • Eloquent ORM
  • Error Handling
  • Redis framework integration and API
  • Reverse Routing
  • Inversion of control (IoC) container
  • Middleware
  • Authentication
  • Authorization
  • Database Migrations
  • PHPUnit Integration
  • Automatic Pagination
  • Bundles
  • Queue system
  • Events and Filters
  • Task Scheduling
  • Accessors and Mutators
  • Markdown Mailable
  • Monolog Logging Library
  • Notifications

Documentation

API Documentation

Packages

Useful Services

Other notable tags

Community

Podcast

Resources and Tutorials

Books

Laravel 4

Laravel was created, and development is led by Taylor Otwell


Official Logo:

enter image description here

208084 questions
825
votes
40 answers

How do I get the query builder to output its raw SQL query as a string?

Given the following code: DB::table('users')->get(); I want to get the raw SQL query string that the database query builder above will generate. In this example, it would be SELECT * FROM users. How do I do this?
meiryo
  • 11,157
  • 14
  • 47
  • 52
661
votes
17 answers

How can I remove a package from Laravel using PHP Composer?

What is the correct way to remove a package from Laravel using PHP Composer? So far I've tried: Remove declaration from file composer.json (in the "require" section) Remove any class aliases from file app.php Remove any references to the package…
igaster
  • 12,983
  • 6
  • 26
  • 27
600
votes
23 answers

How to create custom helper functions in Laravel

I would like to create helper functions to avoid repeating code between views in Laravel. For example: view.blade.php

Foo Formated text: {{ fooFormatText($text) }}

They're basically text formatting functions. How should I define globally…
Calebe Oliveira
  • 6,111
  • 3
  • 14
  • 7
584
votes
26 answers

How to Create Multiple Where Clause Query Using Laravel Eloquent?

I'm using the Laravel Eloquent query builder and I have a query where I want a WHERE clause on multiple conditions. It works, but it's not elegant. Example: $results = User::where('this', '=', 1) ->where('that', '=', 1) ->where('this_too',…
veksen
  • 6,863
  • 5
  • 20
  • 33
484
votes
28 answers

Rollback one specific migration in Laravel

I want to rollback only : Rolled back: 2015_05_15_195423_alter_table_web_directories I run php artisan migrate:rollback, 3 of my migration are rolling back. Rolled back: 2015_05_15_195423_alter_table_web_directories Rolled back:…
code-8
  • 54,650
  • 106
  • 352
  • 604
475
votes
20 answers

Laravel Add a new column to existing table in a migration

I can't figure out how to add a new column to my existing database table using the Laravel framework. I tried to edit the migration file using...
kim larsen
  • 5,111
  • 6
  • 19
  • 17
470
votes
18 answers

How to fix 'Unchecked runtime.lastError: The message port closed before a response was received' chrome issue?

I'm using VueJS and Laravel for my project. This issue started to show lately and it shows even in the old git branches. This error only shows in the Chrome browser.
3UMF
  • 5,162
  • 2
  • 15
  • 26
458
votes
22 answers

Laravel requires the Mcrypt PHP extension

I am trying to use the migrate function in Laravel 4 on OSX. However, I am getting the following error: Laravel requires the Mcrypt PHP extension. As far as I understand, it's already enabled (see the image below). What is wrong, and how can I fix…
Patrick Reck
  • 11,246
  • 11
  • 53
  • 86
442
votes
37 answers

PDOException SQLSTATE[HY000] [2002] No such file or directory

I believe that I've successfully deployed my (very basic) site to fortrabbit, but as soon as I connect to SSH to run some commands (such as php artisan migrate or php artisan db:seed) I get an error message: [PDOException] SQLSTATE[HY000] [2002] No…
Daniel Hollands
  • 6,281
  • 4
  • 24
  • 42
413
votes
22 answers

How to set up file permissions for Laravel?

I'm using Apache Web Server that has the owner set to _www:_www. I never know what is the best practice with file permissions, for example when I create new Laravel 5 project. Laravel 5 requires /storage folder to be writable. I found plenty of…
Robo Robok
  • 21,132
  • 17
  • 68
  • 126
413
votes
20 answers

Displaying HTML with Blade shows the HTML code

I have a string returned to one of my views, like this: $text = '

Lorem ipsum dolor

' I'm trying to display it with Blade: {{$text}} However, the output is a raw string instead of rendered HTML.…
lesssugar
  • 15,486
  • 18
  • 65
  • 115
410
votes
27 answers

No Application Encryption Key Has Been Specified

I'm trying to use the Artisan command like this: php artisan serve It displays: Laravel development server started: http://127.0.0.1:8000 However, it won't automatically launch and when I manually enter http://127.0.0.1:8000 it shows this…
Carlos F
  • 4,621
  • 3
  • 12
  • 19
407
votes
32 answers

Get the Last Inserted Id Using Laravel Eloquent

I'm currently using the below code to insert data in a table: nombre = $post['name']; $data->direccion = $post['address']; …
SoldierCorp
  • 7,610
  • 16
  • 60
  • 100
401
votes
33 answers

Laravel Checking If a Record Exists

I am new to Laravel. How do I find if a record exists? $user = User::where('email', '=', Input::get('email')); What can I do here to see if $user has a record?
Ben
  • 5,627
  • 9
  • 35
  • 49
400
votes
15 answers

Laravel Eloquent Query: Using WHERE with OR AND OR?

How do I say WHERE (a = 1 OR b =1 ) AND (c = 1 OR d = 1) For more complicated queries am I supposed to use raw SQL?
Farzher
  • 13,934
  • 21
  • 69
  • 100
1
2 3
99 100