本文整理汇总了PHP中app\models\Project类的典型用法代码示例。如果您正苦于以下问题:PHP Project类的具体用法?PHP Project怎么用?PHP Project使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Project类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: mapme
public static function mapme($objtype)
{
if ($objtype == "organisation") {
$objs = Organisation::all();
} else {
$objs = Project::all();
}
if (count($objs)) {
foreach ($objs as $obj) {
$dum[0] = $obj->{$objtype};
$dum[1] = $obj->latitude;
$dum[2] = $obj->longitude;
$dum[3] = url('/') . "/" . $objtype . "s/" . $obj->id;
if ($objtype == "project") {
$dum[4] = url('/') . "/public/images/project.png";
} else {
$dum[4] = url('/') . "/public/images/" . $obj->organisationtype . ".png";
}
$dum[5] = $obj->description;
$fin[] = $dum;
}
return json_encode($fin);
} else {
return "No data";
}
}
开发者ID:bishopm,项目名称:ncc,代码行数:26,代码来源:Helpers.php
示例17: run
public function run()
{
DB::table('projects')->delete();
$collection = [['project_types_id' => 1, 'project_statuses_id' => 4, 'disassemblers_id' => 1, 'creator_id' => 2, 'company_id' => 5, 'directory_path' => 'starfleet_academy/2015/37833_N195UA/', 'sales_id' => 7, 'project_start_date' => '2015-12-07', 'asset_arrival_date' => '2015-12-25', 'projected_completion_date' => '2016-01-10'], ['project_types_id' => 1, 'project_statuses_id' => 4, 'disassemblers_id' => 1, 'creator_id' => 2, 'directory_path' => 'starfleet_academy/2015/', 'company_id' => 5, 'sales_id' => 7, 'project_start_date' => '2015-12-07', 'asset_arrival_date' => '2015-12-25', 'projected_completion_date' => '2016-01-10'], ['project_types_id' => 1, 'project_statuses_id' => 3, 'disassemblers_id' => 1, 'creator_id' => 2, 'directory_path' => 'starfleet_academy/2015/', 'company_id' => 5, 'sales_id' => 7, 'project_start_date' => '2015-12-07', 'asset_arrival_date' => '2015-12-25', 'projected_completion_date' => '2016-01-10'], ['project_types_id' => 1, 'project_statuses_id' => 2, 'disassemblers_id' => 1, 'creator_id' => 2, 'directory_path' => 'starfleet_academy/2015/', 'company_id' => 5, 'sales_id' => 7, 'project_start_date' => '2015-12-07', 'asset_arrival_date' => '2015-12-25', 'projected_completion_date' => '2016-01-10'], ['project_types_id' => 1, 'project_statuses_id' => 1, 'disassemblers_id' => 1, 'creator_id' => 2, 'directory_path' => 'starfleet_academy/2015/', 'company_id' => 5, 'sales_id' => 7, 'project_start_date' => '2015-12-07', 'asset_arrival_date' => '2015-12-25', 'projected_completion_date' => '2016-01-10']];
foreach ($collection as $record) {
Project::create($record);
}
}
开发者ID:wyrover,项目名称:aeroeco,代码行数:8,代码来源:ProjectsTableSeeder.php
示例18: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($user, $project_name, $story_id)
{
$project_name = str_post_slug($project_name);
$project = Project::where('name', $project_name)->first();
$project_id = $project->id;
$story = Story::find($story_id);
return view('user.story.show', compact('user', 'project_name', 'project_id', 'story', 'project'));
}
开发者ID:sparkan,项目名称:Sparkous,代码行数:14,代码来源:StoryController.php
示例19: store
public function store($project_id, $request)
{
$section = new Section();
$section->fill($request);
$project = Project::find($project_id);
$project->sections()->save($section);
return $section;
}
开发者ID:ronal2do,项目名称:dave_brubeck,代码行数:8,代码来源:SectionRepository.php
示例20: createProject
protected function createProject()
{
$bSuccess = Project::create(['projectName' => $this->request->name, 'description' => $this->request->desc, 'userId' => Auth::user()->id, 'status' => 'open']);
if ($bSuccess) {
$oProject = ['oProject' => Project::getProject(), 'message' => 'Project successfully created.'];
return response()->json($oProject);
}
}
开发者ID:xrexonx,项目名称:LaravelCRUD,代码行数:8,代码来源:ProjectController.php
注:本文中的app\models\Project类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论