2017-10-06 201 views
0

我有一个页面,显示许多产品和每个人都有一个链接以查看其详细信息, 这是导致该链接的代码:将值传递给控制器​​

<a class="btn-danger" href="{{ url('viewpartydetails/'.$party->party_id) }}"> 
        view details 
       </a> 

,这是路线:Route::get('viewpartydetails/{party_id}','[email protected]');

,这是在控制器代码:

public function partydetails($party_id) 
    { 
     if(!Auth::guest()) 
     { // $party_id=request('partyid'); 
      $party = DB::table('party1')->where('party_id',$party_id)->get(); 
      //dd($party_id); 
      return view('partydetails',compact('party')); 
     } 
     else 
      return redirect()->guest('login'); 

    } 

的问题是,我想表明的是没有出现任何的页面设计! 但是当我删除这部分“/ {party_id}”所有设计都再次出现! 有什么问题? 这是视图页面:

@extends('layouts.app') 

@section('content') 
    <div id="fh5co-main"> 
     <div class="fh5co-narrow-content"> 
      <div class="row"> 
       <div class="col-md-5"> 
        <h2 class="fh5co-heading animate-box" data-animate-effect="fadeInLeft">About Us Nitro <span>A Web Studio</span></h2> 
        <p class="fh5co-lead animate-box" data-animate-effect="fadeInLeft">Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean.</p> 
        <p class="animate-box" data-animate-effect="fadeInLeft"> Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar.</p> 
       </div> 
       <div class="col-md-6 col-md-push-1 animate-box" data-animate-effect="fadeInLeft"> 
        <img src="images/img_1.jpg" alt="Free HTML5 Bootstrap Template" class="img-responsive"> 
       </div> 
      </div> 

     </div> 
    </div> 
@stop 

app.blade代码:

<!DOCTYPE html> 
<html lang="{{ app()->getLocale() }}"> 
<head> 
    <meta charset="utf-8"> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 

    <!-- CSRF Token --> 
    <meta name="csrf-token" content="{{ csrf_token() }}"> 

    <title>{{ config('app.name', 'Laravel') }}</title> 

    <!-- Styles --> 
    <link href="{{ asset('css/app.css') }}" rel="stylesheet"> 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"> 
    <!-- #Dışarıdan Çağırılan Dosyalar Font we Materyal İkonlar Bitiş --> 

    <link rel="stylesheet" type="text/css" href="css/style1.css"> 
    <link rel="shortcut icon" href="favicon.ico"> 

    <link href='https://fonts.googleapis.com/css?family=Roboto:400,300,600,400italic,700' rel='stylesheet' type='text/css'> 


    <!-- Animate.css --> 
    <link rel="stylesheet" href="css/animate.css"> 
    <!-- Icomoon Icon Fonts--> 
    <link rel="stylesheet" href="css/icomoon.css"> 
    <!-- Bootstrap --> 
    <link rel="stylesheet" href="css/bootstrap.css"> 
    <!-- Owl Carousel --> 
    <link rel="stylesheet" href="css/owl.carousel.min.css"> 
    <link rel="stylesheet" href="css/owl.theme.default.min.css"> 
    <!-- Theme style --> 
    <link rel="stylesheet" href="css/style.css"> 

    <!-- Modernizr JS --> 
    <script src="js/modernizr-2.6.2.min.js"></script> 
