在另一个窗口中分离数据

时间:2019-06-10 06:22:42

标签: html css laravel

我想在另一个窗口中分隔输入系统的数据时遇到问题。 我目前有以下代码:

Route::get('/lista',[
    'uses'=>'CarController@mostrar',
    'as'=>'cars.crear'
]);

Route::post('/crear',[
    'uses'=>'CarController@crear',
    'as'=>'cars.crear'
]);
<!DOCTYPE html>
<html lang="es">
<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">

    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

    <title>Aplicacion de autos</title>
</head>
<style>
table, th td {
    border: 4px solid black;
}
</style>

<div class="col-md-6">
    <caption>Lista de autos</caption>
    <table class="table table-striped table-hover">
        <tr>
            <th>Patente</th>
            <th>Marca</th>
            <th>Modelo</th>
            <th>Color</th>
            <th>Fecha_ingreso</th>
        </tr>
        @foreach($cars as $car)
        <tr>
            <td>{{ $car->patente }}</td>
            <td>{{ $car->marca }}</td>
            <td>{{ $car->modelo }}</td>
            <td>{{ $car->color }}</td>
            <td>{{ $car->fecha_ingreso }}</td>
            <td>
                <a href="{{ route('cars.edit', $car->id )}}" class="btn btn-warning btn-xs">Modificar</a>
            </td>
            <td>
                <form action="{{ route('cars.destroy', $car->id )}}" method="POST">
                    <input name="_method" type="hidden" value="DELETE">
                    {{ csrf_field() }}
                    <input type="submit" class="btn btn-danger btn-xs" value=Eliminar>
                </form>
            </td>
        </tr>
        @endforeach
    <table style="float: right;">
    </table>
    </div> 
</form>
public function mostrar() {
    $cars=Car::all();
    return view ('lista',['cars'=>$cars]);
}

执行代码以将数据重新输入到系统中时,我得到以下信息

  

错误:“此路由不支持GET方法。受支持   方法:POST。”

0 个答案:

没有答案