Sure. You can set a where()
route parameter filter or better do it in a separate before filter
.
Something like this :
Route::filter('valid-date', function($route, $request)
{
$date = $route->parameters();
$start_date = Carbon::createFromDate(2014, 1, 1);
$input_date = Carbon::createFromDate( $date['year'], $date['month'], $date['day'] );
// gte() -> 'greater than or equal to', method of Carbon package.
if( ! $input_date->gte( $start_date ) ) {
echo "Take action. Something like App::abort(404) ";
}
});
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community