Я пытаюсь перенаправить страницу в форму или домой после отправки данных и успешной вставки данных в laravel, но ошибка показывает, что страница не найдена.Пожалуйста, помогите мне.Код моего контроллера задан testing.php
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Request;
use App\test;
class testing extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return view('create');
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//store data in database
test::create(Request::all());
echo "data enserted Successfully";
?><a href="<?php return redirect()->action('HomeController@index');?>">Go Back Home</a><?php
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* 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)
{
//
}
}
И файл представления формы create.blade.php дан
@extends('master')
@section('content')
<div class="container"><br>
<h1 class="text-success text-center">Student Registration Form</h1><br>
<div class="col-md-offset-3 col-md-6 m-auto d-block">
<form action="save" method="post" onsubmit="return validation()">
<input type="hidden" name="_token" value="{{csrf_token()}}">
<div class="form-group">
<label>Student Name: </label>
<input type="text" name="sname" id="sname" class="form-control">
<span id="studenterror" class="text-danger font-weight-bold"></span>
</div>
<div class="form-group">
<label>Father Name: </label>
<input type="text" name="fname" id="fname" class="form-control">
<span id="fnameerror" class="text-danger font-weight-bold"></span>
</div>
<div class="form-group">
<label>Graduation Year: </label>
<input type="date" name="gyear" id="gyear" class="form-control">
<span id="gyearerror" class="text-danger font-weight-bold"></span>
</div>
<div class="form-group">
<label>Phone: </label>
<input type="number" name="phone" id="phone" class="form-control">
<span id="phoneerror" class="text-danger font-weight-bold"></span>
</div>
<div class="form-group">
<label>Email: </label>
<input type="email" name="email" id="email" class="form-control">
<span id="emailerror" class="text-danger font-weight-bold"></span>
</div>
<div class="form-group">
<label>Postal Address: </label>
<input type="text" name="paddress" id="paddress" class="form-control">
<span id="addresserror" class="text-danger font-weight-bold"></span>
</div>
<div class="form-group">
<label>Program: </label>
<select class="form-control" name="program">
<option value="Nill">Select Program</option>
<option value="msc">MSc</option>
<option value="bs">BS</option>
<option value="mphil">MPhil</option>
<option value="phd">PHD</option>
</select>
</div>
<div>
<label>Job</label><br>
<div class="form-control radio-inline">
<div class="col-md-4">
<label>
<input type="radio" name="job" value="yes" data-toggle="collapse" data-target="#org">Yes</label>
<label>
<input type="radio" name="job" value="no" data-toggle="collapse" data-target="#">No </label>
</div>
</div>
<br>
<div id="org" class="collapse">
<div class="form-group">
<label>Organization: </label>
<select class="form-control" name="org">
<option value="Nill">Select Organization</option>
<option value="Higher_Education">Higher Education</option>
<option value="Software_House">Software House</option>
<option value="Hardware_industry">Hardware Industry</option>
<option value="other">Other</option>
</select>
</div>
<label>Position</label>
<input type="text" name="position" class="form-control" id="position">
</div>
</div><br>
<div>
<input type="submit" name="Submit" class="btn btn-lg col-md-offset-3 col-md-6 m-auto d-block">
</div>
</form>
</div>
</div>
<h4 align="center">---------------------------------------------------<br>
First Task of Project Learning</h4>
<br>
<a href="{{url('/plearning')}}" class="btn btn-primary">Back to Home</a>
@endsection
Я хочу перенаправить представление просмотра в HomeController @Индекс и его код дан
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class HomeController extends Controller
{
//
public function index(){
return view('plearning');
}
}
Пожалуйста, исправьте мой код и помогите мне.Заранее спасибо