Example #1
0
 public static function from($mixed, $insertIfNotExists = false)
 {
     try {
         $w = static::batchFrom(array($mixed))->first();
     } catch (ItemNotFoundException $e) {
         if ($insertIfNotExists) {
             $w = new Wiki(array('name' => $mixed));
             $w->insert();
             $w->update('');
         } else {
             throw $e;
         }
     }
     return $w;
 }