Search code examples
phplaravel-5laravel-5.3

How to fetch id in blade template in laravel 5.3


I want to fetch this id 9 in blade http://localhost/connect/public/index.php/profile/9 i dont want to route it


Solution

  • in your profilecontroller your method is like this

    public function profile($profile){
      // you can call model function and get data from profile id 
     //and then pass it to the view
    $data["profile_info"] = "fetch the data from database call your model function "; 
     return View("your_bladefilename",$data);
    
    }
    

    you can access profile_info in your blade file using profile_info variable

    in your blade file

    <?php 
    
        print_r($profile_info);
    
    ?>
    

    Let me know if anything is not clear