mercredi 12 février 2020

Class App\Http\Requests\TestRequest does not exist? But I am using this class in Controller

I am using same App\Http\Requests\TestRequest in controller but its display message this Class not exit what can be problem? Plz help me?

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests\TestRequest;

use App\Student;

class InsertController extends Controller
{
    public function insert(TestRequest $request){
        $obj = new Student();
        $obj->Name =$request->name;
        $obj->City = $request->city;
        $obj->save();

        return view('submit');
    }
}

TestRequest Code is Here!

<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class TestRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'Name'=>'required'
            'City'=>'required'
        ];
    }
}

Above Both codes are of Request folder And controller folder, I have done everything, i have done this class in Controller but its showing that not exist why? please Help me.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2HgClrb
via IFTTT

Aucun commentaire:

Enregistrer un commentaire