</head> 
<body background="images/party1.jpeg"> 

    <div id="app"> 

     <nav class="navbar navbar-default navbar-static-top"> 
      <div class="container"> 
       <div class="navbar-header"> 

        <!-- Collapsed Hamburger --> 
        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#app-navbar-collapse"> 
         <span class="sr-only">Toggle Navigation</span> 
         <span class="icon-bar"></span> 
         <span class="icon-bar"></span> 
         <span class="icon-bar"></span> 
        </button> 

        <!-- Branding Image --> 
        <a class="navbar-brand" href="{{ url('/') }}"> 
         {{ config('app.name', 'Laravel') }} 
        </a> 
       </div> 

       <div class="collapse navbar-collapse" id="app-navbar-collapse"> 
        <!-- Left Side Of Navbar --> 
        <ul class="nav navbar-nav"> 
         &nbsp; 
        </ul> 

        <!-- Right Side Of Navbar --> 
        <ul class="nav navbar-nav navbar-right"> 
         <!-- Authentication Links --> 
         @if (Auth::guest()) 
          <li><a href="{{ route('login') }}">Login</a></li> 
          <li><a href="{{ route('register') }}">Register</a></li> 
         @else 
          <li class="dropdown"> 
           <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> 
            {{ Auth::user()->name }} <span class="caret"></span> 
           </a> 

           <ul class="dropdown-menu" role="menu"> 
            <li> 
             <a href="{{ route('logout') }}" 
              onclick="event.preventDefault(); 
                document.getElementById('logout-form').submit();"> 
              Logout 
             </a> 

             <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;"> 
              {{ csrf_field() }} 
             </form> 
            </li> 
            <li> 
             <a href="{{ url('viewparties') }}"> 
              view parties 
             </a> 

            </li> 
            @if(Auth::user()->user_type=="organizer") 
            <li> 
             <a href="{{ url('add_party') }}"> 
              add a party 
             </a> 
            </li> 
            @endif 
           </ul> 
          </li> 
         @endif 
        </ul> 
       </div> 
      </div> 
     </nav> 

     @yield('content') 

    </div> 

    <!-- Scripts --> 
    <script src="{{ asset('js/app.js') }}"></script> 
    <script src="js/jquery.min.js"></script> 
    <!-- jQuery Easing --> 
    <script src="js/jquery.easing.1.3.js"></script> 
    <!-- Bootstrap --> 

    <!-- Carousel --> 
    <script src="js/owl.carousel.min.js"></script> 
    <!-- Stellar --> 
    <script src="js/jquery.stellar.min.js"></script> 
    <!-- Waypoints --> 
    <script src="js/jquery.waypoints.min.js"></script> 
    <!-- Counters --> 
    <script src="js/jquery.countTo.js"></script> 


    <!-- MAIN JS --> 
    <script src="js/main.js"></script> 
</body> 
</html> 
+0

你可以显示你的看法? –

+0

@BenjaminBrasseur done –

+0

我认为这个问题来自你的'layouts/app.blade.php'。你能表示出来吗? –

回答

1

的问题是从你的未来型动物的CSS链接标签。

其实你有:

<link rel="stylesheet" type="text/css" href="css/style1.css"> 
<link rel="shortcut icon" href="favicon.ico"> 

<link href='https://fonts.googleapis.com/css?family=Roboto:400,300,600,400italic,700' rel='stylesheet' type='text/css'> 

<!-- Animate.css --> 
<link rel="stylesheet" href="css/animate.css"> 
<!-- Icomoon Icon Fonts--> 
<link rel="stylesheet" href="css/icomoon.css"> 
<!-- Bootstrap --> 
<link rel="stylesheet" href="css/bootstrap.css"> 
<!-- Owl Carousel --> 
<link rel="stylesheet" href="css/owl.carousel.min.css"> 
<link rel="stylesheet" href="css/owl.theme.default.min.css"> 
<!-- Theme style --> 
<link rel="stylesheet" href="css/style.css"> 

<!-- Modernizr JS --> 
<script src="js/modernizr-2.6.2.min.js"></script> 

然后,当你使用/{party_id}路线,您的浏览器试图找到的 localhost/{party_id}/css/style.css代替localhost/css/style.css

的解决方案是使用asset()就像你可以看到您的顶部布局视图<link href="{{ asset('css/app.css') }}" rel="stylesheet">

所以它应该是一些这样的事情:

<link rel="stylesheet" type="text/css" href="{{ asset('css/style1.css') }}"> 
<link rel="shortcut icon" href="{{ asset('favicon.ico') }}"> 

<link href='https://fonts.googleapis.com/css?family=Roboto:400,300,600,400italic,700' rel='stylesheet' type='text/css'> 


<!-- Animate.css --> 
<link rel="stylesheet" href="{{ asset('css/animate.css') }}"> 
<!-- Icomoon Icon Fonts--> 
<link rel="stylesheet" href="{{ asset('css/icomoon.css') }}"> 
<!-- Bootstrap --> 
<link rel="stylesheet" href="{{ asset('css/bootstrap.css') }}"> 
<!-- Owl Carousel --> 
<link rel="stylesheet" href="{{ asset('css/owl.carousel.min.css') }}"> 
<link rel="stylesheet" href="{{ asset('css/owl.theme.default.min.css') }}"> 
<!-- Theme style --> 
<link rel="stylesheet" href="{{ asset('css/style.css') }}"> 

<!-- Modernizr JS --> 
<script src="{{ asset('js/modernizr-2.6.2.min.js') }}"></script> 
+0

非常感谢!!!! –