chinleung / laravel-multilingual-routes

A package to handle multilingual routes in your Laravel application.
https://github.com/chinleung/laravel-multilingual-routes-demo
MIT License
394 stars 26 forks source link

Allow passing data to view options #38

Closed chinleung closed 4 years ago

chinleung commented 4 years ago

In order to replicate:

Route::view('/welcome', 'welcome', ['name' => 'Taylor']);

We have either use a controller, or use the defaults method:

Route::multilingual('welcome')->defaults([
    'data' => ['name' => 'Taylor'],
]);

However, it'd be nice to be able to pass the view data directly using the data method:

Route::multilingual('welcome')->data([
    'name' => 'Taylor',
]);

Or passing the data along with the view method:

Route::multilingual('welcome')->view('hello', [
    'name' => 'Taylor',
]);
chinleung commented 4 years ago

This feature is available as of v2.5.0 and v1.8.0.