Friday, April 13, 2018

Add row manually to eloquent result in Laravel 4.2 - development

Add row manually to eloquent result in Laravel 4.2

I am using Laravel 4.2 and i fetch all locations with this code:

$locations = Location::all();

This Locations are displayed in a select box afterwards. How can i add an additional row to the results in order to show an empty first option in the select box.

The options then should be:

  • choose a location
  • location 1
  • location 2

I just want to add an additional item to the result in $locations.

Thanks in advance



from Laravel Questions and Answers https://laravelquestions.com/laravel/add-row-manually-to-eloquent-result-in-laravel-4-2/
via Lzo Media

No comments:

Post a Comment