laravel详细信息

userController.php

<?php

namespace App\Http\Controllers;
use  App\Http\Controllers\students;
use Illuminate\Http\Request;


class userController1 extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        //
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */


    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
       {
           //
             // dd("store");

       }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        $stu=null;
                $students=students::$students;
                foreach($students as $value){
                    if($value['xh']==$id){
                        $stu=$value;

                    }
                }



                return view('admin.detail',compact("stu"));


    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }
}

detail.blade.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></title>
    <link rel="stylesheet" href="{{asset('css/bootstrap.min.css')}}">
</head>
<body>
    <h2>学生信息</h2>
    @if(empty($stu))
    <h2>没有学生信息</h2>
    @else
    <div class="row">
    <div class="col-md-8">
        <table class="table table-dark">
            <tr>
                <th>编号</th>
                <th>学号</th>
                <th>姓名</th>
                <th>性别</th>
                <th>班级</th>
                <th>专业</th>

                <th>年级</th>


                <th>学习方式</th>

            </tr>
            <tr>
                <td>{{$stu['id']}}</td>
                <td>{{$stu['xh']}}</td>
               <td> {{$stu['xingming']}}</td>
  <td>{{$stu['xingbie']}}</td>
     <td>{{$stu['banji']}}</td>
               <td>{{$stu['zhuanye']}}</td>


               <td>{{$stu['nianji']}}</td>

               <td>{{$stu['xuexixingshi']}}</td>




            </tr>
        </table>

        </div>
        @endif




    </div>

</body>
</html>

web.php

Route::get('/user',[usercontroller::class,'index']);
Route::resource('/user',[userController::class]);

在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值