当前位置: 首页>>代码示例>>PHP>>正文


PHP Project::create方法代码示例

本文整理汇总了PHP中Project::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::create方法的具体用法?PHP Project::create怎么用?PHP Project::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Project的用法示例。


在下文中一共展示了Project::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handleRequest

 protected function handleRequest(array $request)
 {
     $version = $request[self::FIELD_PROTOCOL_VERSION];
     $projectTitle = $request[self::FIELD_TITLE];
     $projectDescription = $request[self::FIELD_DESCRIPTION];
     $projectId = Project::create(Project::getNextOrd(), $projectTitle, $projectDescription);
     $listsRep = $request[self::FIELD_LISTS];
     $listOrd = 0;
     foreach ($listsRep as $listRep) {
         $listTitle = $listRep[self::FIELD_TITLE];
         $listId = TasksList::create($projectId, ++$listOrd, $listTitle);
         $tasksRep = $listRep[self::FIELD_TASKS];
         $taskOrd = 0;
         foreach ($tasksRep as $taskRep) {
             $taskTitle = $taskRep[self::FIELD_TITLE];
             $taskDescription = $taskRep[self::FIELD_DESCRIPTION];
             $taskId = Task::create($listId, ++$taskOrd, $taskTitle, $taskDescription);
             if ($version > 1) {
                 $taskStatus = $taskRep[self::FIELD_TASK_STATUS];
                 Task::updateStatus($taskId, $taskStatus);
             }
         }
     }
     return array(self::FIELD_PROJECT_ID => $projectId);
 }
开发者ID:gmaizel,项目名称:taskdimension,代码行数:25,代码来源:import.php

示例2: create

 function create()
 {
     if ($_POST) {
         unset($_POST['send']);
         $_POST['datetime'] = time();
         $_POST = array_map('htmlspecialchars', $_POST);
         unset($_POST['files']);
         $project = Project::create($_POST);
         $new_project_reference = $_POST['reference'] + 1;
         $project_reference = Setting::first();
         $project_reference->update_attributes(array('project_reference' => $new_project_reference));
         if (!$project) {
             $this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_create_project_error'));
         } else {
             $this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_create_project_success'));
             $project_last = Project::last();
             $sql = "INSERT INTO `project_has_workers` (`project_id`, `user_id`) VALUES (" . $project_last->id . ", " . $this->user->id . ")";
             $query = $this->db->query($sql);
         }
         redirect('projects');
     } else {
         $this->view_data['companies'] = Company::find('all', array('conditions' => array('inactive=?', '0')));
         $this->view_data['next_reference'] = Project::last();
         $this->theme_view = 'modal';
         $this->view_data['title'] = $this->lang->line('application_create_project');
         $this->view_data['form_action'] = 'projects/create';
         $this->content_view = 'projects/_project';
     }
 }
开发者ID:timclifford,项目名称:freelance-manager,代码行数:29,代码来源:projects.php

示例3: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Project::create([]);
     }
 }
开发者ID:arwinjp,项目名称:ODTS,代码行数:7,代码来源:ProjectsTableSeeder.php

示例4: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         $user_id = rand(1, 10);
         Project::create(['name' => $faker->word($nb = 7), 'address' => $faker->address(), 'province' => $faker->state(), 'created_by' => $user_id, 'changed_by' => $user_id, 'change_reason' => $faker->realText(100)]);
     }
 }
开发者ID:syafdia,项目名称:PAS,代码行数:8,代码来源:ProjectsTableSeeder.php

示例5: store

 public function store()
 {
     $details = Input::all();
     if ($project = Project::create($details)) {
         return Response::json(['project' => $project, 'alert' => Messages::$createSuccess . 'project']);
     } else {
         return Response::json(['alert' => Messages::$createFail . 'project'], 400);
     }
 }
开发者ID:perinikhil,项目名称:rmm-backend,代码行数:9,代码来源:ProjectController.php

示例6: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 5) as $index) {
         Project::create(['title' => 'Sample Project', 'description' => 'Test project', 'owner_id' => '1', 'status_id' => '1', 'priority_id' => '1']);
     }
     foreach (range(1, 5) as $index) {
         Project::create(['title' => 'Sample Project', 'description' => 'Test project', 'owner_id' => '2', 'status_id' => '1', 'priority_id' => '1']);
     }
 }
