S
S
seredaes2016-06-11 11:32:28
Laravel
seredaes, 2016-06-11 11:32:28

What am I doing wrong with Lavarvel request?

1. Route
Route::get('/{lang?}', ['uses' => '[email protected]', 'as' => 'home']);
2. In the controller
use Illuminate\Support\Facades\Request;
public function Index(Request $request)
{
echo "lang = ".Request::input('lang');
}
As a result, an empty string is displayed. I guess that there is some kind of bug in the routing, but where exactly.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
seredaes, 2016-06-11
@seredaes

Question closed, it dawned on me that {lang?} is not a GET parameter!
As a result, corrected
public function Index($lang) {
echo $lang;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question