gpt4 book ai didi

php - laravel 5.6菜单表如何链接不同的页面部分

转载 作者:行者123 更新时间:2023-11-29 17:54:34 25 4
gpt4 key购买 nike

有人建议我创建一个菜单表架构,我可以链接到页面的不同部分,菜单表结构是:-

public function up()
{
Schema::create('menus', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->integer('parent');
$table->enum('type', ['section', 'static', 'article', 'url']);
$table->timestamps();
});
}

这些是其他表结构。

statics: id, title, image, content
sections: id, title, description
widgets: id, type[artcles, static, video, gallery], page[section to appear], ordering[smallint], articles[list, optional, video, gallery, code]
articles: id, title, image, content, section_id

我想要的是创建一个包含很多页面的网站,主页有不同的小部分,例如“关于我们”“我们做什么”“我们的服务”“我们的员工”等,当我点击“阅读更多”链接时这些部分转到该部分的特定页面。

我的问题是如何在该表的模型中建立关系以及我应该创建什么 View Blade 页面?我希望小部件既可以是静态的,也可以是动态的。

最佳答案

你的意思是这样的吗?

<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>

<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">WebSiteName</a>
</div>
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#">Page 1 <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Page 1-1</a></li>
<li><a href="#">Page 1-2</a></li>
<li><a href="#">Page 1-3</a></li>
</ul>
</li>
<li><a href="#">Page 2</a></li>
<li><a href="#">Page 3</a></li>
</ul>
</div>
</nav>

<div class="container">
<h3>Navbar With Dropdown</h3>
<p>This example adds a dropdown menu for the "Page 1" button in the navigation bar.</p>
</div>

</body>
</html>

关于php - laravel 5.6菜单表如何链接不同的页面部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48979487/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com