C
C
Cavin March2017-01-17 16:49:07
Laravel
Cavin March, 2017-01-17 16:49:07

How to make links like this 'user?im=sel-123' in laravel?

Hello. In general, the question is already in the title, I ask for your help, because I do not know how to solve this issue. Please do not offer links like 'user/im/sel-123'. Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Victor, 2017-01-17
@v_decadence

Что значит "сделать ссылки"?
Регайте роут:

Route::get("user", function(){
  $im = request()->input("im");
  // оперируете с im
})->name("user");

Получение ссылки:
route("user", ["im" => 123]);

S
Scronheim, 2017-01-18
@scronheim

Зачем делать это в роутах когда можно прописать в контроллере?

use Request; //не фасад
public function get (Request $request) {
    $im=$request->im;
    //something
}

А input в шаблоне обязательно назвать "im"
а в роуте Route::get('user', '[email protected]');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question