I am trying to run an Ajax call using a basic user resource to store some input data. However, try as I might, I cannot seem to get beyond this 500 ISE. Here is the call (within a React.js function):
saveAndContinue: function(e) {
e.preventDefault()
// Get values via this.refs
email = this.refs.email.getDOMNode().value
this.setState({email: email})
this.setState({submitted: !this.state.submitted});
request = $.ajax({
url: "/user",
type: "post", success:function(data){
},
data: {'email': email} ,beforeSend: function(data){console.log(data);}
});
}
My Controller (UserController.php):
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
class UserController extends Controller {
/**
* Store user info.
*
*
* @return Response
*/
public function store() {
$v = Fan::validate(Input::all());
$email = Input::get('email');
if ( $v->passes() ) {
$user = new User;
$user->email = Input::get('email');
$user->save();
}
return $email;
}
}
I am using the model that comes pre-baked with Laravel 5.
The route to set up the resource is:
Route::resource('user', 'UserController');
This is extraordinarily frustrating. What could I possibly be doing wrong? I suspect this is something to do with Laravel 5 syntax (in my controller or something else) that is causing this error. Thank you in advance for your help!