I\'m new to Laravel (only experienced Laravel 5, so no legacy hang up here)
I\'d like to know how to extend the core Request class. In addition to how to extend it,
Yerkes answer inspired me to write a custom class, for use with pagination, but only on specific requests
page() - 1) * $this->perPage();
}
}
I then also had to register a new ServiceProvider in /config/app.php, which looks like
app->resolving(PaginatedRequest::class, function ($request, $app) {
PaginatedRequest::createFrom($app['request'], $request);
});
}
}
Now I can simply inject the PaginatedRequest in my controller methods only when I need it
page();
// ...
}
}