Thursday, 9 March 2023

laravel RouteServiceprovider redirect() not working

RouteServiceProvider.php 



public function boot()
    {
       $str= request()->getRequestUri();
       if(str_contains($str, '/index.php'))
       {
           header("Location: https://www.example.com/");
           exit();
       }
       if(str_contains($str, '/public/'))
       {
           header("Location: https://www.example.com/");
           exit();
       }
   
        parent::boot();
    }

No comments:

Post a Comment

Laravel Export data to csv

 use Illuminate\Http\Response; // Define a function to export data to CSV function exportToCSV($exportData, $columns) {     $filename = ...