PHP code example of trinityrank / tailing-slash

1. Go to this page and download the library: Download trinityrank/tailing-slash library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

trinityrank / tailing-slash example snippets


    'providers' => [
        /*
        * Package Service Providers...
        */
        // ...
        Trinityrank\TailingSlash\RoutingServiceProvider::class
        // ...
    ],
    'aliases' => [
        // ...
        'UrlGenerator' => Trinityrank\TailingSlash\UrlGenerator::class,
        // ...
    ].

    Route::get('/', function () {
        return view('welcome');
    });

    Route::get('about-us/', function () {
        return view('about');
    });

    return redirect('about/');

    return back()->withInput();

    return redirect()->route('post', ['id' => 1]);

    return redirect()->action('IndexController@about');

    $posts = Text::where('is_active', 1)->paginate();
    $posts->setPath(URL::current());

    $posts->links();

    UrlGenerator::paginationLinks($url)

    // Paginate emethod
    Route::get('{slug}/page/{page}', [FrontendController::class, 'resolve'])->name('resolve');
    // Your regulat method
    Route::get('{slug}', [FrontendController::class, 'resolve'])->name('resolve');

        use Trinityrank\TailingSlash\UrlGenerator;
        // ...
        public function method($slug, $pageNumber = null){
            // This add at the beginning of the method
            UrlGenerator::paginationCheck($pageNumber);
            // ...
        }