John Davidson

php - Route [X.store] not defined :S

0 comments
Message:


I'm doing a simple form to send data to DB and when I submit it it appears the title error.


I think I defined everything perfect, but I can't understand where I'm failing.



Symfony\Component\Routing\Exception\RouteNotFoundException
Route [EnviarCurriculum.store] not defined. (View: C:\laragon\www\envio-curriculum\resources\views\enviar_curriculum.blade.php)



web.php


<?php

Route::resource('/', 'enviarCurriculum\EnviarCurriculumController')->only(['index', 'create', 'store']);

EnviarCurriculumController.php


<?php

namespace App\Http\Controllers\enviarCurriculum;

use App\EnviarCurriculum;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use app\Http\Requests\StoreEnviarCurriculumPost;


class EnviarCurriculumController extends Controller
{
public function index()
{
return view ('enviar_curriculum');
}

public function create()
{
return view ('enviar_curriculum', ['post' => new EnviarCurriculum()]);
}

public function store(StoreEnviarCurriculumPost $request)
{
EnviarCurriculum::create($request->validated());

return back() -> with('status', '¡Post creado con éxito!');
}
}

enviar_curriculum.blade.php


<!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">
<title>Document</title>
</head>
<body>
<form action="{{ route("EnviarCurriculum.store") }}" method="POST">
@csrf

<h4>Datos Personales</h4>
<small class="pull-right">sin espacios, ni guiones</small>
<br>
<input autocomplete="off" type="text" id="frmInscripcionEmpleoNIF" class="form-control" placeholder="* NIF/NIE/Pasaporte" maxlength="20" required data-error="Por favor rellene este campo">
<div class="help-block with-errors"></div>
<input autocomplete="nope" type="text" id="frmInscripcionEmpleoNombre" class="form-control" placeholder="* Nombre" maxlength="50" required data-error="Por favor rellene este campo">
<div class="help-block with-errors"></div>
<input autocomplete="off" type="text" id="frmInscripcionEmpleoApellido1" class="form-control" placeholder="* 1º Apellido" maxlength="50" required data-error="Por favor rellene este campo">
<div class="help-block with-errors"></div>
<input autocomplete="off" type="text" id="frmInscripcionEmpleoApellido2" class="form-control" placeholder="2º Apellido" maxlength="50" data-error="Por favor rellene este campo">
<div class="help-block with-errors"></div>
<select class="form-control" name="frmInscripcionEmpleoSexo" required id="frmInscripcionEmpleoSexo">
<option disabled selected value="">* Sexo</option>
<option value="H">Hombre</option>
<option value="M">Mujer</option>
</select>

<input type="submit" class="btn btn-primary" value="Enviar">
</form>
</body>
</html>


My Answer:
Route::post('/enviar-curriculum', 'EnviarCurriculumController@store')->name('enviar-curriculum.store');

Rate this post

3 of 5 based on 8183 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us