Download the PHP package trinityrank/tailing-slash without Composer
On this page you can find all versions of the php package trinityrank/tailing-slash. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download trinityrank/tailing-slash
More information about trinityrank/tailing-slash
Files in trinityrank/tailing-slash
Package tailing-slash
Short Description TailingSlash adds '/' at the end of urls
License MIT
Homepage https://github.com/trinity-rank/tailing-slash
Informations about the package tailing-slash
Very short description of the package
Adds URL formatting and redirection with trailing slash to Laravel framework.
Installation
Step 1: Install package
To get started with Laravel Trailing Slash, use Composer command to add the package to your composer.json project's dependencies:
Step 2: Service Provider
After installing the package, register Trinityrank\TailingSlash\RoutingServiceProvider
in your config/app.php
.
Step 3: Routes
Usage
Whenever you use some Laravel redirect function, tailing slash ("/") will be applied to the end of url.
Notice
There is a problem with overriding Laravel Paginator
and LengthAwarePaginator
classes. So, every time you use paginate()
method on your models, query builders etc., you must set current path for pagination links. Example:
Pagiantion
-
Use this method to format pagination links on your blade component (tailwind.blade.php) and also use this for canonical links (check your
cleanCanonicalURL
inBaseController
) - On your 'web.php' add page route for pagination. Use same
controller
and samemethod
as you will use for normal archive page (justpath
is changed) -
ADD ABOVE THE REGILAR METHOD (not below)
-
In controller just add couple of thinks things
- use
UrlGenerator
on top of the document - In method add new optional param
$pageNumber
- Add
UrlGenerator::paginationCheck
method at the beginning of the method
- use
- Method
paginationCheck
has second optional paramether if default paginate keyword is notpage