Questions tagged [laravel-5]

Laravel 5 is a version of Laravel released between 2015 and 2020. Laravel is a an open-source PHP web development MVC framework created by Taylor Otwell which helps you create applications using simple, expressive syntax. Use the laravel tag for general Laravel related questions.

Laravel 5.0 was released on 4th February 2015, and Laravel 5.8 in 2019. Both Laravel 5.8 and Laravel 5.5 LTS received their last security patch in 2020.

Laravel 5 uses the latest components and techniques of Design patterns and 's components. Laravel uses Composer for managing dependencies. Laravel has its own optional templating engine called Blade.

Make sure you have the following minimum PHP version for each Laravel version.

5.0 requires >= 5.4

5.1 and 5.2 requires >= 5.5.9

5.3 and 5.4 requires >= 5.6.4

5.5 requires >= 7.0.0

5.6, 5.7, and 5.8 requires >= 7.1.3

Laravel Versions

5.8 - Changelog

5.7 - Changelog

5.6 - Changelog

5.5 LTS - Changelog

5.4 - Changelog

5.3 - Changelog

5.2 - Changelog

5.1 LTS - Changelog

5.0 - Changelog

Useful documentation

Pros

  1. It uses a blade template that is fast and maintains a cache
  2. Expressive syntax
  3. Reusability of code
  4. Laravel 5.5 is the latest LTS release; Laravel 5.1 was the first LTS release

Useful Tags

Other resources

43708 questions
113
votes
6 answers

Is there a default password to connect to vagrant when using `homestead ssh` for the first time?

I'm trying to connect to vagrant via homestead ssh: vagrant@127.0.0.1's password: But my public key password doesn't work. My Homestead.yaml looks like this: authorize: ~/.ssh/id_rsa.pub keys: - ~/.ssh/id_rsa I'm using "Laravel Homestead…
stefan
  • 4,958
  • 4
  • 20
  • 37
111
votes
12 answers

What is the best practice for adding constants in laravel? (Long List)

I am rather new to laravel. I have a basic question, What is the best way to add constants in laravel. I know the .env method that we use to add the constants. Also I have made one constants file to use them for my project. For…
Faran Khan
  • 1,495
  • 4
  • 14
  • 26
111
votes
6 answers

Manually register a user in Laravel

Is it possible to manually register a user (with artisan?) rather than via the auth registration page? I only need a handful of user accounts and wondered if there's a way to create these without having to set up the registration controllers and…
Matt Ellis
  • 1,303
  • 2
  • 9
  • 7
111
votes
6 answers

Laravel 5.2 - Use a String as a Custom Primary Key for Eloquent Table becomes 0

I am trying to use email as my table's primary key, so my eloquent code is-
Abrar Jahin
  • 13,970
  • 24
  • 112
  • 161
111
votes
9 answers

Eloquent ORM laravel 5 Get Array of ids

I'm using Eloquent ORM laravel 5.1, and I want to return an array of ids greater than 0, my model is called test. I have tried : $test=test::select('id')->where('id' ,'>' ,0)->get()->toarray(); It returns : Array ( [0] => Array ( [id] => 1 ) [1] =>…
paranoid
  • 6,799
  • 19
  • 49
  • 86
109
votes
23 answers

Extension gd is missing from your system - laravel composer Update

I newly install Dompdf in Laravel Project via Composer (composer require barryvdh/laravel-dompdf). After enter the Command Terminal Reply Following Errors. Problem 1 - dompdf/dompdf v0.7.0 requires ext-gd * -> the requested PHP extension gd is…
Karthik
  • 5,589
  • 18
  • 46
  • 78
108
votes
19 answers

How to force Laravel Project to use HTTPS for all routes?

I am working on a project that requires a secure connection. I can set the route, uri, asset to use 'https' via: Route::get('order/details/{id}', ['uses' => 'OrderController@details', 'as' => 'order.details', 'https']); url($language.'/index', [],…
Nelson Melecio
  • 1,334
  • 3
  • 12
  • 19
108
votes
14 answers

Get environment value in controller

In my .env file I have the following: IMAP_HOSTNAME_TEST=imap.gmail.com IMAP_USERNAME_TEST=myemail@gmail.com IMAP_PASSWORD_TEST=mypw Now I would like to use them in my controller. I've tried this, but without any result: $hostname =…
nielsv
  • 6,540
  • 35
  • 111
  • 215
107
votes
3 answers

How to set the default value of an attribute on a Laravel model

How to set the default value of an attribute on a Laravel model? Should I set the default when creating a migration or should I set it in the model class?
Zeeshan Bin Iqbal
  • 1,206
  • 2
  • 8
  • 8
107
votes
3 answers

When to generate a new Application Key in Laravel?

Since it automatically sets it for me in my .env file when I create the app, I'm not sure when I should run it. In addition to that, if a second developer comes in, and clones the app, does he/she need to run php artisan key:generate ? How do we…
code-8
  • 54,650
  • 106
  • 352
  • 604
103
votes
5 answers

Laravel Migration to change table name

I want to change my two table name in the Laravel, so do I have to manually change the table name or it can be possible through migration.
HKumar
  • 1,535
  • 3
  • 13
  • 28
103
votes
3 answers

Laravel Blade passing variable with string through @include causes error

In Laravel 5.0.27 I am including a view with with a variable and the following code: @include('layouts.article', [ 'mainTitle' => "404, page not found", 'mainContent' => "sorry, but the requested page does not exist :(" ]) and I…
joeyfb
  • 3,044
  • 3
  • 19
  • 25
101
votes
5 answers

Laravel - find by custom column or fail

There's findOrFail() method which throws 404 if nothing was found, e.g.: User::findOrFail(1); How can I find an entity by custom column or fail, something like this: Page::findBySlugOrFail('about');
Limon Monte
  • 52,539
  • 45
  • 182
  • 213
101
votes
9 answers

Laravel Request::all() Should Not Be Called Statically

In Laravel, I'm trying to call $input = Request::all(); on a store() method in my controller, but I'm getting the following error: Non-static method Illuminate\Http\Request::all() should not be called statically, assuming $this from incompatible…
Moose
  • 1,231
  • 4
  • 14
  • 22
100
votes
7 answers

Laravel check if collection is empty

I've got this in my Laravel webapp: @foreach($mentors as $mentor) @foreach($mentor->intern as $intern) {{…
Jamie
  • 10,302
  • 32
  • 103
  • 186