代码:Zhangyq.balde.php
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>@yield("title",'圣杯模型')</title>
</head>
<style>
* {
color:
text-align: center;
}
header {
background-color: DodgerBlue;
height: 150px;
width: 100%;
line-height: 150px;
}
.flex-box {
display: flex;
}
.flex-left {
background-color: MediumPurple;
flex: 0 0 200px;
height: 400px;
width: 100px;
line-height: 300px;
}
.flex-center {
background-color: Cyan;
flex-grow: 1;
height: 400px;
width: 50px;
line-height: 400px;
}
.flex-right {
background-color: MediumPurple;
flex: 0 0 200px;
height:400px;
width: 100px;
line-height: 300px;
}
footer {
background-color: DarkSlateBlue;
height: 200px;
width: 100%;
line-height: 150px;
}
</style>
<body>
<header>header</header>
<div class="flex-box">
<div class="flex-left">@yield('left')</div>
<div class="flex-center">@yield('main')</div>
<div class="flex-right">@yield('right')</div>
</div>
<footer>footer</footer>
</body>
</html>
create.blade.php
@extends('layout.parent')
@section('title','添加用户')
@section('content')
<x-alert :type="$type" :message="$message">
<h4>中间的内容:插槽</h4>
<x-slot name="title">
laravel插槽学习
</x-slot>
</x-alert>
<!-- <form action="/user" method="post"></form> -->
<form action="{{route('user.store')}}" method="post">
<!-- <form action="{{url('user')}}" method="post"> -->
<!-- @csrf -->
<!-- {{csrf_field()}} -->
<input type="hidden" name="_token" value="{{csrf_token()}}" >
<div>
<label for='username'>用户名:</label>
<input id="username" type="text" name="username" placeholder="请输入用户名">
</div>
<input type="submit" value="添加">
</form>
@parent
@endsection
运行网页
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/119a660a8dc5221ba3673d9727c7ae5a.png#pic_center)