/** * Add the default branding. */ public function addDefaultBrand() { // Always recreate the default branding for the system DB::table('brands')->where('id', '=', '1')->delete(); $brands = [['id' => 1, 'name' => 'AbuseIO', 'company_name' => 'AbuseIO', 'introduction_text' => 'Open Source abusemanagement', 'creator_id' => 1, 'logo' => file_get_contents(Brand::getDefaultLogo()->getPathname()), 'systembrand' => true, 'created_at' => new DateTime(), 'updated_at' => new DateTime()]]; DB::table('brands')->insert($brands); }
/** * @return Brand */ protected function getModelFromRequest() { $brand = new Brand(); $brand->name = $this->argument('name'); $brand->company_name = $this->argument('company_name'); $brand->introduction_text = $this->argument('introduction_text'); $brand->logo = Brand::getDefaultLogo(); $brand->creator_id = Account::getSystemAccount()->id; return $brand; }
/* |-------------------------------------------------------------------------- | Model Factories |-------------------------------------------------------------------------- | | Here you may define all of your model factories. Model factories give | you a convenient way to create models for testing and seeding your | database. Just tell the factory how a default model should look. | */ $factory->define(AbuseIO\Models\Account::class, function (Faker\Generator $faker) { return ['name' => $faker->name, 'description' => $faker->sentence(rand(6, 10)), 'disabled' => rand(0, 1), 'systemaccount' => 0, 'brand_id' => 1]; }); $factory->define(AbuseIO\Models\Brand::class, function (Faker\Generator $faker) { return ['name' => $faker->name, 'company_name' => $faker->company, 'logo' => file_get_contents(\AbuseIO\Models\Brand::getDefaultLogo()->getPathname()), 'introduction_text' => $faker->realText(), 'creator_id' => 1]; }); $factory->define(AbuseIO\Models\Contact::class, function (Faker\Generator $faker) { global $contact_reference_counter; if (!$contact_reference_counter) { $contact_reference_counter = 1; } else { $contact_reference_counter++; } return ['reference' => sprintf('reference_%d', $contact_reference_counter), 'name' => $faker->name, 'email' => $faker->email, 'api_host' => 'api_host', 'auto_notify' => $faker->boolean(), 'enabled' => $faker->boolean(), 'account_id' => AbuseIO\Models\Account::all()->first()->id]; }); $factory->define(AbuseIO\Models\Domain::class, function (Faker\Generator $faker) { return ['name' => $faker->domainName, 'contact_id' => AbuseIO\Models\Contact::all()->first()->id, 'enabled' => $faker->boolean()]; }); $factory->define(AbuseIO\Models\Event::class, function (Faker\Generator $faker) { $evidence = factory(\AbuseIO\Models\Evidence::class)->create();