I am trying to create a page I can hit to update a record in the db, something I am used to doing in Laravel, but now have to do in Craft.
The controller method would look something like this:
public function updateUserRecordsTest($userId) {
$user = craft()->users->getUserById($userId);
// $data['status'] = 'asleep';
// $user->update($data);
}
So I am trying to make a route in craft/config/routes.php like this
route => user/update/{id} , controller => UsersController@updateUserRecordsTest;
Any suggestions on how to set this route up in Craft would be greatly appreciated.
*Update
So I will try to clear up what I am trying to do.
I need to update the users db when they pass classes. This will most likely be a boolean, but may end up being an enum. So what I would usually set up is a page with a controller method like below
// sudo code
public function passedThisClass($id) {
$user = User::find($id);
$data['passed'] = 1
User::update($data);
});
the route would look like
// sudo code
route::get('updatethisclass/{id} => UsersController@updateThisClass);
When I hit that page it updates the value from 0 to 1 flagging that they passed the class.