public function manage(User $user, Project $project) { //dd($project); //return true; //dd( $user->role( 'admin' )); return $project->hasUser($user->id) || $user->role('admin'); }
/** * 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()); } }
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]); }
/** * 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 = '******'; $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); }
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; }
/** * 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()); } }
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); }
/** * * @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; }
/** * 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()); }
/** * 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(); }
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)); } }
public function PublishedProject() { $projects = Project::with(['createdBy', 'faculty', 'status'])->whereHas('status', function ($q) { $q->where('key', '=', 'published'); })->get(); return $projects; }
public function dashboard(Request $request) { //$settings = $request->session()->get('redbooth'); ///$redbooth = Redbooth::instance($settings); $projects = Project::all(); return view('admin.pages.dashboard', ['projects' => $projects]); }
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; }
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; }
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"; } }
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); } }
/** * 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')); }
public function store($project_id, $request) { $section = new Section(); $section->fill($request); $project = Project::find($project_id); $project->sections()->save($section); return $section; }
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); } }
/** * Get the homepage content and metadata. * * @param Request $request * @return Response */ public function index(Request $request) { //Get the projects, eager load the project images and skills $projects = Project::with('images', 'skills')->get(); //Check if the contact submission cookie has been set $contacted = $request->cookie('cconf') ? $request->cookie('cconf') : false; return view('public.home')->withContacted($contacted)->withProjects($projects); }
protected function create($values) { $data = []; foreach ($this->structure as $i => $key) { $data[$key] = $values[$i]; } Project::create($data); }
public function up() { $this->alterColumn(Project::tableName(), 'excludes', Schema::TYPE_TEXT . ' COMMENT "要排除的文件"'); $this->alterColumn(Project::tableName(), 'hosts', Schema::TYPE_TEXT . ' COMMENT "目标机器列表"'); $this->alterColumn(Project::tableName(), 'pre_deploy', Schema::TYPE_TEXT . ' COMMENT "部署前置任务"'); $this->alterColumn(Project::tableName(), 'post_deploy', Schema::TYPE_TEXT . ' COMMENT "同步之前任务"'); $this->alterColumn(Project::tableName(), 'post_release', Schema::TYPE_TEXT . ' COMMENT "同步之后任务"'); }
/** * Finds the Project model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Project the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Project::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function __construct() { $this->project_id = Input::get('project_id'); $this->page_id = Input::get('page_id'); $this->token = Input::get('token'); $this->ip = Request::getClientIp(); $this->project_config = Project::getConfig($this->project_id)->toArray(); }
/** * Show the form for editing the specified resource. * GET /tasks/{id}/edit * * @param int $id * @return Response */ public function edit($society, $project, $id) { $data['society'] = $society; $data['task'] = Task::find($id); $data['project'] = Project::find($data['task']->project_id); $data['individuals'] = Individual::all(); return View::make('tasks.edit', $data); }
public function actionProject() { $projectNames = ['GeekBand-I150001', 'GeekBand-I150002', 'GeekBand-I150003', 'GeekBand-I150004', 'GeekBand-I150005', 'GeekBand-I150006', 'GeekBand-I150007', 'GeekBand-I150008', 'GeekBand-I150009', 'GeekBand-I150010', 'GeekBand-I150011', 'GeekBand-I150012', 'GeekBand-I150013', 'GeekBand-I150014', 'GeekBand-I150015', 'GeekBand-I150016', 'GeekBand-I150017', 'GeekBand-I150018', 'GeekBand-I150019', 'GeekBand-I150020', 'GeekBand-I150021', 'GeekBand-I150022', 'GeekBand-I150023', 'GeekBand-I150024', 'GeekBand-I150025', 'GeekBand-I150026', 'GeekBand-I150027', 'GeekBand-I150028', 'GeekBand-I150029', 'GeekBand-I150030', 'GeekBand-I150031', 'GeekBand-I150032', 'GeekBand-I150033', 'GeekBand-I150034', 'GeekBand-I150035', 'GeekBand-I150036', 'GeekBand-I150037', 'GeekBand-I150038', 'GeekBand-I150039', 'GeekBand-I150040', 'GeekBand-A150001', 'GeekBand-A150002', 'GeekBand-A150003', 'GeekBand-A150004', 'GeekBand-A150005', 'GeekBand-A150006', 'GeekBand-A150007', 'GeekBand-A150008', 'GeekBand-A150009', 'GeekBand-A150010', 'GeekBand-A150011', 'GeekBand-A150012', 'GeekBand-A150013', 'GeekBand-A150014', 'GeekBand-A150015', 'GeekBand-A150016', 'GeekBand-A150017', 'GeekBand-A150018', 'GeekBand-A150019', 'GeekBand-A150020', 'GeekBand-A150021', 'GeekBand-A150022', 'GeekBand-A150023', 'GeekBand-A150024', 'GeekBand-A150025', 'GeekBand-A150026', 'GeekBand-A150027', 'GeekBand-A150028', 'GeekBand-A150029', 'GeekBand-A150030', 'GeekBand-A150031', 'GeekBand-A150032', 'GeekBand-A150033', 'GeekBand-A150034', 'GeekBand-A150035', 'GeekBand-A150036', 'GeekBand-A150037', 'GeekBand-A150038', 'GeekBand-A150039', 'GeekBand-A150040', 'G2015010001', 'G2015010002', 'G2015010003', 'G2015010004', 'G2015010005', 'G2015010006', 'G2015010007', 'G2015010008', 'G2015010009', 'G2015010010', 'G2015010011', 'G2015010012', 'G2015010013', 'G2015010014', 'G2015010015', 'G2015010016', 'G2015010017', 'G2015010018', 'G2015010019', 'G2015010020', 'G2015010021', 'G2015010022', 'G2015010023', 'G2015010024', 'G2015010025', 'G2015010026', 'G2015010027', 'G2015010028', 'G2015010029', 'G2015010030', 'G2015010031', 'G2015010032', 'G2015010033', 'G2015010034', 'G2015010035', 'G2015010036', 'G2015010037', 'G2015010038', 'G2015010039', 'G2015010040', 'G2015010041', 'G2015010042', 'G2015010043', 'G2015010044', 'G2015010045', 'G2015010046', 'G2015010047', 'G2015010048', 'G2015010049', 'G2015010050', 'G2015010051', 'G2015010052', 'G2015010053', 'G2015010054', 'G2015010055', 'G2015010056', 'G2015010057', 'G2015010058', 'G2015010059', 'G2015010060', 'G2015010061', 'G2015010062', 'G2015010063', 'G2015010064', 'G2015010065', 'G2015010066', 'G2015010067', 'G2015010068', 'G2015010069', 'G2015010070', 'G2015010071', 'G2015010072', 'G2015010073', 'G2015010074', 'G2015010075', 'G2015010076', 'G2015010077', 'G2015010078', 'G2015010079', 'G2015010080', 'G2015010081', 'G2015010082', 'G2015010083', 'G2015010084', 'G2015010085', 'G2015010086', 'G2015010087', 'G2015010088', 'G2015010089', 'G2015010090', 'G2015010091', 'G2015010092', 'G2015010093', 'G2015010094', 'G2015010095', 'G2015010096', 'G2015010097', 'G2015010098', 'G2015010099', 'G2015010100', 'G2015010101', 'G2015010102', 'G2015010103', 'G2015010104', 'G2015010105', 'G2015010106', 'G2015010107', 'G2015010108', 'G2015010109', 'G2015010110', 'G2015010111', 'G2015010112', 'G2015010113', 'G2015010114', 'G2015010115', 'G2015010116', 'G2015010117', 'G2015010118', 'G2015010119', 'G2015010120', 'G2015010121', 'G2015010122', 'G2015010123', 'G2015010124', 'G2015010125', 'G2015010126', 'G2015010127', 'G2015010128', 'G2015010129', 'G2015010130', 'G2015010131', 'G2015010132', 'G2015010133', 'G2015010134', 'G2015010135', 'G2015010136', 'G2015010137', 'G2015010138', 'G2015010139', 'G2015010140', 'G2015010141', 'G2015010142', 'G2015010143', 'G2015010144', 'G2015010145', 'G2015010146', 'G2015010147', 'G2015010148', 'G2015010149', 'G2015010150', 'G2015010151', 'G2015010152', 'G2015010153', 'G2015010154', 'G2015010155', 'G2015010156', 'G2015010157', 'G2015010158', 'G2015010159', 'G2015010160', 'G2015010161', 'G2015010162', 'G2015010163', 'G2015010164', 'G2015010165', 'G2015010166', 'G2015010167', 'G2015010168', 'G2015010169', 'G2015010170', 'G2015010171', 'G2015010172', 'G2015010173', 'G2015010174', 'G2015010175', 'G2015010176', 'G2015010177', 'G2015010178', 'G2015010179', 'G2015010180', 'G2015010181', 'G2015010182', 'G2015010183', 'G2015010184', 'G2015010185', 'G2015010186', 'G2015010187', 'G2015010188', 'G2015010189', 'G2015010190', 'G2015010191', 'G2015010192', 'G2015010193', 'G2015010194', 'G2015010195', 'G2015010196', 'G2015010197', 'G2015010198', 'G2015010199', 'G2015010200', 'G2015010201', 'G2015010202', 'G2015010203', 'G2015010204', 'G2015010205', 'G2015010206', 'G2015010207', 'G2015010208', 'G2015010209', 'G2015010210', 'G2015010211', 'G2015010212', 'G2015010213', 'G2015010214', 'G2015010215', 'G2015010216', 'G2015010217', 'G2015010218', 'G2015010219', 'G2015010220', 'G2015010221', 'G2015010222', 'G2015010223', 'G2015010224', 'G2015010225', 'G2015010226', 'G2015010227', 'G2015010228', 'G2015010229', 'G2015010230', 'G2015010231', 'G2015010232', 'G2015010233', 'G2015010234', 'G2015010235', 'G2015010236', 'G2015010237', 'G2015010238', 'G2015010239', 'G2015010240', 'G2015010241', 'G2015010242', 'G2015010243', 'G2015010244', 'G2015010245', 'G2015010246', 'G2015010247', 'G2015010248', 'G2015010249', 'G2015010250', 'G2015010251', 'G2015010252', 'G2015010253', 'G2015010254', 'G2015010255', 'G2015010256', 'G2015010257', 'G2015010258', 'G2015010259', 'G2015010260', 'G2015010261', 'G2015010262', 'G2015010263', 'G2015010264', 'G2015010265', 'G2015010266', 'G2015010267', 'G2015010268', 'G2015010269', 'G2015010270', 'G2015010271', 'G2015010272', 'G2015010273', 'G2015010274', 'G2015010275', 'G2015010276', 'G2015010277', 'G2015010278', 'G2015010279', 'G2015010280', 'G2015010281', 'G2015010282', 'G2015010283', 'G2015010284', 'G2015010285', 'G2015010286', 'G2015010287', 'G2015010288', 'G2015010289', 'G2015010290', 'G2015010291', 'G2015010292', 'G2015010293', 'G2015010294', 'G2015010295', 'G2015010296', 'G2015010297', 'G2015010298', 'G2015010299', 'G2015010300', 'G2015010301', 'G2015010302', 'G2015010303', 'G2015010304', 'G2015010305', 'G2015010306', 'G2015010307', 'G2015010308', 'G2015010309', 'G2015010310', 'G2015010311', 'G2015010312', 'G2015010313', 'G2015010314', 'G2015010315', 'G2015010316', 'G2015010317', 'G2015010318', 'G2015010319', 'G2015010320', 'G2015010321', 'G2015010322', 'G2015010323', 'G2015010324', 'G2015010325', 'G2015010326', 'G2015010327', 'G2015010328', 'G2015010329', 'G2015010330', 'G2015010331', 'G2015010332', 'G2015010333', 'G2015010334', 'G2015010335', 'G2015010336', 'G2015010337', 'G2015010338', 'G2015010339', 'G2015010340', 'G2015010341', 'G2015010342', 'G2015010343', 'G2015010344', 'G2015010345', 'G2015010346', 'G2015010347', 'G2015010348', 'G2015010349', 'G2015010350', 'G2015010351', 'G2015010352', 'G2015010353', 'G2015010354', 'G2015010355', 'G2015010356', 'G2015010357', 'G2015010358', 'G2015010359', 'G2015010360', 'G2015010361', 'G2015010362', 'G2015010363', 'G2015010364', 'G2015010365', 'G2015010366', 'G2015010367', 'G2015010368', 'G2015010369', 'G2015010370', 'G2015010371', 'G2015010372', 'G2015010373', 'G2015010374', 'G2015010375', 'G2015010376', 'G2015010377', 'G2015010378', 'G2015010379', 'G2015010380', 'G2015010381', 'G2015010382', 'G2015010383', 'G2015010384', 'G2015010385', 'G2015010386', 'G2015010387', 'G2015010388', 'G2015010389', 'G2015010390', 'G2015010391', 'G2015010392', 'G2015010393', 'G2015010394', 'G2015010395', 'G2015010396', 'G2015010397', 'G2015010398', 'G2015010399', 'G2015010400', 'G2015010401', 'G2015010402', 'G2015010403', 'G2015010404', 'G2015010405', 'G2015010406', 'G2015010407', 'G2015010408', 'G2015010409', 'G2015010410', 'G2015010411', 'G2015010412', 'G2015010413', 'G2015010414', 'G2015010415', 'G2015010416', 'G2015010417', 'G2015010418', 'G2015010419', 'G2015010420', 'G2015010421', 'G2015010422', 'G2015010423', 'G2015010424', 'G2015010425', 'G2015010426', 'G2015010427', 'G2015010428', 'G2015010429', 'G2015010430', 'G2015010431', 'G2015010432', 'G2015010433', 'G2015010434', 'G2015010435', 'G2015010436', 'G2015010437', 'G2015010438', 'G2015010439', 'G2015010440', 'G2015010441', 'G2015010442', 'G2015010443', 'G2015010444', 'G2015010445', 'G2015010446', 'G2015010447', 'G2015010448', 'G2015010449', 'G2015010450', 'G2015010451', 'G2015010452', 'G2015010453', 'G2015010454', 'G2015010455', 'G2015010456', 'G2015010457', 'G2015010458', 'G2015010459', 'G2015010460', 'G2015010461', 'G2015010462', 'G2015010463', 'G2015010464', 'G2015010465', 'G2015010466', 'G2015010467', 'G2015010468', 'G2015010469', 'G2015010470', 'G2015010471', 'G2015010472', 'G2015010473', 'G2015010474', 'G2015010475', 'G2015010476', 'G2015010477', 'G2015010478', 'G2015010479', 'G2015010480', 'G2015010481', 'G2015010482', 'G2015010483', 'G2015010484', 'G2015010485', 'G2015010486', 'G2015010487', 'G2015010488', 'G2015010489', 'G2015010490', 'G2015010491', 'G2015010492', 'G2015010493', 'G2015010494', 'G2015010495', 'G2015010496', 'G2015010497', 'G2015010498', 'G2015010499', 'G2015010500', 'G2015010501', 'G2015010502', 'G2015010503', 'G2015010504', 'G2015010505', 'G2015010506', 'G2015010507', 'G2015010508', 'G2015010509', 'G2015010510', 'G2015010511', 'G2015010512', 'G2015010513', 'G2015010514', 'G2015010515', 'G2015010516', 'G2015010517', 'G2015010518', 'G2015010519', 'G2015010520', 'G2015010521', 'G2015010522', 'G2015010523', 'G2015010524', 'G2015010525', 'G2015010526', 'G2015010527', 'G2015010528', 'G2015010529', 'G2015010530', 'G2015010531', 'G2015010532', 'G2015010533', 'G2015010534', 'G2015010535', 'G2015010536', 'G2015010537', 'G2015010538', 'G2015010539', 'G2015010540', 'G2015010541', 'G2015010542', 'G2015010543', 'G2015010544', 'G2015010545', 'G2015010546', 'G2015010547', 'G2015010548', 'G2015010549', 'G2015010550', 'G2015010551', 'G2015010552', 'G2015010553', 'G2015010554', 'G2015010555', 'G2015010556', 'G2015010557', 'G2015010558', 'G2015010559', 'G2015010560', 'G2015010561', 'G2015010562', 'G2015010563', 'G2015010564', 'G2015010565', 'G2015010566', 'G2015010567', 'G2015010568', 'G2015010569', 'G2015010570', 'G2015010571', 'G2015010572', 'G2015010573', 'G2015010574', 'G2015010575', 'G2015010576', 'G2015010577', 'G2015010578', 'G2015010579', 'G2015010580', 'G2015010581', 'G2015010582', 'G2015010583', 'G2015010584', 'G2015010585', 'G2015010586', 'G2015010587', 'G2015010588', 'G2015010589', 'G2015010590', 'G2015010591', 'G2015010592', 'G2015010593', 'G2015010594', 'G2015010595', 'G2015010596', 'G2015010597', 'G2015010598', 'G2015010599', 'G2015010600', 'G2015010601', 'G2015010602', 'G2015010603', 'G2015010604', 'G2015010605', 'G2015010606', 'G2015010607', 'G2015010608', 'G2015010609', 'G2015010610', 'G2015010611', 'G2015010612', 'G2015010613', 'G2015010614', 'G2015010615', 'G2015010616', 'G2015010617', 'G2015010618', 'G2015010619', 'G2015010620', 'G2015010621', 'G2015010622', 'G2015010623', 'G2015010624', 'G2015010625', 'G2015010626', 'G2015010627', 'G2015010628', 'G2015010629', 'G2015010630', 'G2015010631', 'G2015010632', 'G2015010633', 'G2015010634', 'G2015010635', 'G2015010636', 'G2015010637', 'G2015010638', 'G2015010639', 'G2015010640', 'G2015010641', 'G2015010642', 'G2015010643', 'G2015010644', 'G2015010645', 'G2015010646', 'G2015010647', 'G2015010648', 'G2015010649', 'G2015010650', 'G2015010651', 'G2015010652', 'G2015010653', 'G2015010654', 'G2015010655', 'G2015010656', 'G2015010657', 'G2015010658', 'G2015010659', 'G2015010660', 'G2015010661', 'G2015010662', 'G2015010663', 'G2015010664', 'G2015010665', 'G2015010666', 'G2015010667', 'G2015010668', 'G2015010669', 'G2015010670', 'G2015010671', 'G2015010672', 'G2015010673', 'G2015010674', 'G2015010675', 'G2015010676', 'G2015010677', 'G2015010678', 'G2015010679', 'G2015010680', 'G2015010681', 'G2015010682', 'G2015010683', 'G2015010684', 'G2015010685', 'G2015010686', 'G2015010687', 'G2015010688', 'G2015010689', 'G2015010690', 'G2015010691', 'G2015010692', 'G2015010693', 'G2015010694', 'G2015010695', 'G2015010696', 'G2015010697', 'G2015010698', 'G2015010699', 'G2015010700']; $bulkInsertArray = array(); foreach ($projectNames as $name) { $bulkInsertArray[] = ['name' => $name]; } Yii::$app->db->createCommand()->batchInsert(Project::tableName(), ['name'], $bulkInsertArray)->execute(); }
public function actionDeleteproject($id) { $deleteProjectQuery = Project::deleteAll('ID=' . $id); $deletePaymentQuery = ProjectPayment::deleteAll('projectID=' . $id); if ($deleteProjectQuery) { Yii::$app->getSession()->setFlash('success', 'Project has been deleted successfully'); return $this->redirect(['index']); } }
public function addCommentToProject($id, array $input) { $project = Project::find($id); $mainComment = new Comment(); $mainComment->fill($input); $project->comments()->save($mainComment); $this->linkToCurrentUser($mainComment); return $mainComment; }
public function actionIndex() { if (Yii::$app->user->isGuest) { return $this->render('index'); } else { $projects = Project::find()->byOwner(\Yii::$app->user->identity->id)->all(); return $this->render('dashboard', ['projects' => $projects]); } }