本文整理汇总了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');
}
示例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());
}
}
示例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]);
}
示例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);
}
示例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;
}
示例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());
}
}
示例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);
}
示例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;
}
示例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());
}
示例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();
}
示例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));
}
}
示例12: PublishedProject
public function PublishedProject()
{
$projects = Project::with(['createdBy', 'faculty', 'status'])->whereHas('status', function ($q) {
$q->where('key', '=', 'published');
})->get();
return $projects;
}
示例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]);
}
示例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;
}
示例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;
}