/** * Execute the job. * * @param FlatCmService $service * @param WebsiteRepositoryInterface $websiteRepository */ public function handle(FlatCmService $service, WebsiteRepositoryInterface $websiteRepository) { if ($service->process($this->identifier, $this->username, $this->email, $this->password)) { $website = $websiteRepository->create(['identifier' => $this->identifier, 'username' => $this->username, 'email' => $this->email, 'is_active' => true, 'url' => 'http://' . $this->identifier . '.' . env('CMS_BASE_URL')]); $organization = Organization::findOrFail($this->organization_id); $website->organization()->associate($organization); $website->save(); //fire event } else { //fire event } }
public function destroy(FlatCmService $service) { $identifier = str_slug($this->organization->name, "-"); if ($service->destroyCMS($identifier)) { $website = $this->organization->website; $website->delete(); Flash::success(Lang::get('website.destroy-success')); } else { Flash::error(Lang::get('website.destroy-failed')); } return redirect(action('WebsiteController@index')); }