->joinWith(['idClient' => function($q){
$q->from(['client' => Client::tableName()]);
}])
->joinWith(['idSotrud' => function($q){
$q->from(['sotrud' => Personnel::tableName()]);
}])
->innerJoinWith(['idShipping', 'idSotrud', 'tags', 'financies', 'idClient', 'shifts.idSotrud', 'idAutsors', 'zakazTag'])
->joinWith(['idClient' => function($q){
$q->from(['client' => Client::tableName()]);
},
'idSotrud' => function($q){
$q->from(['sotrud' => Personnel::tableName()]);
}])
public function getIdClient()
{
return $this->hasOne(Client::className(), ['id' => 'id_client']);
}
public static function tableName()
{
return 'client';
}
public function attributeLabels()
{
return [
'id' => 'ID',
'last_name' => 'Фамилия',
'name' => 'Имя',
'patronymic' => 'Отчество',
'phone' => 'Телефон',
'email' => 'Email',
'street' => 'Улица',
'home' => 'Дом',
'apartment' => 'Квартира',
'fioClient' => 'ФИО',
];
}
$query = Zakaz::find()->select([
'zakaz.id_zakaz',
...
'client.name',
'client.phone',
'client.email',
...
])
->with([...'idClient', ...])
jQuery(document).on("submit", "#w3-pjax form[data-pjax]", function (event) {jQuery.pjax.submit(event, {"push":true,"replace":false,"timeout":1000,"scrollTo":false,"container":"#w3-pjax"});});
jQuery(document).pjax("#pjax-customAdop a", {"push":true,"replace":false,"timeout":1000,"scrollTo":false,"container":"#pjax-customAdop"});
jQuery(document).on("submit", "#pjax-customAdop form[data-pjax]", function (event) {jQuery.pjax.submit(event, {"push":true,"replace":false,"timeout":1000,"scrollTo":false,"container":"#pjax-customAdop"});});
router.post('/', (req, res) => {
User.register({username: req.body.username}, req.body.password, (err, user) => {
if (err){
return res.render('index', {message: err});
}
User.authenticate('username', 'password', (err, result) => {
if(err){
return res.render('index', {message: err});
}
console.log(result);
res.redirect('/users');
});
});
});
UserExistsError: Данный пользовательуже зарегестрировался
router.post('/', (req, res) => {
User.authenticate(req.body.username, req.body.password, (err, result) => {
if (err) {
console.log(err);
return res.render('index', {message: err});
}
passport.authenticate('local')(req, res, function () {
console.log(result);
res.redirect('/users');
});
});
});