Hitendra
Hitendra

Reputation: 3226

How to get 'GET' param in controller in laravel?

I am trying pass param in url but not able to get it in controller class.

.vue class
let url = "/getslots/{$day}";

routing file(web.php)

Route::get('/getslots/{day}', 'SlotController@getDay');

Controller class

  public function getDay($day){
    var_dump("Day: ".$day);
  }

I am not able to get the value in $day variable. Can anybody please help me to find the issue?

Upvotes: 0

Views: 377

Answers (1)

CaShiS
CaShiS

Reputation: 235

    Route::get('user/{id}', function ($id) {
        return 'User '.$id;
    });

Here you have example how to get GET parameter from url. There is documentation about. Create url using concatenation of string create url /getslots/ + this.day

Upvotes: 1

Related Questions