For Programming
6 subscribers
4 photos
1 video
12 links
Download Telegram
Forwarded from Ustoz-Shogird Darslari
This media is not supported in your browser
VIEW IN TELEGRAM
cakeresume.com - rezyume qilish uchun qulay sayt

Bu saytda professional shablon va formatlarni taqdim etadi. PDF rezyumeni bepul yuklab oling yoki chop eting yoki unga havolani ulashing.

👉@UstozShogird Darslari
public $when = false;
['chat_id', 'required', 'when' => function($model) {
return $model->type == AuthItem::TYPE_PACKMAN && $model->when == true;
},'enableClientValidation' => false],
botga request contact qilinganda messageni ichida text kelmay qoladi keyin bot qotib qoladi. shuning uchun textni ham issetga olib qo'yish kerak

if(isset($message->text)){
$text = $message->text;
}
Migratsiyada meta-charsetni ham birgalikda korsatib ketish.

$this->createTable('category', [
'id' => $this->primaryKey(),
'title_uz' => $this->string()->notNull(),
'title_ru' => $this->string()->notNull(),
'status' => $this->integer()->notNull(),
],'CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci ENGINE=InnoDB');
Agar yii2da malumotlarni bazaga emoji bilan tushurish kerak bolsa config/db.php charsetni utf8mb4 qilib qo'yish kerak
echo $details->createCommand()->getRawSql();

sql sorovni ozini olib beradi
$model->text = strip_tags($model->text, '<b><strong><i><em><u><ins><s><strike><del><span><tg-spoiler><a><code><pre>');

Kelayotgan malumotlarda html teglar mavjud bolsa faqat shu teglarni qoldirib qolganini olib tashlaydi
html_entity_decode($string);

Matndan &nbsp va shunga o'xshagan elementlarni olib tashlaydi va decode holatga otkizadi
\Yii::$app->view->registerLinkTag(['rel' => 'icon', 'type' => 'image/png', 'href' => Url::to(['/favicon.png'])]);

Controllerdan turib browser tabga icon berish
'attribute' => 'status',
'format' => 'raw',
'filter' => Html::activeDropDownList($searchModel, 'status', ['1' => 'O\'qilmagan', '0' => 'O\'qilgan'], ['class' => 'form-control', 'prompt' => 'Barchasi']),

yii2 gridviewda search collumni dropdownli qilish
hozirgi vaqtga yana 20 daqiqa qo'shish

$time = 20;
echo $time = date("H:i", strtotime('+ ' . $time . ' minute')) . ":00";
before

public function insertMessage($response, $chat_id, $order_code_id)
{
$model = new MessageId();
$message_id = $response->result->message_id;
$model->message_id = $message_id;
$model->chat_id = $chat_id;
$model->order_code_id = $order_code_id;
return $model->save();
}

after

public function insertMessage($response, $chat_id, $order_code_id)
{
$model = new MessageId();
if ($response->ok === true) {
$message_id = $response->result->message_id;
$model->message_id = $message_id;
$model->chat_id = $chat_id;
$model->order_code_id = $order_code_id;
return $model->save();
}
}

foydalanuvchi botni bloklaganda responsedan message_idni topolmay qoladi shuning uchun response->ok dan true qaytsagina bu amallarni bajarish kerak
Forwarded from thelaziz
ahost da cron yozsa file ochib tashavotudi kamandelani shu kamandaga o'zgartirsela file ochib tashamasakan

wget -O /dev/null -q http://www.example.com/program/timecheck
yii2da updateAll funksiyasini ifni ichiga olish kerak emas sababi update qilishga malumot topolmasa return false qaytaradi
$output = preg_replace('/(<[^>]+) style=".*?"/i', '', $input);
$clients = Clients::find()->select('id')->where(['not', ['chat_id' => null]]);
SELECT `id` FROM `clients` WHERE NOT (`chat_id` IS NULL)
SELECT `id` FROM `clients` WHERE `chat_id` IS NOT NULL


hammasi bir hil natija beradi yani chat_id ni null emasligiga tekshiradi
if (count($array) > 0) {
// simple code...
}

if (!empty($array)) {
// simple code...
}

if (!!$array) {
// recommended code...
}
@ operatori o'zgaruvchi yo'q elon qilinmagan bolsa yoki qiymatlanmagan bo'lsa null qaytaradi