I want to submit a form, but I always get Action App\Http\Controllers\About@show not defined
even though the function show
is defined:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
class AboutController extends Controller
{
public function create()
{
return view('about.contact');
}
public function show()
{
return view('about.contactshow');
}
}
This is my blade template about\contact.blade.php
:
{!! Form::open(array('action' => 'About@show', 'method' => 'post')) !!}
{!! Form::label('username','Username',array('id'=>'user','class'=>'')) !!}
{!! Form::text('username','user 1',array('id'=>'user','class'=>'', 'placeholder' => 'user 1')) !!}
{!! Form::submit('Click Me!') !!}
{!! Form::close() !!}
What am I doing wrong?
I was able to solve it.
First I had to change 'action' => 'About@show'
to 'action' => 'AboutController@show'
Then I had to register all Controller Actions in routes.php:
Route::post('contact_show', [
'uses' => 'AboutController@show'
]);
Route::get('contact_create', [
'uses' => 'AboutController@create'
]);
That's all, because of routes file web.php
. Plz check out you routes file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With