private function base_data() { // If the "Web Design" service already exists, assume this task has already been run and exit. if (Service::where_name('Web Design')->first()) { return; } // Create services for vendor profiles Service::create(array('name' => 'Web Design', 'description' => 'Your focus is on design. You spend your time in graphic design tools.')); Service::create(array('name' => 'Web Development', 'description' => 'You write code. PHP, Ruby on Rails, Python, ColdFusion. You write software.')); Service::create(array('name' => 'Content Management ', 'description' => 'Your focus is on Content Management. Drupal Integrations, etc.')); Service::create(array('name' => 'Social Media Marketing', 'description' => 'Facebook, Twitter, Google+, you help people use Social Media to the best of their ability.')); Service::create(array('name' => 'Search Engine Optimization', 'description' => 'You make content discoverable in search engines.')); Service::create(array('name' => 'Mobile Application Development', 'description' => 'You make applications for mobile phones.')); Service::create(array('name' => 'Video Production', 'description' => 'Your make great online videos')); Service::create(array('name' => 'Video Transcription', 'description' => 'You write transcripts of videos.')); // Create project types $project_types = array(); $project_types[] = ProjectType::create(array('name' => 'Web Design', 'naics' => 541430, 'threshold' => 7)); $project_types[] = ProjectType::create(array('name' => 'Web Development', 'naics' => 541511, 'threshold' => 25.5)); $project_types[] = ProjectType::create(array('name' => 'Content Management', 'naics' => 541511, 'threshold' => 25.5)); $project_types[] = ProjectType::create(array('name' => 'Social Media Marketing', 'naics' => 541511, 'threshold' => 25.5)); $project_types[] = ProjectType::create(array('name' => 'Search Engine Optimization', 'naics' => 541511, 'threshold' => 25.5)); $project_types[] = ProjectType::create(array('name' => 'Mobile Application Development', 'naics' => 541511, 'threshold' => 25.5)); $project_types[] = ProjectType::create(array('name' => 'Video Production', 'naics' => 512110, 'threshold' => 29.5)); $project_types[] = ProjectType::create(array('name' => 'Video Transcription', 'naics' => 561410, 'threshold' => 7)); foreach ($project_types as $project_type) { $project_type->show_in_list = true; $project_type->save(); } }
/** * Create project types group * * @param $project_id integer * @param $tableName string * * @return object */ public static function createTypesGroup($project_id, $tableName) { $tableName = strtolower($tableName); $project = Project::where('id', $project_id)->first(); if ($project === null) { throw new Exception('Project not found'); } $projectType = ProjectType::create(['project_id' => $project->id, 'type' => $tableName, 'table_name' => $project->name . '_' . $tableName]); Schema::create($projectType->table_name, function ($table) { $table->increments('id'); }); return $projectType; }
function create() { if ($_POST) { unset($_POST['send']); $_POST = array_map('htmlspecialchars', $_POST); $project_type = ProjectType::create($_POST); if (!$project_type) { $this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_create_project_type_error')); } else { $this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_create_project_type_success')); } redirect('projecttypes'); } else { $this->view_data['project_types'] = ProjectType::find('all', array('order' => 'name desc')); $this->theme_view = 'modal'; $this->view_data['title'] = $this->lang->line('application_add_new_project_type'); $this->view_data['form_action'] = 'projecttypes/create'; $this->content_view = 'projects/types/_projecttypes'; } }