1

My url is like this : http://localhost/mysystem/public/users/index/2016

I want to get 2016, because I need it. But, I'm confused

Is there any people who can help me?

2 Answers 2

2

In your previous question I can see this method:

public function store(CreateUserRequest $request)

And your route should look like this (partially taken from previous answer too):

Route::get('users/store/{year}', 'UserController@store')->name('users.store.year');

Note, that if you'll build store method with Route::resource(), you'll not be able to pass year through URL.

So, to make it work you need to set route and to change method to this:

public function store(CreateUserRequest $request, $year)

$year variable will have 2016 value.

Sign up to request clarification or add additional context in comments.

Comments

0

To get 2016, you can use $year = Request::segment(3);.

1 Comment

There is exist error like this : Non-static method Illuminate\Http\Request::segment() should not be called statically

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.