I have a form
<form action="{{ action('NotesController@store') }}" method="post">
//
</form>
The action points to the store
method in the NotesController controller in the App\Http\Controllers
directory.
The NotesController
looks like this:
<?php
namespace App\Http\Controllers;
use App\Note;
use Illuminate\Http\Request;
class NotesController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* 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)
{
// var_dump($request);
//
// $note = new Note();
}
/**
* 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)
{
//
}
}
But when I try to render the page that displays my form (so before even submitting it, just trying to render the form itself) I get the following error:
Action App\Http\Controllers\NotesController@store not defined. (View: C:\xampp\htdocs\personal_projects\Active\diary_app\resources\views\diary\entry.blade.php)
NotesController@store
in question! – Hiren GohelRoute::resource('notes', 'NotesController');
and it works... – Jethro Hazelhurst