addValidations('email', array( 'required' => __('You need to enter your email address.'), 'isEmail' => __('Your email address is invalid.') )); } static function search($orm, $search = '') { return $orm->where_raw( '(`email` LIKE ? OR `first_name` LIKE ? OR `last_name` LIKE ?)', array('%'.$search.'%', '%'.$search.'%', '%'.$search.'%') ); } static function groups() { return array( array( 'name' => 'all', 'label' => __('All'), 'count' => Subscriber::count() ), array( 'name' => 'subscribed', 'label' => __('Subscribed'), 'count' => Subscriber::where('status', 'subscribed')->count() ), array( 'name' => 'unconfirmed', 'label' => __('Unconfirmed'), 'count' => Subscriber::where('status', 'unconfirmed')->count() ), array( 'name' => 'unsubscribed', 'label' => __('Unsubscribed'), 'count' => Subscriber::where('status', 'unsubscribed')->count() ) ); } static function group($orm, $group = null) { if(in_array($group, array('subscribed', 'unconfirmed', 'unsubscribed'))) { return $orm->where('status', $group); } } }