PHP Method Schema::hasCollection, someline-starter Code Examples

This page contains top rated real world PHP examples of method Schema::hasCollection from package someline-starter extracted from open source projects. You can rate examples to help us improve the quality of examples
Frequently Used Methods
Example #1
Show file File: Entity.php Project: crowdtruth/crowdtruth
0
 protected static function boot()
 {
     parent::boot();
     static::creating(function ($entity) {
         if (!Schema::hasCollection('entities')) {
             static::createSchema();
         }
         if (empty($entity->project)) {
             throw new Exception("No project was given");
         }
         if (!empty($entity->hash) && !empty($entity->project)) {
             if (Entity::withTrashed()->where('hash', $entity->hash)->where('project', $entity->project)->first()) {
                 throw new Exception("Hash already exists for: " . $entity->title . " in project " . $entity->project);
             }
         }
         $entity->_id = static::generateIncrementedBaseURI($entity);
         if (Auth::check()) {
             $entity->user_id = Auth::user()->_id;
         } else {
             $entity->user_id = "crowdtruth";
         }
     });
     static::saved(function ($entity) {
         Temp::truncate();
         Cache::flush();
     });
     static::deleted(function ($entity) {
         Cache::flush();
     });
 }
Example #2
Show file File: Template.php Project: crowdtruth/crowdtruth
0
 public static function boot()
 {
     parent::boot();
     static::saving(function ($template) {
         if (!Schema::hasCollection('templates')) {
             static::createSchema();
         }
         static::validateTemplate($template);
     });
 }
Example #3
Show file File: SchemaTest.php Project: danielheyman/TechDimeProjects
0
 public function testDrop()
 {
     Schema::create('newcollection');
     Schema::drop('newcollection');
     $this->assertFalse(Schema::hasCollection('newcollection'));
 }