lundi 15 août 2016

Routing did not work properly in laravel 5.1

I am currently doing a project called Doctor Management System.In this project I am stuck because my route did not work correctly.Whenevr I have to go on a specific id it gives me Gibberish id. My Route file is

Route::get('/district/hospital/hospital_info/{id}', array('as' =>'hospital_info' ,'uses' => 'UserController@hospital_info'));

My Controller is

    <?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Input;
use App\Division;
use App\District;
use App\Category;
use App\Dcategory;
use App\Hospital;
use App\Doctor;
class UserController extends Controller
{


        public function hospital_info($id)
        {
            $divisions = Division::all();
             $division=Division::find($id); 

             $district=District::find($id); 
             $category=Category::find($id);
             $hospital=Hospital::find($id);


            return view('users.hospital_info')
                        ->with('divisions',  $divisions)
                        ->with('division', $division)
                        ->with('district', $district)
                        ->with('category',$category)
                        ->with('hospital',$hospital);
        }

My view file is

<?php $active="hospital"; ?>
@extends('layouts.dashboard')
@section('content') 

    <section id="blog" class="container">
        <div class="center">
            <h2>Hospital Information</h2>
            <h3 class="lead">The government approved a renowned hospital and improved quality of service address , doctor , patient viewing time, bed , pathological tests in various subjects including costs and find the information here .<br> The bed and cabin bookings online , pathological tests , the doctor can be a serial for the meeting from the app .</h3>
        </div>

        <div class="blog">
            <div class="row">
                 <div class="col-md-12">
                    <div class="blog-item">
                        <div class="row">
                            @foreach($district->categories as $category)
                            @foreach($category->hospital as $hospital)  
                                <div class="col-xs-12 col-sm-4 blog-content">
                                </div>

                                    <div class="col-xs-12 col-sm-6 blog-content">
                                        <h2></h2>
                                        <h5>Address : </h5> 
                                        <h5>Ownership : </h5>
                                        <h5>Start of activities : </h5>
                                        <h5>Number of beds : </h5>
                                        <h5>Number of doctor : </h5>
                                        <h5>Phone No : </h5>
                                    </div>

                                <div class="col-xs-12 col-sm-2 blog-content">
                                    <h2><a href="#">Share</a></h2>
                                    <ul class="social-share">
                                            <li><a href="#"><i class="fa fa-google-plus"></i></a></li>
                                            <li><a href="#"><i class="fa fa-facebook"></i></a></li>
                                            <li><a href="#"><i class="fa fa-twitter"></i></a></li>
                                            <li><a href="#"><i class="fa fa-skype"></i></a></li>
                                        </ul>
                                        <br><br>

                                    <a class="btn btn-success readmore" href="{!! URL::route('doctor_list') !!}">Doctor List</a>
                                </div>
                                @endforeach 
                                @endforeach 
                            </div>

                    </div><!--/.blog-item-->\
                </div><!--/.col-md-8-->

            </div><!--/.row-->
        </div>
    </section><!--/#blog-->
@stop

The error is enter image description here

Here You can see I did not find the id. But If I staticly Give the id it shows the Info. I don't find where the problem is. Please help me solving this.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire