/**
* Destroys the model with the given ID and options.
* @param String $id ID to match.
* @param [String => Mixed] $opts
* @return Boolean
*/
public function destroy($id, array $opts)
{
$client = $this->show($id, $opts);
\DB::getMongoDB()->oauth_clients->remove(['client_id' => $client->api['basic_key']]);
if ($this->where($opts)->count() < 2) {
$this->store(['authority' => ['name' => 'Must have client', 'mbox' => 'mailto:[email protected]']], $opts);
}
return parent::destroy($id, $opts);
}