Beispiel #1
0
 /**
  * @param $name
  * @return Domain|null
  */
 private function findByName($name)
 {
     if (strlen($name) > 0) {
         return Domain::where("name", "like", '%' . $this->option("name"))->first();
     }
     return null;
 }
 public function testValidCreate()
 {
     $faker = Factory::create();
     $domainName = $faker->domainName;
     Artisan::call('domain:create', ['name' => $domainName, 'contact_id' => Contact::all()->first()->id]);
     $this->assertContains('The domain has been created', Artisan::output());
     Domain::where('name', $domainName)->forceDelete();
 }
Beispiel #3
0
 static function byDomain($domainName)
 {
     $domain = Domain::where('name', '=', $domainName)->where('enabled', '=', true)->take(1)->get();
     if (isset($domain[0])) {
         return $domain[0]->contact;
     } elseif (class_exists('AbuseIO::Custom::FindContact') === true && is_callable('\\AbuseIO\\Custom\\FindContact->byDomain') === true) {
         // Call custom function
     } else {
         return FindContact::undefined();
     }
 }
Beispiel #4
0
 /**
  * Return contact by Domain
  * @param  string $domainName
  * @return object
  */
 public static function byDomain($domain)
 {
     $result = Domain::where('name', '=', $domain)->where('enabled', '=', true)->take(1)->get();
     if (isset($result[0])) {
         return $result[0]->contact;
     }
     $findContact = FindContact::getExternalResolver('domain', $domain);
     if (!empty($findContact)) {
         return $findContact;
     }
     return FindContact::undefined();
 }
Beispiel #5
0
 /**
  * Return contact by Domain
  *
  * @param  string $domain domain name
  * @return object
  */
 public static function byDomain($domain)
 {
     // If local lookups are not preferred, then do the remote lookup first
     if (config('main.external.prefer_local') === false) {
         $findContact = FindContact::getExternalContact('domain', $domain);
         if (!empty($findContact)) {
             return $findContact;
         }
     }
     // Do a local lookup
     $result = Domain::where('name', '=', $domain)->where('enabled', '=', true)->take(1)->get();
     if (isset($result[0])) {
         return $result[0]->contact;
     }
     // Do a remote lookup, if local lookups are preferred. Else skip this as this was already done.
     if (config('main.external.prefer_local') === true) {
         $findContact = FindContact::getExternalContact('domain', $domain);
         if (!empty($findContact)) {
             return $findContact;
         }
     }
     return FindContact::undefined();
 }
Beispiel #6
0
 public function testModelFactory()
 {
     $domain = factory(Domain::class)->create();
     $domainFromDB = Domain::where('name', $domain->name)->first();
     $this->assertEquals($domain->name, $domainFromDB->name);
 }
Beispiel #7
0
 /**
  * {@inherit docs}.
  */
 protected function getCollectionWithArguments()
 {
     return Domain::where('name', 'like', '%' . $this->argument('domain') . '%')->orWhere('id', $this->argument('domain'));
 }
Beispiel #8
0
 /**
  * {@inheritdoc}.
  */
 protected function findWithCondition($filter)
 {
     return Domain::where('name', 'like', "%{$this->option('filter')}%")->get();
 }