开发者ID:terrygl,项目名称:SimpleLance,代码行数:10,代码来源:ProjectsTableSeeder.php

示例7: store

 /**
  * Store a newly created resource in storage.
  * POST /projects
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Project::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $data['created_by'] = Auth::user()->id;
     $data['changed_by'] = Auth::user()->id;
     Project::create($data);
     return Redirect::route('admin.projects.index');
 }
开发者ID:syafdia,项目名称:PAS,代码行数:17,代码来源:ProjectsController.php

示例8: createProject

 /**
  * Handles POST requests for /dashboard
  *
  * @return redirect
  */
 public function createProject()
 {
     if (!Utilities::checkEmpty($this->input)) {
         $response = ['error' => true, 'message' => 'Fields cannot be empty.'];
     } elseif (!$this->checkNaming($this->input['project_name'])) {
         $response = ['error' => true, 'message' => 'Alpha lowercase characters only.', 'input_text' => $this->input['project_name']];
     } else {
         Project::create(['user_id' => $this->user->id, 'name' => $this->input['project_name'], 'is_active' => true]);
         $response = ['error' => false, 'message' => 'Created new project successfully.'];
     }
     return Redirect::back()->with($response);
 }
开发者ID:shampine,项目名称:plumage,代码行数:17,代码来源:ProjectController.php

示例9: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $messages = array('start_at.required' => 'The starting date is required', 'end_at.required' => 'The ending date is required', 'start_at.after' => 'The starting date is invalid.', 'end_at.after' => 'Oh No! The ending date should be greater than the starting date.');
     $this->user_id = Auth::id();
     $validator = Validator::make(Input::all(), (new Project())->rules(), $messages);
     if ($validator->passes()) {
         Project::create(Input::except('_token'));
         return Redirect::to('projects')->with('success', 'Project created successfully');
     } else {
         return Redirect::to('projects/create')->withErrors($validator)->withInput();
     }
 }
开发者ID:x4rMa,项目名称:Vehicle-Inspection-System,代码行数:17,代码来源:ProjectController.php

示例10: create_project

 /**
  * Creates a project with the given name and owner user ID.
  */
 public static function create_project($unsafe_name, $owner_user_id)
 {
     if (!$unsafe_name || !$owner_user_id || !Authentication::authenticate_user_by_cookie($owner_user_id)) {
         return NULL;
     }
     $project = Project::create($unsafe_name);
     $query = new SqlQuery("INSERT INTO Projects (project_name, project_urlname, project_owneruserid) VALUES ('%s', '%s', '%s')", $project->get_name(), $project->get_url_name(), $owner_user_id);
     // Now fill in stuff from the new row into the object we
     // created before we return it
     $project->set_id($query->get_insert_id());
     $project->set_owner_user_id($owner_user_id);
     $project->set_owner_user_name(Sql::get_user_name_from_id($owner_user_id));
     return $project;
 }
开发者ID:rafaelbeckel,项目名称:task-taste,代码行数:17,代码来源:sql.php

