I am attempting to create a submit form in the framework but I am hitting a roadblock...

Closed
Vanguard - Advanced PHP Login and User Management Vanguard - Advanced PHP Login and User Management July 17, 2018
Login to reply
R T commented privately
Milos Stojanovic Support Agent
2 weeks ago
Closed due to inactivity.
Milos Stojanovic Support Agent
3 weeks ago

Hey,

I'm sorry but I'm not available for any custom work at the moment. 

Like I said, if your local mail server is not configured to deliver emails properly (most likely they are going to spam or something) then you should use some external SMTP server for sending emails like SendGrid, Amazon SES or similar. 

The configuration is the same as for any other Laravel application and for more info you can check the Laravel's documentation and "Email Configuration" section in Configuration documentation article.

- Milos

Billy Ireland
3 weeks ago

So how much to set up the emailer. I and another developer have been working on this for 2 days now and cant get it to email to anything other than gmail.

Milos Stojanovic Support Agent
4 weeks ago

Hey Billy,

Ok, great! I'm glad you figured it out. :)

- Milos

Billy Ireland
4 weeks ago

Ok, got it, thanks...

This worked

{!! Form::open(array('route' => 'posts.store')) !!}

Billy Ireland
4 weeks ago

Thanks Milos,

I am still getting the error

ErrorException (E_ERROR)

Action Web\PostsController@store not defined. (View: C:\xampp\htdocs\kcirecords.com\resources\views\posts\create.blade.php)

The controller is in the web directory.

I will try and figure out named routes. I know the route is there but it was created with 

Route::resource('posts', 'PostsController');


Milos Stojanovic Support Agent
4 weeks ago

Hey Billy,

Your PostsController is not inside the default namespace (which is Vanguard\Http\Controllers) and that's why you cannot use it like that.  Your form open tag should look like following:

{!! Form::open(['action' => 'Web\PostsController@store', 'method' => 'POST']) !!}

However, I would recommend you to use named routes instead since using controller actions makes things too coupled. In general, your view files should not know how your controllers are organized and which methods should be triggered when a form is submitted. That's why you can use (named) routes to make a connection between a specific view, route, and a controller method. 

Here you can learn more about named routes: https://laravel.com/docs/5.6/routing#named-routes

- Milos

Billy Ireland
4 weeks ago

Hello,

I have created a PostsController in the terminal and am trying to create a submit form. I am getting an error Action PostsController@store not defined. I can view, sort, order, ect data from the controller but I cant POST. What am I missing.

Am I attempting to add data incorrectly?


Thank You,

Billy