/** * Execute the console command. * * @return mixed */ public function fire() { if ($this->option('all')) { Token::where([])->delete(); $this->info("All tokens deleted"); } else { Token::where('expire_at', '<', date('Y-m-d H:i:s'))->delete(); $this->info("All expired tokens removed"); } }
public function exists($tokenStr) { return $this->model->whereToken($tokenStr)->count() > 0; }
public function testClearExpired() { $command = App::make('token.clear'); $command->run(new Symfony\Component\Console\Input\ArrayInput(array()), new Symfony\Component\Console\Output\NullOutput()); $this->assertEquals(3, Token::count()); }