示例11: run

 public function run()
 {
     DB::table('projects')->truncate();
     $dateTime = new DateTime('now');
     $dateTime = $dateTime->format('Y-m-d H:i:s');
     Project::create(['title' => "Project 1", 'body' => '<p>At vero eos et accusam et justo duo dolores et ea rebum. Consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</p>
                         <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.</p>', 'published' => 1, 'order' => 1, 'image' => 'project1.gif', 'portfolio_id' => 1, 'seo' => "SEO TITLE FOR PROJECT 1", 'slug' => '/project_one', 'created_at' => $dateTime, 'updated_at' => $dateTime]);
     Project::create(['title' => "Project 2", 'body' => '<p>At vero eos et accusam et justo duo dolores et ea rebum. Consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</p>
                         <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.</p>', 'published' => 1, 'order' => 1, 'image' => 'project2.gif', 'portfolio_id' => 1, 'seo' => "SEO TITLE FOR PROJECT 2", 'slug' => '/project_another', 'created_at' => $dateTime, 'updated_at' => $dateTime]);
     Project::create(['title' => "Project 3", 'body' => '<p>At vero eos et accusam et justo duo dolores et ea rebum. Consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</p>
                         <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.</p>', 'published' => 1, 'order' => 1, 'image' => 'project3.jpg', 'portfolio_id' => 2, 'seo' => "SEO TITLE FOR PROJECT 3", 'slug' => '/project_three', 'created_at' => $dateTime, 'updated_at' => $dateTime]);
     Project::create(['title' => "Project 4", 'body' => '<p>At vero eos et accusam et justo duo dolores et ea rebum. Consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</p>
                         <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.</p>', 'published' => 1, 'order' => 1, 'image' => 'project4.jpg', 'portfolio_id' => 2, 'seo' => "SEO TITLE FOR PROJECT 4", 'slug' => '/build_big_something', 'created_at' => $dateTime, 'updated_at' => $dateTime]);
 }
开发者ID:jboz62,项目名称:cms,代码行数:14,代码来源:ProjectsTableSeeder.php

示例12: add

 function add()
 {
     if ($_SERVER['REQUEST_METHOD'] == 'GET') {
         $project = Project::instance();
         return $this->View(array('view' => 'add', 'model' => $project));
     }
     //$project = new Project($_POST);
     $project = Project::create($_POST);
     if (empty($project->errors)) {
         $this->redirect_to('projects/all');
     } else {
         return $this->View(array('view' => 'add', 'model' => $project));
     }
 }
开发者ID:rajeshpillai,项目名称:rugby-mvc,代码行数:14,代码来源:ProjectsController.php

示例13: handleRequest

 protected function handleRequest(array $request)
 {
     $beforeId = $request[self::FIELD_BEFORE_PROJECT_ID];
     $title = $request[self::FIELD_TITLE];
     $description = $request[self::FIELD_DESCRIPTION];
     // FIXME: Global::lock();
     $ord = null;
     if ($beforeId) {
         $beforeProject = Project::fetch($beforeId);
         $ord = $beforeProject->getOrd();
         Project::shiftRight($ord);
     } else {
         $ord = Project::getNextOrd();
     }
     $projectId = Project::create($ord, $title, $description);
     return array(self::FIELD_PROJECT_ID => $projectId);
 }
开发者ID:gmaizel,项目名称:taskdimension,代码行数:17,代码来源:create.php

示例14: store

 /**
  * Store a newly created project in storage.
  *
  * @return Response
  */
 public function store()
 {
     $all = Input::all();
     $rules = Project::$rules;
     $validator = $this->validateSlugOnCreate($all, $rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     if (isset($all['image'])) {
         $all = $this->uploadFile($all, 'image');
     }
     $project = Project::create($all);
     if (isset($all['images'])) {
         $this->projectsService->addImages($project->id, $all['images'], 'Project');
     }
     return Redirect::route('admin_projects')->withMessage("Created Project");
 }
开发者ID:jboz62,项目名称:cms,代码行数:22,代码来源:ProjectsController.php

示例15: date

<?php

include '../../inc/config.php';
$session->auth_or_redirect('admin', '/', true);
$action = $_GET['f'];
$todayDate = date('Y-m-d H:i:s');
switch ($action) {
    case 'new':
        $project = new Project();
        $project->create($_POST['project']);
        if (isset($_FILES['photo'])) {
            $upload = new Upload();
            $upload->SetFileName($_FILES['photo']['name']);
            $upload->SetTempName($_FILES['photo']['tmp_name']);
            $upload->SetUploadDirectory(ROOT . '/photos/' . $project->id . '/');
            $upload->SetValidExtensions(array('gif', 'jpg', 'jpeg', 'png'));
            if ($upload->UploadFile()) {
                $p = new Photo();
                $photo['project_id'] = $project->id;
                $photo['name'] = $upload->GetFileName();
                $photo['position'] = count($p->find_by_project_id($photo['project_id'])) + 1;
                $photo['created_at'] = $todayDate;
                $photo['updated_at'] = $todayDate;
                $p->create($photo);
            }
        }
        $URL = './index.php';
        break;
    case 'edit':
        parse_str(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY));
        $project = new Project();
开发者ID:nepageeks,项目名称:champion,代码行数:31,代码来源:functions.php


注:本文中的Project::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。