當前位置: 首頁>>代碼示例>>PHP>>正文


PHP models\Project類代碼示例

本文整理匯總了PHP中app\models\Project的典型用法代碼示例。如果您正苦於以下問題:PHP Project類的具體用法?PHP Project怎麽用?PHP Project使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Project類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: manage

 public function manage(User $user, Project $project)
 {
     //dd($project);
     //return true;
     //dd( $user->role( 'admin' ));
     return $project->hasUser($user->id) || $user->role('admin');
 }
開發者ID:urands,項目名稱:docbase,代碼行數:7,代碼來源:ProjectPolicy.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @param \Illuminate\Http\Request $request
  * @param \App\Models\Project      $project
  * @return Response
  */
 public function store(Request $request, Project $project)
 {
     $input = array_merge($request->all(), ['status' => null, 'message' => null, 'project_id' => $project->id, 'user_id' => $project->github_webhook_user_id, 'task' => 'deploy']);
     if ($this->deploymentForm->save($input)) {
         $deployment = $project->getLastDeployment();
         return $deployment->toJson();
     } else {
         abort(400, $this->deploymentForm->errors());
     }
 }
開發者ID:ngmy,項目名稱:webloyer,代碼行數:17,代碼來源:DeploymentsController.php

示例3: actionCreate

 public function actionCreate()
 {
     if (\Yii::$app->user->isGuest) {
         throw new ForbiddenHttpException('Access denied');
     }
     $model = new Project();
     if ($model->load(\Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['/project/view', 'id' => $model->getPrimaryKey()]);
     }
     return $this->render('create', ['model' => $model]);
 }
開發者ID:mops1k,項目名稱:yiimine,代碼行數:11,代碼來源:ProjectController.php

示例4: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $firstCondition = new Condition(['type' => 'if', 'field' => 'event.type', 'operator' => '==', 'value' => 'push']);
     $firstCondition->save();
     $splitter = new Splitter();
     $splitter->save();
     $firstSplit = new Split();
     $firstSplit->save();
     $secondSplit = new Split();
     $secondSplit->save();
     $secondCondition = new Condition(['type' => 'contains', 'field' => '', 'operator' => '==', 'value' => '']);
     $secondCondition->save();
     $firstAction = new Action(['type' => 'ssh']);
     $host = new Host(['host' => 'ssh', 'port' => '22']);
     $auth = new Auth();
     $accountAuth = new AuthAccount();
     $accountAuth->username = getenv('SSH_USERNAME');
     $accountAuth->password = getenv('SSH_PASSWORD');
     $accountAuth->save();
     try {
         $file = new File();
         $keyAuth = new AuthKey();
         $keyAuth->username = 'root';
         $keyAuth->key = $file->get('.docker/builds/ssh/ssh_keys/id_rsa');
         $keyAuth->key_public = $file->get('.docker/builds/ssh/ssh_keys/id_rsa.pub');
         $keyAuth->save();
     } catch (Illuminate\Filesystem\FileNotFoundException $exception) {
         dump("SSH Key Not Found");
     }
     $auth->credentials()->associate($keyAuth);
     $auth->save();
     $host->auth()->associate($auth);
     $host->save();
     $firstAction->host()->associate($host);
     $firstAction->save();
     $firstAction->addCommand('touch testing');
     $firstAction->addCommand('ls');
     $secondAction = new Action();
     $secondAction->save();
     $secondAction->addCommand('composer install');
     $secondCondition->successPipeable()->associate($secondAction)->save();
     $firstSplit->pipeable()->associate($secondCondition);
     $secondSplit->pipeable()->associate($firstAction);
     $splitter->splits()->save($firstSplit);
     $splitter->splits()->save($secondSplit);
     $firstCondition->successPipeable()->associate($splitter)->save();
     $project = new Project();
     $project->name = 'example';
     $project->group = 'exampleGroup';
     $project->url = 'http://localhost/exampleGroup/example';
     $project->project_id = 2;
     $project->save();
     $project->conditions()->save($firstCondition);
 }
開發者ID:continuous-deployment,項目名稱:pipes,代碼行數:59,代碼來源:ExamplePipelineSeeder.php

示例5: GetAllProjects

 public function GetAllProjects()
 {
     $sql = "select id from projects";
     $result = $this->database->query($sql);
     $projects = array();
     foreach ($result as $row) {
         $project = new Project($this->database);
         $project->LoadFromID($row['id']);
         $projects[] = $project;
     }
     return $projects;
 }
開發者ID:jajisk,項目名稱:projectist,代碼行數:12,代碼來源:Projects.php

示例6: store

 /**
  * Store a newly created resource in storage.
  *
  * @param \Illuminate\Http\Request $request
  * @param \App\Models\Project      $project
  * @return Response
  */
 public function store(Request $request, Project $project)
 {
     $input = array_merge($request->all(), ['status' => null, 'message' => null, 'project_id' => $project->id, 'user_id' => $request->user()->id]);
     if ($this->deploymentForm->save($input)) {
         $deployment = $project->getLastDeployment();
         $link = link_to_route('projects.deployments.show', "#{$deployment->number}", [$project, $deployment->number]);
         $request->session()->flash('status', "The deployment {$link} was successfully started.");
         return redirect()->route('projects.deployments.index', [$project]);
     } else {
         return redirect()->route('projects.deployments.index', [$project])->withInput()->withErrors($this->deploymentForm->errors());
     }
 }
開發者ID:ngmy,項目名稱:webloyer,代碼行數:19,代碼來源:DeploymentsController.php

