/** * This command echoes what you have entered as the message. * * @param string $message the message to be echoed. */ public function actionIndex($message = 'Million') { $card = new Card(); // $post = Yii::$app->request->post(); // if (!empty($post)) $new = false; // $card->load($post); // $count = $card->count; $c = 50; $card->sum = 0; $card->status = 0; $cdate = Yii::$app->formatter->asDatetime(new \DateTime(), 'Y-MM-dd HH:i:s'); $card->sn = '1000000'; $card->activity_date = $cdate; $card->deactivation_date = $cdate; $card->creation_date = $cdate; if ($card->validate()) { while ($c-- > 0) { $newcard = new Card($card); $newcard->count = 1; $newcard->sum = rand(1, 1000000); $newcard->save(); echo $c . "\r"; } } else { var_dump($card->errors); } //return $this->render('generator', $param); echo $message . "\n"; }
public function afterSave($insert, $changedAttributes) { /** * @var Card $card ; */ $card = Card::findOne(['no' => $this->card]); $card->activity_date = Yii::$app->formatter->asDatetime(new \DateTime(), 'Y-MM-d HH:i:s'); $card->save(); }
public function actionDelete() { $id = (int) Yii::$app->request->post('id'); /** @var Card $card */ $card = Card::findOne(['id' => $id]); $result = $card ? $card->delete() : false; Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; return ['result' => (bool) $result]; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Card::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { return false; } $query->andFilterWhere(['number' => $this->number, 'issue_date' => $this->issue_date, 'expiration_date' => $this->expiration_date, 'use_date' => $this->use_date, 'amount' => $this->amount, 'status' => $this->status]); $query->andFilterWhere(['like', 'serial', $this->serial]); return $dataProvider; }
/** * Display a listing of the resource. * * @return Response */ public function index() { $data['colors'] = array('red', 'yellow', 'aqua', 'blue', 'light-blue', 'green', 'navy', 'teal', 'olive', 'lime', 'orange', 'fuchsia', 'purple', 'maroon', 'black', 'red-active', 'yellow-active', 'aqua-active', 'blue-active', 'light-blue-active', 'green-active', 'navy-active', 'teal-active', 'olive-active', 'lime-active', 'orange-active', 'fuchsia-active', 'purple-active', 'maroon-active', 'black-active'); $data['statics'] = Project::get_statics(); if (Auth::user()->group_id == 3) { $data['acards'] = Card::get_cards(Auth::getUser()->id); return view('partnerdashboard', $data); } else { $data['oprojects'] = Project::get_projects(1); $data['cprojects'] = Project::get_projects(2); return view('home', $data); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Card::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'seriesId' => $this->seriesId, 'number' => $this->number, 'issueDateTime' => $this->issueDateTime, 'endingDateTime' => $this->endingDateTime, 'lastDateOfUse' => $this->lastDateOfUse, 'currentSumm' => $this->currentSumm, 'statusId' => $this->statusId]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Card::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['number' => $this->number, 'expires_date' => $this->expires_date, 'release_date' => $this->release_date, 'using_date' => $this->using_date, 'cash' => $this->cash]); $query->andFilterWhere(['like', 'serial', $this->serial]); return $dataProvider; }
public function actionSearch() { $card = Card::find(); if (isset($_POST['no']) && !empty($_POST['no'])) { $no = $_POST['no']; $card->where(['no' => $no]); } $cnt = clone $card; $pages = new Pagination(['totalCount' => $cnt->count()]); $pg = isset($_GET['page']) ? $_GET['page'] : 1; \Yii::$app->session->set('pg', $pg); $pages->pageSize = 10; $cards = $card->offset($pages->offset)->limit($pages->limit)->all(); return $this->render('search', ['cards' => $cards, 'pages' => $pages]); }
public function search($params) { $query = Card::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { // $query->joinWith('cardStatus'); return $dataProvider; } $sort = $dataProvider->getSort(); $sort->attributes['attributes']['status'] = ['asc' => ['card.status' => SORT_ASC], 'desc' => ['card.status' => SORT_DESC], 'label' => 'Статус', 'default' => SORT_ASC]; $dataProvider->setSort($sort); $query->andFilterWhere(['no' => $this->no, 'creation_date' => $this->creation_date, 'deactivation_date' => $this->deactivation_date, 'activity_date' => $this->activity_date, 'sum' => $this->sum, 'status' => $this->status]); $query->andFilterWhere(['like', 'sn', $this->sn]); return $dataProvider; }
public function delMember($id) { if (!Auth::check()) { return redirect("/"); } $memberID = \Input::get('memberID'); $member = Membermanagement::find($memberID); $member->active = 1; $member->save(); $board = Board::find($id); $boardManager = $board->manager_id; $MemMa = Membermanagement::where('User_id', '=', $boardManager)->where('Board_id', '=', $id)->get(); $cards = Card::where('MemberManagement_id', '=', $member->id)->get(); foreach ($cards as $card) { $card->MemberManagement_id = $MemMa[0]->id; $card->save(); } return redirect("member/{$id}"); }
public function up() { $tableOptions = null; if ($this->db->driverName === 'mysql') { $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB'; } // * серия карты // * номер карты // * дата выпуска карты // * дата окончания активности карты // * дата использования // * сумма // * статус карты (не активирована/активирована/просрочена) $this->createTable('{{%serial}}', ['id' => $this->primaryKey(), 'serial' => $this->string(20)->notNull(), 'release_date' => $this->dateTime()->notNull(), 'duration' => "enum ('" . implode("','", array_keys(Serial::getDurations())) . "') not null"], $tableOptions); $this->createIndex('serial_uniq', '{{%serial}}', ['serial'], true); $this->createTable('{{%card}}', ['id' => $this->primaryKey(), 'serial_id' => $this->integer()->notNull(), 'number' => $this->integer()->notNull(), 'begin_date' => $this->dateTime()->defaultValue(null), 'end_date' => $this->dateTime()->defaultValue(null), 'amount' => $this->money()->notNull()->defaultValue(0), 'status' => "enum ('" . implode("','", array_keys(Card::getStatuses())) . "') not null default '" . Card::STATUS_NEW . "'"], $tableOptions); $this->createIndex('serial_number_uniq', '{{%card}}', ['serial_id', 'number'], true); $this->addForeignKey('FK_card_serial', '{{%card}}', 'serial_id', '{{%serial}}', 'id'); }
public function search($params) { $query = Card::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['attributes' => ['id', 'number', 'begin_date', 'end_date', 'status', 'serialDuration' => ['asc' => ['serial.duration' => SORT_ASC], 'desc' => ['serial.duration' => SORT_DESC]], 'serialReleaseDate' => ['asc' => ['serial.release_date' => SORT_ASC], 'desc' => ['serial.release_date' => SORT_DESC]], 'serialSerial' => ['asc' => ['serial.serial' => SORT_ASC], 'desc' => ['serial.serial' => SORT_DESC]]]], 'pagination' => ['pageSize' => 10]]); if (!($this->load($params) && $this->validate())) { $query->joinWith(['serial']); return $dataProvider; } $query->andFilterWhere(['card.id' => $this->id]); $query->andFilterWhere(['card.number' => $this->number]); $query->andFilterWhere(['card.status' => $this->status]); $this->filterDate($query, 'begin_date', $this->begin_date); $this->filterDate($query, 'end_date', $this->end_date); $query->joinWith(['serial' => function ($q) { $q->andFilterWhere(['like', 'serial.serial', $this->serialSerial]); $q->andFilterWhere(['serial.duration' => $this->serialDuration]); $this->filterDate($q, 'serial.release_date', $this->serialReleaseDate); }]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getCard() { return $this->hasOne(Card::className(), ['id' => 'card_id']); }
/** * @return \yii\db\ActiveQuery */ public function getCards() { return $this->hasMany(Card::className(), ['seriesId' => 'id']); }
$listData = ArrayHelper::map($grade_level, 'id', 'name'); $listData2 = ArrayHelper::map($school_year, 'id', 'sy'); $listData3 = ArrayHelper::map($section, 'id', 'section_name'); $listData4 = ArrayHelper::map($status, 'id', 'status'); $state = false; $avatar = Yii::$app->request->baseUrl . Yii::$app->params['avatar']; !$model->isNewRecord ? !empty($model->student->students_profile_image) ? $img = Yii::$app->request->baseUrl . '/uploads/students/' . $model->student->students_profile_image : ($img = $avatar) : ''; !$model->isNewRecord ? !empty(trim($model->student->middle_name)) ? $middle = ucfirst(substr($model->student->middle_name, 0, 1)) . '.' : ($middle = '') : ''; !$model->isNewRecord ? $this->title = implode(' ', [$model->student->first_name, $middle, $model->student->last_name]) : 'New'; $model->isNewRecord ? $this->title = 'New' : ($this->title = implode(' ', [$model->student->first_name, $middle, $model->student->last_name])); $form = ActiveForm::begin(); ?> <div class="ui three column stackable grid"> <div class="four wide rounded column"> <?php echo Card::render($options = ['imageContent' => !$model->isNewRecord ? !empty($model->student->students_profile_image) ? ['/file', 'id' => $model->student->students_profile_image] : Yii::$app->request->baseUrl . Yii::$app->params['avatar'] : Yii::$app->request->baseUrl . Yii::$app->params['avatar'], 'labelContent' => !$model->isNewRecord ? implode(' ', ['ID#', '<strong>', $student->id, '</strong>']) : ' ', 'labelFor' => 'Student ID', 'labelOptions' => '', 'headerContent' => !$model->isNewRecord ? DataHelper::name($model->student->first_name, $model->student->middle_name, $model->student->last_name) : ' ', 'headerOptions' => '', 'metaContent' => !$model->isNewRecord ? implode('', ['\'', $model->student->nickname, '\'']) : ' ', 'metaOptions' => '', 'leftFloatedContent' => !$model->isNewRecord ? DataHelper::gradeLevel($model->student->grade_level_id) : ' ', 'leftFloatedFor' => 'Grade Level', 'leftFloatedOptions' => '', 'rightFloatedContent' => '', 'rightFloatedOptions' => !$model->isNewRecord ? $model->student->sped === 0 ? '' : 'hidden' : 'hidden']); ?> </div> <div class="nine wide rounded column"> <div class="ui segment"> <?php echo !$model->isNewRecord ? Html::tag('label', implode('', [implode('-', array_map('ucfirst', explode('-', Yii::$app->controller->id))), '# ', $model->id]), ['class' => 'ui fluid big label']) : ''; ?> <br> <br> <?php if ($model->isNewRecord) { ?> <?php } else {
public function removeComment($commentID, $cardID) { if (!Auth::check()) { return redirect("/"); } $delChecklist = Comment::where('id', '=', $commentID); $delChecklist->delete(); $card = Card::with(['checklists', 'memberCard.member', 'comments.memberComment', 'preCard'])->find($cardID); return $card; }
/** * Card generator * @return mixed */ public function actionGenerator() { $model = new Card(); if ($model->load(Yii::$app->request->post())) { //Получаем данные для генреации из post $qty = Yii::$app->getRequest()->post('qty'); $expires = ArrayHelper::getValue(Yii::$app->request->post(), 'Card.expires_date'); $serial = ArrayHelper::getValue(Yii::$app->request->post(), 'Card.serial'); //делаем bullk insert for ($i = 1; $i <= $qty; $i++) { Yii::$app->db->createCommand()->batchInsert('card', ['serial', 'expires_date'], [[$serial, $expires]])->execute(); } return $this->redirect(['index', 'id' => $model->number]); } else { return $this->render('generator', ['model' => $model]); } }
$sy_list = ArrayHelper::map($school_year, 'id', 'sy'); $teacher_list = ArrayHelper::map($teacher, 'id', 'last_name'); $grade_level_list = ArrayHelper::map($grade_level, 'id', 'name'); $section_list = ArrayHelper::map($section, 'id', 'section_name'); $subject_list = ArrayHelper::map($subject, 'id', 'subject_name'); $card_url = json_encode(Yii::$app->request->baseUrl . '/site/tcard?data='); $this->title = 'New'; ?> <br> <?php $form = ActiveForm::begin(['class' => 'ui loading form']); ?> <div class="ui three column stackable grid"> <div class="four wide rounded column"> <?php echo Card::render($options = ['imageContent' => !$model->isNewRecord ? !empty($model->teacher->profile_image) ? ['/file', 'id' => $model->teacher->profile_image] : Yii::$app->params['avatar'] : Yii::$app->request->baseUrl . Yii::$app->params['avatar'], 'labelContent' => !$model->isNewRecord ? implode(' ', ['ID#', '<strong>', $model->teacher->id, '</strong>']) : ' ', 'labelFor' => 'Teacher ID', 'labelOptions' => '', 'headerContent' => !$model->isNewRecord ? DataHelper::name($model->teacher->first_name, $model->teacher->middle_name, $model->teacher->last_name) : ' ', 'headerOptions' => '', 'metaContent' => !$model->isNewRecord ? implode('', ['\'', $model->teacher->username, '\'']) : ' ', 'metaOptions' => '', 'leftFloatedContent' => !$model->isNewRecord ? implode('', [DataHelper::gradeLevel($model->grade_level_id), '<p style="color: rgba(0,0,0,.4);"><span style="font-size: 11px;">', DataHelper::schoolYear($model->sy_id), '</span><br/>Adviser', '</p>']) : ' ', 'leftFloatedFor' => '', 'leftFloatedOptions' => '', 'rightFloatedContent' => '', 'rightFloatedOptions' => 'hidden']); ?> </div> <div class="nine wide rounded column"> <div class="ui segment"> <?php echo !$model->isNewRecord ? Html::tag('label', implode('', [implode('-', array_map('ucfirst', explode('-', Yii::$app->controller->id))), '# ', $model->id]), ['class' => 'ui fluid big label']) : ''; ?> <br><br> <div class="row"> <div class="col-lg-4 col-md-4 col-sm-12"> <?php echo $form->field($model, 'sy_id', ['inputTemplate' => '<label>School Year</label>{input}'])->dropDownList(ArrayHelper::map(SchoolYear::find()->orderBy(['id' => SORT_DESC])->all(), 'id', 'sy'), ['class' => 'form-control pva-form-control'])->label(false); ?> </div> </div>
use app\models\Options; use app\models\DataHelper; /* @var $tris yii\web\View */ /* @var $model app\models\GradeOneForm */ /* @var $form yii\widgets\ActiveForm */ $this->title = DataHelper::name($models[0]->enrolled->student->first_name, $models[0]->enrolled->student->middle_name, $models[0]->enrolled->student->last_name); $avatar = Yii::$app->request->baseUrl . Yii::$app->params['avatar']; ?> <br> <?php $form = ActiveForm::begin(); ?> <div class="ui three column stackable grid"> <div class="four wide rounded column"> <?php echo Card::render($options = ['imageContent' => !empty($models[0]->enrolled->student->students_profile_image) ? Yii::$app->request->baseUrl . '/file?id=' . $models[0]->enrolled->student->students_profile_image : $avatar, 'labelContent' => implode(' ', ['ID#', $models[0]->enrolled->student->id]), 'labelFor' => 'ID', 'labelOptions' => '', 'headerContent' => DataHelper::name($models[0]->enrolled->student->first_name, $models[0]->enrolled->student->middle_name, $models[0]->enrolled->student->last_name), 'headerOptions' => '', 'metaContent' => ' ', 'metaOptions' => '', 'leftFloatedContent' => 'Grade 1', 'leftFloatedFor' => 'Grade Level', 'leftFloatedOptions' => '', 'rightFloatedContent' => '', 'rightFloatedOptions' => !$models[0]->enrolled->student->sped === 0 ? '<div class="ui star rating" data-max-rating="1"><div class="icon active" style="font-size: 16px;"></div></div>' : 'hidden']); ?> </div> <div class="nine wide rounded column"> <div class="column"> <div class="ui segment"> <table class="ui celled striped small table"> <thead> <tr> <th> </th> <th>First</th> <th>Second</th> <th>Third</th> <th>Fourth</th> </tr> </thead>
public function getCards() { return $this->hasMany(Card::className(), ['id' => 'card_id'])->viaTable('deck_has_cards', ['deck_id' => 'id']); }
/* @var $searchModel \app\models\CardSearch */ use yii\grid\GridView; use yii\helpers\Html; use yii\jui\DatePicker; use app\models\Card; use app\models\Serial; $this->title = 'Карты'; $this->params['breadcrumbs'][] = ''; $js = <<<JS \$('.card-delete').on('click', function(event){ event.preventDefault(); var self = \$(this); \$.post('/card/delete', {id:self.data('id')}) .done(function(data){ if (data.result==true) { self.parents('tr').remove(); } }); }); JS; $this->registerJs($js); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'layout' => '{items}{pager}', 'columns' => ['id', ['attribute' => 'serialSerial', 'value' => 'serial.serial'], 'number', ['attribute' => 'serialReleaseDate', 'value' => 'serial.release_date', 'filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'serialReleaseDate', 'options' => ['class' => 'form-control'], 'dateFormat' => 'yyyy-MM-dd'])], ['attribute' => 'end_date', 'filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'end_date', 'options' => ['class' => 'form-control'], 'dateFormat' => 'yyyy-MM-dd'])], ['attribute' => 'status', 'format' => 'raw', 'value' => function ($data) { return Html::a($data->statusText, ['/card/update', 'id' => $data->id], ['class' => 'book-view']); }, 'filter' => Html::activeDropDownList($searchModel, 'status', Card::getStatuses(), ['class' => 'form-control', 'prompt' => ''])], ['class' => \yii\grid\ActionColumn::class, 'header' => 'Действия', 'headerOptions' => ['width' => '150'], 'template' => '{view} {delete}', 'buttons' => ['delete' => function ($url, $model) { return Html::a('Удалить', null, ['class' => 'card-delete', 'data-id' => $model->id]); }, 'view' => function ($url, $model) { return Html::a('Просмотр', $url, ['class' => 'book-view']); }]]]]);
/** * Deletes an existing Sales model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param string $id * @return mixed */ public function actionDelete($id) { /** * @var Sales $sale * @var Card $card */ $sale = Sales::findOne(['id', $id]); $card = Card::findOne(['no', $sale->card]); $card->sum = intval($card->sum) + intval($sale->sum); $card->save(); $this->findModel($id)->delete(); return $this->redirect(['index']); }
public function rules() { return [[['status', 'old_status'], 'required'], [['status', 'old_status'], 'in', 'range' => array_keys(Card::getStatuses())]]; }
use yii\helpers\ArrayHelper; use kartik\select2\Select2; use yii\helpers\Html; use yii\bootstrap\ActiveForm; $avatar = Yii::$app->request->baseUrl . Yii::$app->params['avatar']; !$model->isNewRecord ? !empty($model->student->students_profile_image) ? $img = Yii::$app->request->baseUrl . '/file?id=' . $model->student->students_profile_image : ($img = $avatar) : ''; $card_url = json_encode(Yii::$app->request->baseUrl . '/site/card?data='); ?> <?php $form = ActiveForm::begin(); ?> <div class="ui three column stackable grid"> <div class="four wide rounded column"> <?php echo Card::render($options = ['imageContent' => !$model->isNewRecord ? $img : $avatar, 'labelContent' => !$model->isNewRecord ? implode(' ', ['ID#', '<strong>', $model->student->id, '</strong>']) : ' ', 'labelFor' => 'Enrollee ID', 'labelOptions' => '', 'headerContent' => !$model->isNewRecord ? implode(' ', [$model->student->first_name, $model->student->middle_name, $model->student->last_name]) : ' ', 'headerOptions' => '', 'metaContent' => !$model->isNewRecord ? implode('', ['\'', $model->student->nickname, '\'']) : ' ', 'metaOptions' => '', 'leftFloatedContent' => !$model->isNewRecord ? DataHelper::gradeLevel($model->student->grade_level_id) : ' ', 'leftFloatedFor' => 'Grade Level', 'leftFloatedOptions' => '', 'rightFloatedContent' => '', 'rightFloatedOptions' => !$model->isNewRecord ? $model->student->sped === 0 ? '' : 'hidden' : 'hidden']); ?> </div> <div class="nine wide rounded column"> <div class="ui segment"> <?php echo !$model->isNewRecord ? Html::tag('label', implode('', [implode('-', array_map('ucfirst', explode('-', Yii::$app->controller->id))), '# ', $model->id, '<br><br>']), ['class' => 'ui fluid big label']) : ''; ?> <div class="ui two column stackable grid"> <div class="eight wide column"> <?php echo $form->field($model, 'transaction', ['inputTemplate' => '<div style="margin-top: 0;"><label style="padding: 0; color: #555; font-weight: 600;">Card</label><div class="pull-right">{input}</div></div>'])->checkbox($options = ['class' => 'js-switch', 'data-switchery' => true, 'value' => $model->isNewRecord ? 1 : $model->transaction])->label(false); ?> </div> </div> <div class="ui two column stackable grid">
/** * Get the assigned vle for the specified card with sector and district * params @int $id * * return array */ public static function get_partners($id, $sid) { $partners = Card::select('users.*'); $partners->leftjoin('partner_district_sector', function ($join) use($sid) { $join->on('partner_district_sector.district_id', '=', static::$c_district_id); $join->where('partner_district_sector.sector_id', '=', $sid); }); $partners->join('users', 'users.id', '=', 'partner_district_sector.partner_id', 'left'); $partners->where(static::$c_id, $id); $partners->where('group_id', 3); $partners->orderby(static::$u_name, 'asc'); return $partners->get(); }
echo $form->field($model, 'sn')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'creation_date')->widget(\kartik\widgets\DateTimePicker::className(), $params); ?> <?php echo $form->field($model, 'deactivation_date')->widget(\kartik\widgets\DateTimePicker::className(), $params); ?> <?php echo $form->field($model, 'sum')->textInput(['maxlength' => 20]); ?> <?php echo $form->field($model, 'status')->dropDownList([Card::StatusArray()]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>
protected function getCardOptions() { $card_options_tmp = Card::find()->where(['is not', 'cost', null])->all(); foreach ($card_options_tmp as $card) { $card_options[$card['id']] = $card['name']; } return $card_options; }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update(CampRequest $request, $card_id, $id) { $timeline[$this->action] = 'update'; $options['0'] = 'Planned'; $options['1'] = 'Completed'; $options['2'] = 'Incompleted'; $options['3'] = 'In Progress'; Card::findOrFail($card_id); $camp = Camp::findOrFail($id); $input = $request->except('image'); $input['start_date'] = Carbon\Carbon::parse($request->get('start_date'))->format('Y-m-d'); $input['end_date'] = Carbon\Carbon::parse($request->get('end_date'))->format('Y-m-d'); $input['geoPoint'] = DB::raw("GeomFromText('POINT({$request->latitude} {$request->longitude})' )"); $input[$this->card_id] = $card_id; if ($camp->status != $input[$this->status]) { $timeline[$this->description] = '<a href="javascript:;">' . Auth::user()->first_name . ' ' . Auth::user()->last_name . '</a> changed the ' . $camp->name . ' camp status to ' . $options[$input[$this->status]] . '.'; } else { $timeline[$this->description] = '<a href="javascript:;">' . $camp->name . '</a> camp has been updated by ' . Auth::user()->first_name . ' ' . Auth::user()->last_name . '.'; } $camp->fill($input); $camp->save(); Session::flash($this->success, Lang::get('ruban.camp.updated')); $timeline['object_type'] = 4; $timeline[$this->object_id] = $id; Timeline::create($timeline); return Redirect::route('ruban.cards.show', array($card_id)); }
/** * @return \yii\db\ActiveQuery */ public function getCards() { return $this->hasMany(Card::className(), ['status' => 'value']); }
public static function get_cardpayouts($project_id, $status = false) { $cardpayouts = Card::where('project_id', $project_id); if ($status) { $cardpayouts->where('status', $status); } return $cardpayouts->count(); }