Any reason you're not using Eloquent? Something like this would work with Eloquent:
public function getActive()
{
// find the user, if no user found then throw an error
$user = User::where('email', Input::get('email'))
->where('hash', Input::get('hash'))
->where('active', 0)
->findOrFail();
// set the active field to 1
$user->active = 1;
// save the user
$user->save();
// redirect user to /activated
return Redirect::to('activated');
}
Also you could create a notActivated
query scope to make the code cleaner in your controller if you wanted to.
I am using Eloquent, I will try that and see if it works. I thought i had to use the DB function to do any database related things?
Eloquent is the Laravel ORM, Eloquent provides a ton of helpful methods for interacting with databases, DB
is a way to bypass Eloquent (and any other Laravel magic) to run raw SQL queries.
You can read more about Eloquent here: http://laravel.com/docs/eloquent
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community