Support the ongoing development of →
Authentication Security Database
Last updated 1 year ago.

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)
	// set the active field to 1
	$user->active = 1;
	// save the user
	// 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.

Last updated 1 year ago.

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?

Last updated 1 year ago.

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:

Last updated 1 year ago.

Sign in to participate in this thread!


Your banner here too?

Daeity daeity Joined 9 Mar 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.