在资源路由中创建 laravel

我为创建开发功能和刀片Mission,但是当我点击“Ajouter Mission”时,什么也没有发生……


请问问题出在哪里?


控制器 :


 public function create($request, $id)

    {

        $miss = \App\User::find($id);

       $mission = new Mission;

       $mission->NOM =$request->input('NOM');

       $mission->ID_PERSONNELS = $miss->ID_PERSONNELS;

       $mission->ID_NOTE_DE_FRAIS = 1;

       $mission->DATE_MISSION = $request->input('DATE_MISSION');

       $mission->save();

    }

和我的刀片文件:


@extends('layouts.app')


@section('content')

<div class="container">

    <div class="row justify-content-center">

        <div class="col-md-8">

            <div class="card">

                <div class="card-header">Dashboard</div>


                <div class="card-body">

                    @if (session('status'))

                    <div class="alert alert-success" role="alert">

                        {{ session('status') }}

                    </div>

                    @endif

                    @csrf

                    You are in home as Admin !


                    </br>

                    Liste des Utilisateurs

                    <table class="table table-sstriped card-body">

                        <thead>

                            <tr>

                                <th>Numero Matricule</th>

                                <th>Nom</th>

                                <th>Prenom</th>

                                <th>Rue</th>

                                <th>Code Postal</th>

                                <th>Ville</th>

                                <th>Adresse mail</th>


                            </tr>

                        </thead>

                        <tbody>

                            @foreach($users as $resp)



桃花长相依
浏览 87回答 1
1回答

MYYA

这就是您需要在此处更新代码的方式。您需要创建表单并使用提交按钮。<form action="{{route('mission.create')}}" method="post">@csrf<!----------------------------------Body---------------------------------------------->&nbsp; &nbsp; <label for="NOM" class="col-md-4 col-form-label text-md-center">{{ __('NOM') }}</label>&nbsp; &nbsp; <div class="col-md-6">&nbsp; &nbsp; &nbsp; &nbsp; <input id="NOM" type="text" class="form-control @error('NOM') is-invalid @enderror" name="NOM" required&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;autocomplete="NOM" autofocus>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; @error('NOM')&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="invalid-feedback" role="alert">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <strong>{{ $message }}</strong>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>&nbsp; &nbsp; &nbsp; &nbsp; @enderror&nbsp; &nbsp; </div>&nbsp; &nbsp; <label for="DATE_MISSION" class="col-md-4 col-form-label text-md-center">{{ __('DATE_MISSION') }}</label>&nbsp; &nbsp; <div class="col-md-6">&nbsp; &nbsp; &nbsp; &nbsp; <input id="DATE_MISSION" type="date" class="form-control @error('DATE_MISSION') is-invalid @enderror"&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;name="DATE_MISSION" required autocomplete="DATE_MISSION" autofocus>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; @error('DATE_MISSION')&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="invalid-feedback" role="alert">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <strong>{{ $message }}</strong>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>&nbsp; &nbsp; &nbsp; &nbsp; @enderror&nbsp; &nbsp; </div><!--&nbsp; &nbsp;<label class="col-md-4 col-form-label text-md-center" for="ID_PRATICIEN">{{ __('PRATICIEN') }}</label> -->&nbsp; &nbsp; <!--&nbsp; <select class="custom-select col-md-4 col-form-label text-md-center" id="inputGroupSelect01">&nbsp; &nbsp; <option selected>Choose...</option>&nbsp; &nbsp; <option value="1">One</option>&nbsp; &nbsp; <option value="2">Two</option>&nbsp; &nbsp; <option value="3">Three</option></select>&nbsp; &nbsp; -->&nbsp; &nbsp; <!--------------------------------End----Body------------------------------------>&nbsp; &nbsp; <button type="button" class="btn btn-secondary" data-dismiss="modal">Annuler</button>&nbsp; &nbsp; <button type="submit" class="btn btn-primary">Ajouter Mission</button></form>
打开App,查看更多内容
随时随地看视频慕课网APP