Questions tagged [laravel-4]

Laravel 4.2 is the previous version of the open-source PHP web development MVC framework created by Taylor Otwell. Laravel helps you create applications using simple, expressive syntax.

Laravel 4.2 is the previous version of the open-source for web development created by Taylor Otwell. Laravel helps you create applications using simple, expressive syntax.

New Features Overview

  • All pieces have been decoupled into independent components, collectively called Illuminate
  • integration
  • Driver-based view system
  • Better integration with cloud storage
  • collections

Resources

See also the tag for general laravel based questions, from past versions.

Social Media

14441 questions
5
votes
1 answer

Set One Custom message for multiple field in laravel form validation

Let I have 3 fields in the form. I write this code for form validation. $rules = array( 'field_1' => 'required', 'field_2' => 'required', 'field_3' => 'required', ); $messages = array( …
Nur Uddin
  • 2,778
  • 6
  • 16
  • 22
5
votes
2 answers

Laravel many to many loading related models with count

I am trying to link 4 tables and also add a custom field calculated by counting the ids of some related tables using laravel. I have this in SQL which does what I want, but I think it can be made more efficient: DB::select('SELECT …
Ego_I
  • 350
  • 3
  • 14
5
votes
2 answers

Composer update not installing the entirety of Laravel app

On deploying my application through Laravel Forge, I'm presented with the following errors: Fatal error: Class 'Illuminate\Support\Arr' not found in /home/forge/toono.co/vendor/laravel/framework/src/Illuminate/Support/helpers.php on line 151 This…
user860511
5
votes
1 answer

Environment variables and artisan not working on production server

I am using Github to deploy my sites to my production server. Because of this I don't want to be storing .env.*.php files everything so they're in my .gitignore. Within each environment directory I've set the database config to use getenv(), for…
Karl
  • 5,435
  • 11
  • 44
  • 70
5
votes
0 answers

Pagination doesn't work when there is orderByRaw

thanks for reading. I have a method that take data from a table, with an orderByRaw sentence. Everything is ok unless when I want to do a pagination, which without the orderByRaw works perfectly. I've seen here a solution:…
user3592436
  • 461
  • 2
  • 4
  • 13
5
votes
1 answer

Composer not downloading src directory for packages

I'm using Laravel and Composer to build a web app. On my local machine I have its requirements setup within the composer.json file and everything works as it should. I'm using Github to push to the production server, however, I then run composer…
Karl
  • 5,435
  • 11
  • 44
  • 70
5
votes
3 answers

How to pass variables by reference to @include in a blade template?

In a Laravel 4.2 setup, I have a variable in a template that I wish to share across multiple includes: master.blade {{--This is the variable--}} @include('header'){{-- <-in header.blade, I often use ++$tabindex…
skovacs1
  • 461
  • 1
  • 6
  • 14
5
votes
2 answers

Set Mandrill Template Laravel

I'm trying to send a Mandrill email in the default Laravel 4 Mailer, and I want to set the template and send the data to Mandrill. I'd rather not use a local file in my Laravel, I have this all set up to work inside of Mandrill. This is how I have…
Tommy Nicholas
  • 1,133
  • 5
  • 20
  • 31
5
votes
2 answers

Laravel doesn't read HTTP request payload for PUT request

So I am stumbling a bit here, as I have figured out that PHP will not read the HTTP request body from a PUT request. And when the Content-Type header in the request is set to application/json, there doesn't seem to be any way to get the body. I am…
Ronni Egeriis Persson
  • 2,209
  • 1
  • 21
  • 43
5
votes
1 answer

unittest laravel caching issue

I am using laravel 4 and created a class under its own namespace. Within this class there's a method that retrieves data and caches it. I also wrote a very small unit test to check if caching works. For some reason, caching does not work when unit…
Problem Solver
  • 385
  • 1
  • 4
  • 11
5
votes
1 answer

Laravel and google maps : foreach latitude/longitude show marker or map

I have a table locations with a latitude and longitude field. For each location I want a new map (or better a new marker) that uses the latitude and longitude from the table locations to display a city on the map. index action of controller…
Gilko
  • 2,280
  • 8
  • 36
  • 45
5
votes
1 answer

Different Composer packages with same namespace

Introduction I'm using Laravel 4 and have two composer packages with the same namespace, autoloaded with PSR-0. The simplified schematics of the composer.json files are as follows. Laravel app composer.json { "require": { …
pasadinhas
  • 353
  • 2
  • 6
  • 22
5
votes
4 answers

Laravel migrations messed up

I meesed up my Laravel migrations and I get PHP Fatal error: Cannot redeclare Class when running php artisan migrate --path="workbench/fefe/feeds2go/src/migrations" I have been deleting the migration file and dropping manually the table and…
fefe
  • 8,755
  • 27
  • 104
  • 180
5
votes
2 answers

How should I be serving binary files (images / audio) from a RESTful api written in PHP?

I am planning a RESTful API and I am wondering the best way to serve files / bundles of files across the api. I may be missing something, but as I see it my options are: Base64_encode the files and serve within the JSON response Provide links to…
Mark Kendall
  • 129
  • 2
  • 10
5
votes
6 answers

Session not working in Laravel 4

I have a problem with Session that won't persist. In controller I have a function that loads a article for editing public function getEdit($id) { try { $news = News::findOrFail($id); View::share('title',…
Vuk Stanković
  • 7,864
  • 10
  • 41
  • 65