public function run() { $faker = Faker\Factory::create(); foreach (range(1, 30) as $index) { Firm::create(['firm_name' => $faker->company, 'location_id' => rand(1, 30)]); $this->command->info('Firm table seeded!'); } }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ public function create(array $data) { $user = null; DB::transaction(function () use($data, &$user) { $firm = new Firm(); $firm->full_organisation_name = $data['full_organisation_name']; $firm->organisation_name = $data['organisation_name']; $firm->okpo = $data['okpo']; $firm->ogrn = $data['ogrn']; $firm->inn = $data['inn']; $firm->kpp = $data['kpp']; $firm->rs = $data['rs']; $firm->bik = $data['bik']; $firm->bank = $data['bank']; $firm->ks = $data['ks']; $firm->face_position = $data['face_position']; $firm->face_fio = $data['face_fio']; $firm->base_document = $data['base_document']; $firm->place_address = $data['place_address']; $firm->post_address = $data['post_address']; $firm->contact_face_fio = $data['contact_face_fio']; $firm->phone = $data['phone']; $firm->save(); // $user = User::create([ // 'name' => $data['name'], // 'email' => $data['email'], // 'password' => bcrypt($data['password']), // 'firm_id' => $firm->id, // 'role_id' => Role::CLIENT // ]); $user = new User(); $user->name = $data['name']; $user->email = $data['email']; $user->password = bcrypt($data['password']); $user->firm_id = $firm->id; $user->role_id = Role::CLIENT; $user->save(); }); return $user; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Firm::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, 'address_id' => $this->address_id, 'svid_date' => $this->svid_date, 'rec_status_id' => $this->rec_status_id, 'user_id' => $this->user_id, 'dc' => $this->dc]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'full_name', $this->full_name])->andFilterWhere(['like', 'okpo', $this->okpo])->andFilterWhere(['like', 'director', $this->director])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'bank_name', $this->bank_name])->andFilterWhere(['like', 'bank_mfo', $this->bank_mfo])->andFilterWhere(['like', 'bank_rs', $this->bank_rs])->andFilterWhere(['like', 'svid_num', $this->svid_num])->andFilterWhere(['like', 'svid_who_give', $this->svid_who_give])->andFilterWhere(['like', 'note', $this->note]); return $dataProvider; }
/** * Display a listing of the resource. * * @return Response */ public function index(Region $region, TrainRoad $trainRoad, Stantion $stantion) { $regionsCount = $region->count(); $tRoadsCount = $trainRoad->count(); $stationsCount = $stantion->count(); $condCount = Condition::count(); $productsCount = Product::count(); $servicesCount = Service::count(); $catCount = Category::count(); $statusesCount = Status::count(); $serviceStatusesCount = ServiceStatus::count(); $newOrdersCount = Order::where('is_new', 1)->count(); $newServiceOrdersCount = ServiceOrder::where('is_new', 1)->count(); $customers = Firm::where('accountant_fio', null)->get(); return view('admin.adminArea', ['regionsCount' => $regionsCount, 'tRoadsCount' => $tRoadsCount, 'stationsCount' => $stationsCount, 'condCount' => $condCount, 'catCount' => $catCount, 'productsCount' => $productsCount, 'servicesCount' => $servicesCount, 'statusesCount' => $statusesCount, 'newOrdersCount' => $newOrdersCount, 'serviceStatusesCount' => $serviceStatusesCount, 'newServiceOrdersCount' => $newServiceOrdersCount, 'customers' => $customers]); }
?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'email')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'phone')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'firm_id')->dropDownList(ArrayHelper::map(\app\models\Firm::find()->active()->orderBy('name asc')->all(), 'id', 'name'), ['prompt' => '']); ?> <?php echo $form->field($model, 'workplace_id')->dropDownList(ArrayHelper::map(\app\models\Workplace::find()->active()->all(), 'id', 'name'), ['prompt' => '']); ?> <?php echo $form->field($model, 'note')->textarea(['rows' => 6]); ?> <?php echo $form->field($model, 'rec_status_id')->radioList(ArrayHelper::map(\app\models\RecStatus::find()->active()->all(), 'id', 'name'), ['class' => 'btn-group', 'data-toggle' => 'buttons', 'unselect' => null, 'item' => function ($index, $label, $name, $checked, $value) { return '<label class="btn btn-default' . ($checked ? ' active' : '') . '">' . Html::radio($name, $checked, ['value' => $value, 'class' => 'project-status-btn']) . $label . '</label>'; }]); ?>
/** * Finds the Firm model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Firm the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Firm::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getFirms() { return $this->hasMany(Firm::className(), ['user_id' => 'id']); }
public function showServiceFilteredOrdersToAdmin(Request $request) { $firmId = (int) $request->customer_firm; if (!$firmId) { return redirect('fatal_error')->with('alert-danger', 'Запрашиваемой организации не найдено'); } $firm = Firm::find($firmId); $orders = ServiceOrder::latest('created_at')->with('service_status', 'firm')->where('firm_id', $firmId)->get(); return view('orders.showServiceOrdersToAdmin', ['orders' => $orders, 'newOnly' => false, 'firm' => $firm->organisation_name]); }
/** * @return \yii\db\ActiveQuery */ public function getFirm() { return $this->hasOne(Firm::className(), ['id' => 'firm_id']); }
public function uploadServiceAgreementFromClient(Document $document, Requests\UploadOferta $request) { $file = $request->file('docFileName'); //Сам файл $firm = Firm::with('user')->where('id', $request->firmId)->first(); if ($pathToFile = Bus::dispatch(new UploadServiceAgreement($file, $firm))) { return redirect()->back()->with('alert-success', 'Файл загружен.'); } else { return redirect()->back()->withInput()->with('alert-danger', 'Ошибка загрузки файла. Файл не загружен.'); } }
use yii\grid\GridView; /* @var $this yii\web\View */ /* @var $searchModel app\models\searches\VacancySearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Yii::t('app', 'Vacancies'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="vacancy-index"> <p class='pull-left'> <?php echo \Yii::$app->user->can('/vacancy/create') ? \yii\helpers\Html::a('<span class="glyphicon glyphicon-plus"></span> ' . Yii::t('app', 'Create new'), ['create'], ['class' => 'btn btn-success']) : ''; ?> </p> <div class="clearfix"></div> <?php \yii\widgets\Pjax::begin(); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'firm_id' => ['attribute' => 'firm_id', 'value' => 'firm.name', 'filter' => ArrayHelper::map(\app\models\Firm::find()->active()->orderBy('name')->all(), 'id', 'name')], 'profession_id' => ['attribute' => 'profession_id', 'value' => 'profession.name', 'filter' => ArrayHelper::map(\app\models\Profession::find()->active()->orderBy('name')->all(), 'id', 'name')], 'date', 'salary', ['class' => 'yii\\grid\\ActionColumn', 'contentOptions' => ['style' => 'white-space: nowrap;']]], 'tableOptions' => ['class' => 'table table-striped table-hover']]); ?> <?php \yii\widgets\Pjax::end(); ?> </div>
</div> <div style="padding: 10px;"> <?php echo $form->field($model, 'svid_num')->textInput(['maxlength' => true]); ?> <?php //echo $form->field($model, 'svid_date')->textInput() ?> <?php echo $form->field($model, 'svid_date')->widget(\dosamigos\datepicker\DatePicker::className(), ['language' => 'ru', 'options' => ['class' => 'form-control', 'autocomplete' => 'off'], 'clientOptions' => ['forceParse' => true, 'todayBtn' => true, 'clearBtn' => true, 'autoclose' => true, 'todayHighlight' => true, 'format' => 'dd.mm.yyyy']]); ?> <?php //echo $form->field($model, 'svid_who_give')->textInput(['maxlength' => true]) ?> <?php echo $form->field($model, 'svid_who_give')->widget(\yii\jui\AutoComplete::classname(), ['options' => ['class' => 'form-control'], 'clientOptions' => ['source' => \app\models\Firm::find()->select(['svid_who_give as value'])->active()->distinct()->orderBy('svid_who_give asc')->asArray()->all(), 'autoFocus' => true, 'minLength' => '1', 'delay' => '100']]); ?> </div> </div> <div class="panel panel-default"> <div class="panel-heading" style="margin-bottom: 20px;"> <h3 class="panel-title"><?php echo 'Прочее'; ?> </h3> </div> <div style="padding: 10px;"> <?php echo $form->field($model, 'note')->textarea(['rows' => 6]); ?>