php - laravel show 方法没有样式

标签 php jquery html css laravel

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

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

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

在设备 View 中我做的是: 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

这就是我显示所有类别的方式,当单击一个类别时,它会转到其他 View 以显示该类别的设备

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');

我的问题是一切正常,但具有某一类别设备的页面没有网站的样式

最佳答案

将你的 stylesto 公共(public)文件夹移动到任何子文件夹中..这里我使用设备作为子文件夹,devices.css 是我的文件.. 将这样的链接放在你的主 Blade 中。使用你的文件夹和文件名

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

关于php - laravel show 方法没有样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46326251/

相关文章:

javascript - HTML Selectbox 值 ajax 调用用于页面

php - 我可以对我选择的列进行 MD5 运算吗?

javascript - 在 JS 中使用 href : 'TypeError: c. 列表手动创建 Featherlight Gallery 的问题不是一个函数

javascript - 从邮政编码谷歌地理编码获取城市名称

html - 浏览器对 translate() 和绝对定位的解释不同

html - 在整个页面上拉伸(stretch)元素,无论缩放/ View 如何

php - 如何在 PHP 中将数组声明为全局数组?

php文件管理器数据库设计(mysql)

php-bcmath 错误 - 扩展未在 php7 中加载

javascript - 检查一个元素是否在 jquery 中有一个特定的类不起作用