Posts

Showing posts from April, 2019

Dynamic Controller And Model (First Date,End Date)

Controller...... $FirstDate = date('Y-m-d', strtotime('-30 days')).' 00:00:01';             $firstDateToFetch = date('Y-m-d', strtotime($FirstDate)) ;             $endDateToFetch = '';             $condition = array();             $sales = $this->model->calculate('ppc_campaignspref',$firstDateToFetch,$endDateToFetch,$condition,'attributedSales30d','sales'); Model....... public function calculate($tableName,$fromDate,$endDate=null,$condition,$column1=null,$asValue=null){         $this->db->select("SUM(".$tableName.".".$column1.") as ".$asValue);//changed attributedSales1d) as Sales         $this->db->from($tableName);         (($fromDate!='')?$this->db->where('dayOfData >=', $fromDate) : '');         (($endDate!='')?$this->db->where('dayOfData...

How to Use Sub Query In SQL

SELECT      od.`product_id`,     SUM(od.`origianl_quantity`) AS total_quantity,     (SELECT pro.`name` FROM products AS pro WHERE pro.`id` = od.`product_id`)          AS product_name  FROM order_details AS od          GROUP BY od.`product_id`  ORDER BY total_quantity DESC

Add a new column to existing table in a migration

To create a migration, you may use the migrate:make command on the Artisan CLI. Use a specific name to avoid clashing with existing models for Laravel 3: php artisan migrate : make add_paid_to_users for Laravel 5+: php artisan make : migration add_paid_to_users_table -- table = users You then need to use the  Schema::table()  method (as you're accessing an existing table, not creating a new one). And you can add a column like this: public function up () { Schema:: table ( 'user_master_transational' , function (Blueprint $table ) { $table ->string( 'vFirstName' , 25 )-> collation ( 'utf8mb4_unicode_ci' )-> nullable () -> after ( 'iUserId' );           $table ->string( 'vLastName' , 25 )-> collation ( 'utf8mb4_unicode_ci' )-> nullable () -> after ( 'iUserId' ); }); } and don't forget to add the rollback option: public function down () { Schema :: table ( 'users' ...

How To Get Current Week Month Year StartDate And EndDate

          // Get current week $week_start_date = new \DateTime("last saturday"); // Edit $week_start_date->modify('+1 day'); // Edit $week_end_date = clone($week_start_date); $week_end_date->modify('+6 days');  // Get current month             $startDate = date('Y-m-d', strtotime('first day of this month'));             $endDate = date('Y-m-d', strtotime('last day of this month')); // Get current year             $year = date('Y');             $startDate = "{$year}-01-01";             $endDate = "{$year}-12-31";

Yii Framework Index Change Label Name

Example         [           'attribute' => 'CountryCode',           'label'     => 'Country name',         ],

Yii Framework In How To Searchbox In Dropdown Search Filter

Example 1-)use yii\helpers\ArrayHelper; 2-)use app\models\Registrationform; 2-)as a database modal 3-)            [                 'attribute'=>'last_name',                // 'filter'=>ArrayHelper::map(Registrationform::find()->asArray()->all(), 'last_name', 'last_name'),                 'filter' => ArrayHelper::map(Calculation::find()->select('ArticleGroup')->distinct()->where(['not', ['ArticleGroup' => null]])->andWhere(['not', ['ArticleGroup' => '']])->orderBy(['Type' => SORT_ASC])->all(), 'ArticleGroup', 'ArticleGroup'),                 'filterInputOptions' => ['prompt' => 'last name', 'class' => 'form-control', 'id' => null],             ], 3-)'attribute'=>'fild name ', 3)'filter'=>ArrayHelpe...

Yii Framework Search Dropdown

link Example use kartik\widgets\Select2; <?= $form->field($model, 'AlternativeBrand')->widget(Select2::classname(), [     'data' => $data,     'options' => ['placeholder' => 'Select a state ...'],     'pluginOptions' => [         'allowClear' => true     ], ]);?> -----NOTE----->>>>    'data' => $data, (static variable) <?= $form->field($model, 'AlternativeBrand')->widget(Select2::classname(), [ 'data' => [1 => "First", 2 => "Second", 3 => "Third", 4 => "Fourth", 5 => "Fifth"],   'options' => ['placeholder' => 'Select a state ...'],     'pluginOptions' => [         'allowClear' => true     ], ]);?> ------simple------     <?=  $form->field($model, 'CountryCode')->dropDown...

Yii Framework In Update Time View Image In Form

Example [                 'attribute'=>'Image',                 'label'=>'image',                 'format'=>'html',                 'value'=>function($data)                 {                     return Html::img(Yii::$app->params['imageuploadurl'].$data['Image'],                     ['width'=>'100','height'=>'50'],['alt'=>'yii']);                 },  ],   --- Form In----  <?= $form->field($model, 'file')->fileInput() ?> <?= Html::img(Yii::$app->params['imageuploadurl'].$model->Image,['width'=>'100','height'=>'50'],['alt'=>'yii']); ?> NOTE : (...

How Show Modal Error In Yii

Use  print_r($model->getErrors());

Yii Framework Form design Horizontal Layout

link

CKEditor Widget for Yii2

https://github.com/2amigos/yii2-ckeditor-widget How To Use 1. composer require 2amigos/yii2-ckeditor-widget 2. use dosamigos\ckeditor\CKEditor; 3. <?= $form->field($model, 'text')->widget(CKEditor::className(),      [         'options' => ['rows' => 6],         'preset' => 'basic'     ]) ?> 

How to crate new Controller In laravel

php artisan make:controller " nameController " NOTE : NAMECONTROLLER Is Controller Name

Facebook How Do I Permanently Delete My Account?

facebook How do I permanently delete my account?

Instagram  How do I delete my account?

Instagram  How do I delete my account?

Yii Framework In Action Column Button Format

Action Column button format  {view} {update} {delete} Example [    'class' => 'yii\grid\ActionColumn',    'header'=>'Actions',    'template' => '{view}  {update} {delete}',    'options'=>['style'=>'width:150px;'],    'buttonOptions'=>['class'=>'btn btn-info'], ],

SQL In Static Id Wise Record Skip After Show Result

Example SELECT     pr.*,     sub_cat.name AS subcategoryname FROM     products AS pr     JOIN product_sub_categories AS sub_cat    ON sub_cat.id = pr.sub_category_id     JOIN product_categories AS cat         ON cat.id = sub_cat.category_id WHERE       pr.`is_discontinued` = 0     AND pr.`is_active` = 1     AND pr.deleted_by IS NULL     AND sub_cat.`is_active` = 1     AND cat.`is_active` = 1     AND cat.id NOT IN (1,5)     AND cat.deleted_by IS NULL ORDER BY pr.name ASC , cat.id;

Yii Framework Gridview In Popup

Gridview with popup Gridview With Popup

Yii Framework Form Popup

Yii Framework Form Popup

Yii Framework Form Input Fields

Yii Framework Form Input Fields

HOW TO DEBUG BLANK WHITE SCREEN AND CSS JS PAGE LOAD DESIGN ISSUE.

 ini_set('error_reporting', E_ERROR); register_shutdown_function("fatal_handler"); function fatal_handler() {     $error = error_get_last();     echo("<pre>");     print_r($error);     echo("</pre>"); }

Yii Framework Create / Generate PDF files with TCPDF plugin

Generate PDF File

PHP Array Functions

php array functions