Chron
5 months ago

Controlling a route based on the user's input

Posted 5 months ago by Chron

What I want is abort page if the user's input didn't met the requirements. If it met the requirements, the page will only be available until the user's input date don't met the conditions anymore.

Maybe having a Route like this...

if(now() <= $startDate){
    Route::resource('/private','PrivateController');
}

Route::fallback(function(){
    return 'Page not available';
});

And a method inside Controller like this...

public function privateAccess(Request $request){
    $startDate => $request['start_date'];
    return $startDate;
}

I know my code is off, but I hope you understand what I'm trying to say here.

Please sign in or create an account to participate in this conversation.