【问题标题】:laravel show method doesn't have the stylelaravel show 方法没有样式
【发布时间】:2018-03-01 18:18:08
【问题描述】:

我是 laravel 的新手,我正在尝试在数据库上的类别表和设备表之间建立多对多关系 在类别视图中,我拥有所有类别,当我单击一个类别时,我希望转到另一个视图并显示该类别的所有设备 它适用于我在类别和 show 方法中使用 rsource 控制器:CatgoryController.php

 public function show($id)
{
    $categories = Category::find($id);
    $all_devices = $categories->devices;

    return view('devices',compact('categories',$categories,'all_devices',$all_devices));
}

在设备视图中我这样做: devices.blade.php

@extends('master')

@section('content')

<div class="container">
	<div class="row">
                <div class="col-lg-12 text-center animateup">
					<div class="inline-icons-text section-heading">
						<div class="inline-icon">
							<hr/><hr/><hr/><hr/><hr/>
						</div>
						<span class="inline-icon heading-width">
							<span class="heading-text"><h1> {{$categories->category_name}} </h1> </span>
						</span>
						<div class="inline-icon">
							<hr/><hr/><hr/><hr/><hr/>
						</div>
					</div>
                </div>
			</div>	

	<br/>
	<div class="row text-center">
				@foreach ($all_devices as $device)
				<div class="col-md-3 col-sm-6 animateleft">
					<h5>
						<a href="#">{{$device->device_name}}</a>
						<span class="glyphicon glyphicon-chevron-right"></span>
					 </h5>
				</div>
				@endforeach
			</div>
</div>

@stop

这是我显示所有类别的方式,当单击一个时,它会转到 anthor 视图以显示该类别的设备

categories.blade.php

			<div class="row text-center">
				@foreach ($categories as $categories)
				<div class="col-md-3 col-sm-6 animateleft">
					<h5>
						<a href="categories/{{$categories->id}}">{{$categories->category_name}}</a>
						<span class="glyphicon glyphicon-chevron-right"></span>
					 </h5>
				</div>
				@endforeach
			</div>

最后这是我的溃败Rout.php

Route::resource('categories','CategoryController');

Route::resource('/devices','DevicesController');

我的问题是所有东西都能正常工作,但拥有某一类别设备的页面却没有网站的风格

【问题讨论】:

  • 你能把categories.blade.php的所有内容都给我们看看吗?
  • @bayan 您如何将您的样式链接到您的应用程序中。?
  • 我认为它在 laravel Blade 中的样式经常出现问题。只是搜索它!有很多关于这个问题的页面。
  • @Amin 没有找到你能帮我吗!
  • 将您的样式文件移动到公共目录和:do this!

标签: php jquery html css laravel


【解决方案1】:

将您的样式移动到公用文件夹到任何子文件夹中..这里我使用设备作为子文件夹,devices.css 是我的文件.. 将这样的链接放在您的主刀片中。带有您的文件夹和文件名

<link rel="stylesheet" href="{{URL::to('/')}}/devices/devices.css">

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-10-27
    • 1970-01-01
    • 2018-07-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多