Questions tagged [laravel-5.1]

Laravel 5.1 is a past version of the open-source PHP web framework. It has been released on 9th June 2015. Use it in addition to the laravel-5 tag if your question is specific to Laravel 5.1. Use the laravel tag for general laravel related questions.

Laravel 5.1 is a past version of Laravel 5. It has been released on 9th June 2015.

What is new:

  • LTS (Long Term Support)
  • PSR-2 compliance
  • Event broadcasting
  • Middleware parameters
  • Model factories
  • Overhauled testing with new helper traits and a new expressive fluent interface for integration tests
  • Blade service injection
  • Artisan improvements for simplified command signatures and advanced output forms
  • CSRF whitelisting
  • Laravel Envoy allows you to run local scripts without SSH
  • Laravel Elixir compiles ECMAScript 6 by default
  • Backwards-compatible folder structure changes
  • Completely overhauled documentation
  • 5.1.4: Authentication throttling
  • 5.1.11: ACL (Access Control List) authorization

Resources:

4610 questions
124
votes
14 answers

laravel 5 : Class 'input' not found

In my routes.php file I have : Route::get('/', function () { return view('login'); }); Route::get('/index', function(){ return view('index'); }); Route::get('/register', function(){ return…
Gammer
  • 5,453
  • 20
  • 78
  • 121
114
votes
15 answers

Get only records created today in laravel

How do I use the created_at field to get only the records that were created today and no other day or time? I was thinking of a ->where('created_at', '>=', Carbon::now()) But Im not sure that would work.
TheWebs
  • 12,470
  • 30
  • 107
  • 211
113
votes
5 answers

How to execute raw queries with Laravel 5.1?

So I have this tiny query to run on my DB and it works fine in MySQL Workbench. Basically, a SELECT with LEFT JOIN and UNION with LEFT JOIN again. SELECT cards.id_card, cards.hash_card, cards.`table`, users.name, 0 as total, …
Sandro Wiggers
  • 4,440
  • 3
  • 20
  • 25
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
96
votes
5 answers

Carbon Difference in Time between two Dates in hh:mm:ss format

I'm trying to figure out how I can take two date time strings that are stored in our database and convert it to a difference in time format of hh:mm:ss. I looked at diffForHumans, but that does give the format I'd like and returns things like after,…
mtpultz
  • 17,267
  • 22
  • 122
  • 201
90
votes
5 answers

Laravel 5 Application Key

I am new to Laravel. I just started it tonight. Actually, I have the following code: 'key' => env('APP_KEY', 'SomeRandomString'), In xampp/htdocs/laravel/blog/config/app.php. I want to change this key to 32-bit by cmd…
Raham
  • 4,781
  • 3
  • 24
  • 27
78
votes
6 answers

Create a Laravel Request object on the fly

I'm handling data in one controller and want to pass it further into another controller to avoid duplicate code. Is there a way to set up a Request object that is needed in the other controller's store-method? I've traced down the Request…
Ben Fransen
  • 10,884
  • 18
  • 76
  • 129
75
votes
4 answers

Convert String to Carbon

I am using Laravel 5.1 Few days ago I used protected $dates = ['license_expire'] in my model to convert the string date to Carbon instances. In HTML the default value in create form for the date was Carbon\Carbon::now()->format('Y-m-d') In order to…
smartrahat
  • 5,381
  • 6
  • 47
  • 68
75
votes
3 answers

disable csrf in laravel for specific route

I've a payment system, where data is submitted to 3rd party site and than hauled back... When data returns it hits specific url lets say /ok route. $_REQUEST['transaction']. But because of laravel middleware I'm getting token mismatch. There is no…
user796443
72
votes
5 answers

How to check if row is soft-deleted in Eloquent?

In Laravel 5.1 is there a nice way to check if an eloquent model object has been soft-deleted? I'm not talking about selecting data but once I have the object e.g. Thing::withTrashed()->find($id) So far the only way I can see is if…
DisgruntledGoat
  • 70,219
  • 68
  • 205
  • 290
68
votes
1 answer

Go back URL in Laravel 5.1

How can I get the previous URL visited on the website in Laravel 5.1? In Laravel 4 I just needed to write it like below: {{ URL::previous() }}
Linus Odenring
  • 851
  • 2
  • 8
  • 11
58
votes
6 answers

Fatal error while upgrading Laravel 5.1 to 5.2

I'm following the official upgrade guide from 5.1 to 5.2. First sub-section says: If you are installing a beta release of Laravel 5.2, add "minimum-stability": "beta" to your composer.json file. Update your composer.json file to point to…
lesssugar
  • 15,486
  • 18
  • 65
  • 115
58
votes
7 answers

How to capitalize first letter in Laravel Blade

I'm using laravel (5.1) blade template engine with the localization feature. There is a language file messages.php within the /resources/lang/en/ folder: return [ 'welcome' => 'welcome', In my blade template the welcome message is called using…
user947668
  • 2,548
  • 5
  • 36
  • 58
57
votes
5 answers

Laravel migration array type (store array in database column)

I want to store an array of integers in my table and I can't find any type that supports array in Documentation, any suggestion. Migration: public function up() { Schema::create('pickups', function (Blueprint $table) { …
Zakaria Acharki
  • 66,747
  • 15
  • 75
  • 101
55
votes
3 answers

Schema Builder : Create Table if not exists

I am using below code in Schema Builder to create table. Schema::create('tblCategory', function (Blueprint $table) { $table->increments('CategoryID'); $table->string('Category', 40); $table->unique('Category',…
Pankaj
  • 9,749
  • 32
  • 139
  • 283
1
2 3
99 100