In native PHP it takes about 2 minutes to link each product on the page to its product_details page
-- like gives each products an id from the database, and in the details page grab the id from the URL by $_GET and fetch the database info for the same id
Now I am stack doing the same thing in Laravel, can anyone give me hand here please
Here is my code
The route
Route::get('Current_projects', 'ProjectController@currentProjects');
Route::get('projects/projectDetails/{$id}', 'ProjectController@viewProject');
Here is my controller
class ProjectController extends BaseController
{
/**
* Display a listing of the resource.
*
* @return Response
*/
public function currentProjects()
{
$projects = Projects::all();
return View::make('projects.currentProjects', ['projects' => $projects]);
}
public function viewProject($id)
{
$projects = Projects::with('projectDetails')->findOrFail($id);
return View::make('projects.currentProjects.projectDetails', compact($projects));
}
}
Here is how I try to link
<a href="{{ URL::to("Current_projects/projectDetails/{$pro->id}") }}"
class="portfolio-link"
data-toggle="modal">
Now when I click on any product in the currentProjects
Got Error
Symfony Component HttpKernel Exception NotFoundHttpException
Open: C:wampwwwmyProvendorlaravelframeworksrcIlluminateRoutingRouteCollection.php
Aucun commentaire:
Enregistrer un commentaire