1
votes

I ran composer update on Laravel 4 just now. I was trying to fix an issue with Input::json(), which had stopped working right after a previous composer update. Now, path() returns an undefined function error.

Did Taylor change either of these? Does anyone know the replacements for them if he took them out?

1
I need Input::json to gather the data from a Backbone call. - sehummel
Url is the replacement for path. - sehummel
I had to cast Input::json as an array and then access it's properties like you would that of any array. I liked the old way better. - sehummel

1 Answers

6
votes

JSON input has now been merged into Input::all() so you can use the same interface for JSON as Form Data input. Alternatively, you can access just the JSON with Input::json()->all().

To generate URLs you now want the URL facade (see Illuminate\Routing\UrlGenerator)...

URL::to('some/url')
URL::action('MyController@action')
URL::route('my.route')

To generate paths on disk (see Illuminate\Support\helpers.php)...

app_path()      // Path to 'app'
base_path()     // Path to project root
public_path()   // Path to 'public'
storage_path()  // Path to 'app/storage'