Inheritance: implements Locker\Repository\Base\Repository
 /**
  * Destroys the model with the given ID and options.
  * @param String $lrs_id ID to match.
  * @param [String => Mixed] $opts
  * @return Boolean
  */
 public function destroy($lrs_id, array $opts)
 {
     // Delete related documents from client and oauth_clients collections.
     $clients = ClientModel::where('lrs_id', $lrs_id)->get();
     foreach ($clients as $client) {
         $client->delete();
     }
     StatementModel::where('lrs_id', $lrs_id)->delete();
     return parent::destroy($lrs_id, $opts);
 }
 /**
  * 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)
 {
     StatementModel::where('lrs._id', $id)->delete();
     return parent::destroy($id, $opts);
 }
Esempio n. 3
0
 /**
  * Converts foreign ids to MongoIds, then
  * gets the model with the given ID and options.
  * @param String $id ID to match.
  * @param [String => Mixed] $opts
  * @return Model
  */
 public function show($id, array $opts)
 {
     $opts['lrs_id'] = new \MongoId($opts['lrs_id']);
     return parent::show($id, $opts);
 }
 /**
  * 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:hello@learninglocker.net']], $opts);
     }
     return parent::destroy($id, $opts);
 }