title: Passing id through an link href in Laravel and geting the values in another view
body: <p>I want pass the project id (pid from the list) from the listProjectsView and display in detailedView page. But getting error message Page could not be found for detailedView page and undefined variable for listProjects. Can someone assist me in it</p>
  
  <p>This is my listProjects.blade.php file</p>
  
  <pre><code>@foreach($data as $row)
  &lt;div class="panel panel-default event"&gt;
  &lt;div class="panel-body"&gt;
  &lt;div class="rsvp col-xs-2 col-sm-2"&gt;
    &lt;div class="profile-image"&gt;
          &lt;img src="http://api.randomuser.me/portraits/med/men/71.jpg"/&gt;
      &lt;/div&gt;
    &lt;div class="hidden-xs"&gt;
      &lt;span class="fa fa-thumbs-up fa-2x"&gt;&lt;/span&gt;
      &lt;span class="fa fa-thumbs-down fa-2x"&gt;&lt;/span&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="info col-xs-9 col-sm-8"&gt;
    {{$row-&gt;ptitle}}
   &lt;div&gt;
    {{$row-&gt;pdescription}}
  &lt;/div&gt;
      &lt;div class="profile hidden-xs"&gt;
          Project Start date - {{$row-&gt;psdate}}
  
      &lt;/div&gt;
      &lt;div class="links hidden-sm"&gt;
         &lt;a href="{{ url('projects/detailedProject/'. $projects-&gt;pid )}}"&gt;&lt;i class="glyphicon glyphicon-chevron-right col-xs-3"&gt;&lt;/i&gt;&lt;/a&gt;
     &lt;/div&gt; 
  &lt;/div&gt;
  &lt;div class="author col-xs-1 col-sm-2"&gt;
      &lt;div class="profile-image"&gt;
          &lt;img src="http://api.randomuser.me/portraits/med/men/71.jpg"/&gt;
      &lt;/div&gt;
      &lt;div class="profile hidden-xs"&gt;
          &lt;li&gt;Project Start date &lt;br&gt; {{$row-&gt;psdate}}&lt;/li&gt;
      &lt;/div&gt;
  
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;  
  @endforeach
  </code></pre>
  
  <p>This is my detailevView.blade.php file</p>
  
  <pre><code>@foreach($data as $row)   
  &lt;ul&gt;
  &lt;h2&gt;Project Details&lt;/h2&gt;
  &lt;div class="row"&gt;
  &lt;div class="col-lg-3 col-md-3 col-sm-3"&gt;
  &lt;label&gt;Project Title &lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="col-lg-9 col-md-9 col-sm-9"&gt;
  &lt;label&gt; {{$row-&gt;ptitle}}&lt;/label&gt;
  &lt;/div&gt;
  &lt;/div&gt;  
  
  &lt;div class="row"&gt;
  &lt;div class="col-lg-3 col-md-3 col-sm-3"&gt;
  &lt;label&gt;Project Description&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="col-lg-9 col-md-9 col-sm-9"&gt;
  &lt;label&gt; {{$row-&gt;pdescription}}&lt;/label&gt;
  &lt;/div&gt;
  &lt;/div&gt;  
  
  &lt;div class="row"&gt;
  &lt;div class="col-lg-3 col-md-3 col-sm-3"&gt;
  &lt;label&gt;Project Duration&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="col-lg-9 col-md-9 col-sm-9"&gt;
  &lt;label&gt; {{$row-&gt;pduration}}&lt;/label&gt;
  &lt;/div&gt;
  &lt;/div&gt; 
  
  &lt;div class="row"&gt;
  &lt;div class="col-lg-3 col-md-3 col-sm-3"&gt;
  &lt;label&gt;Project Start Date&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="col-lg-9 col-md-9 col-sm-9"&gt;
  &lt;label&gt; {{$row-&gt;psdate}}&lt;/label&gt;
  &lt;/div&gt;
  &lt;/div&gt; 
  
  &lt;div class="row"&gt;
  &lt;div class="col-lg-3 col-md-3 col-sm-3"&gt;
  &lt;label&gt;Project End Date&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="col-lg-9 col-md-9 col-sm-9"&gt;
  &lt;label&gt; {{$row-&gt;pedate}}&lt;/label&gt;
  &lt;/div&gt;
  &lt;/div&gt; 
  
  &lt;div class="row"&gt;
  &lt;div class="col-lg-3 col-md-3 col-sm-3"&gt;
  &lt;label&gt;Project Category&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="col-lg-9 col-md-9 col-sm-9"&gt;
  &lt;label&gt; {{$row-&gt;pcategory}} &lt;/label&gt;
  &lt;/div&gt;
  &lt;/div&gt; 
  &lt;/ul&gt;
  @endforeach
  </code></pre>
  
  <p>My ProjectController</p>
  
  <pre><code>class ProjectController extends Controller
  {
  public function getCreateProject()
  {
      return view ('projects.createProject');
  }
  
  public function postCreateProject(Request $request)
  {
      $this-&gt;validate($request, [
          'ptitle' =&gt; 'required|max:200',
          'pdescription' =&gt; 'required',
          'etitle' =&gt; 'required|max:200',
          'edetails' =&gt; 'required',
          'dtotal' =&gt; 'required',
          'oposition' =&gt; 'required|max:100',
          'odescription' =&gt; 'required',
      ]);
  
  
      $project = Project::create( $request-&gt;only(['ptitle', 'pdescription', 'pduration', 'psdate', 'pedate', 'pcategory', 'pimage']));
  
  
      $project-&gt;events()-&gt;create($request-&gt;only(['etitle', 'edetails', 'edate', 'etime', 'elocation', 'eimage']));
  
  
      $project-&gt;donations()-&gt;create($request-&gt;only(['dtotal', 'dinhand', 'dbankaccount']));
  
  
      $project-&gt;opportunities()-&gt;create($request-&gt;only(['oposition', 'odescription', 'olocation', 'odeadline']));
  
  
      return redirect()
          -&gt;route('home', $project-&gt;pid)
          -&gt;with('info', 'Your project has been created.');
  }
  
  
  public function getListProjects()
  {
      $data=Project::all();
      return view('projects.listProjects')-&gt;withProject($data);
  }
  
  public function postListProjects()
  {
      dd('Hi there');
  }
  
  public function getDetailedProject()
  {
      $data = Project::find($id);
      return view('projects/detailedView')-&gt;withProject($data);
  }
  }
  </code></pre>
  
  <p>The route file</p>
  
  <pre><code>/* List all the projects */
  Route::get('/listProjects', [
  'uses'=&gt; '\Ngovol\Http\Controllers\ProjectController@getListProjects',
  'as' =&gt; 'projects.listProjects', 
  ]);
  
  Route::get('/projects/detailedProject/{pid}', 'ProjectController@getDetailedProject');
  </code></pre>