示例7: cart

 public function cart($slug, Project $project, Request $request)
 {
     $this->data['records'] = $project->getBySlug($slug);
     $id_data = $project->getBySlug($slug);
     $id_projects_comment = $id_data->id;
     //Ід проекта
     $this->data['projectsComments'] = $project->projectsComments($id_projects_comment);
     $this->data['projectsCommentsCount'] = $project->projectsCommentsCount($id_projects_comment);
     \DB::table('projects')->WHERE('id', '=', $id_projects_comment)->increment('count_views_projects');
     // рахуємо кулькість переглядів проектів
     if ($request->ajax()) {
         return response()->json(view('projects.ajaxPaginate.Cart', $this->data)->render());
     }
     return view('projects.cart', $this->data);
 }
開發者ID:bogdan8,項目名稱:iaravel5,代碼行數:15,代碼來源:ProjectsController.php

示例8: createProject

 /**
  *
  * @param $payer_email
  * @param $description
  * @param $rate
  * @return Project
  */
 public function createProject($payer_email, $description, $rate)
 {
     $project = new Project(['description' => $description, 'rate_per_hour' => $rate]);
     // @TODO Check if the user was added as payer before!! :)
     $payer = User::whereEmail($payer_email)->firstOrFail();
     $payee = Auth::user();
     $project->payer()->associate($payer);
     $project->payee()->associate($payee);
     $project->save();
     //Pusher
     $pusher = new Pusher(env('PUSHER_PUBLIC_KEY'), env('PUSHER_SECRET_KEY'), env('PUSHER_APP_ID'));
     $data = ['payee_id' => Auth::user()->id, 'payer_id' => $payer->id, 'project' => $project, 'message' => Auth::user()->name . ' would like to start a new project with you, with the description \'' . $project->description . ',\' and at $' . $rate . '/hour. Is this ok?'];
     $pusher->trigger('channel', 'insertProject', $data);
     return $project;
 }
開發者ID:JennySwift,項目名稱:project-tracker,代碼行數:22,代碼來源:ProjectsRepository.php

示例9: index

 /**
  * Return a paginated list of notes
  * 
  * @return \Dingo\Api\Http\Response
  */
 public function index($projectId)
 {
     $notes = Project::findOrFail($projectId)->notes()->paginate(app('request')->get('per_page', 10));
     $queryParams = array_diff_key($_GET, array_flip(['page']));
     $notes->appends($queryParams);
     return $this->response->paginator($notes, new NoteTransformer());
 }
開發者ID:missionsme,項目名稱:projects,代碼行數:12,代碼來源:ProjectNotesController.php

示例10: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $project = Project::findFail($id);
     $project->delete();
     $this->data->name = $project->name;
     return $this->json();
 }
開發者ID:alfrecuellar,項目名稱:muebles,代碼行數:13,代碼來源:ProjectController.php

示例11: invitation

 public function invitation($code)
 {
     if (Auth::check()) {
         $string = base64_decode($code);
         $ary = explode('-', $string);
         $email = $ary[0];
         $pId = $ary[1];
         $user = User::where('email', $email)->first();
         if ($user) {
             $user = $user->toArray();
             if (Auth::check()) {
                 if (Auth::user()->email == $user['email']) {
                     ProjectUser::where('project_id', $pId)->where('user_id', $user['id'])->update(['invitation' => 1]);
                     $project = Project::find($pId)->toArray();
                     $message = 'You are now member of project ' . $project['name'];
                     return Response()->json(ResponseManager::getResult($ary, 10, $message));
                 } else {
                     Auth::logout();
                     Session::flush();
                     $message = 'Please login with the email id on which you receive the invitation.';
                     return Response()->json(ResponseManager::getError('', 101, $message));
                 }
             } else {
                 $message = 'Plese login to accept the invitation';
                 return Response()->json(ResponseManager::getError('', 1010, $message));
             }
         } else {
             $message = 'You are not register with us. Please register with us.';
             return Response()->json(ResponseManager::getError('', 2020, $message));
         }
     } else {
         $message = 'Plese login to accept the invitation';
         return Response()->json(ResponseManager::getError('', 10, $message));
     }
 }
開發者ID:maineventio,項目名稱:newprojectbase,代碼行數:35,代碼來源:CommonController.php

示例12: PublishedProject

 public function PublishedProject()
 {
     $projects = Project::with(['createdBy', 'faculty', 'status'])->whereHas('status', function ($q) {
         $q->where('key', '=', 'published');
     })->get();
     return $projects;
 }
開發者ID:clubttt,項目名稱:SuccessModel4,代碼行數:7,代碼來源:PublishedProjectService.php

示例13: dashboard

 public function dashboard(Request $request)
 {
     //$settings = $request->session()->get('redbooth');
     ///$redbooth = Redbooth::instance($settings);
     $projects = Project::all();
     return view('admin.pages.dashboard', ['projects' => $projects]);
 }
開發者ID:ilbesculpi,項目名稱:flaming,代碼行數:7,代碼來源:HomeController.php

示例14: down

 public function down()
 {
     $this->dropColumn(Project::tableName(), 'keep_version_num');
     $this->dropColumn(Task::tableName(), 'enable_rollback');
     echo "m151027_063246_keep_version_num was reverted.\n";
     return true;
 }
開發者ID:9618211,項目名稱:walle-web,代碼行數:7,代碼來源:m151027_063246_keep_version_num.php

示例15: down

 public function down()
 {
     $this->dropColumn(Project::tableName(), 'post_release');
     $this->renameColumn(Project::tableName(), 'pre_release', 'post_release');
     echo "m151014_115546_add_pre_release_task be reverted.\n";
     return true;
 }
開發者ID:9618211,項目名稱:walle-web,代碼行數:7,代碼來源:m151014_115546_add_pre_release_task.php


注:本文中的app\models\Project類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。