Posts

Showing posts from March, 2020

Submit on click date validation

Image
var today = new Date();         var mm = today.getMonth()+1;//January is 0!`         var yyyy = today.getFullYear();         if(mm<10){mm='0'+mm}         var month_year = mm+'-'+yyyy;         $("#fromMonth").datepicker({             format: "mm-yyyy",             viewMode: "months",             minViewMode: "months"         });         $('#toMonth').datepicker({             format: "mm-yyyy",             viewMode: "months",             minViewMode: "months",             maxDate: new Date()         }); $( "#Submit" ).click(function() {             var fromMonth...

Laravel print query

use Illuminate\Support\Facades\DB; DB::enableQueryLog(); //$results_rebates = \DB::select( DB::raw("SELECT count(id) as count_rebates FROM campaigns as c WHERE ((c.daily_rebates) - (select count(id) from user_rebate_apply where campaigns_id = c.id )) > 0 AND (c.end_date >= NOW())") ); //$query = \DB::getQueryLog();

csv file upload in codeigniter with check header

Form < form method= "post" enctype= "multipart/form-data" action= " <?php echo base_url(). "admin/amazon_fees_detail/uploadcsvamazonfeesdetail" ; ?> " > < div class= "form-group" > < label class = "col-sm-3 control-label" style= " text-align : end ; padding-top : 5 px ; " > CSV File Upload </ label > < div class= "col-sm-2" style= " text-align : end ; padding-top : 5 px ; " > < input type= "file" name= "csv" id= "csv" required accept= ".csv" > </ div > </ div > < div class= "form-group" > < div class= "col-sm-1" > < button type= "submit" class= "btn btn-primary" id= "Submit" > Submit </ button >< br >< br > </ div > </...

javascript month year datepicker validation

Image
Form < input data-provide= "datepicker" required readonly type= "text" name= "fromMonth" id= "fromMonth" class= "form-control" value= " <?php echo $month ; ?> " > < input data-provide= "datepicker" required readonly type= "text" name= "toMonth" id= "toMonth" class= "form-control" value= " <?php echo $year ; ?> " > JS < script type= "text/javascript" > $ ( document ). ready ( function () { loadDashboard( null , null , null ); var today = new Date(); var mm = today . getMonth ()+ 1 ; //January is 0!` var yyyy = today . getFullYear (); if ( mm < 10 ){ mm = '0' + mm } var month_year = mm + '-' + yyyy ; $ ( "#fromMonth" ).datepicker({ format : "mm-yyyy" , viewMode : "months" , ...

laravel hasmany and belongsTo relationship

Database 1.user_role_id company address 2.users id name email 3.user_role id role UserController use App\Models\ Userdetails ; $resultadmin = Userdetails ::with([' users ', ' userrole '])->get()->toArray(); Userdetails Model     public function users(){         return $this->hasOne('App\Models\users', 'id', 'user_id');     } public function userrole(){         return $this->hasOne('App\Models\Userrole', 'id', 'user_role_id');     } Users Model     public function userdetails(){         return $this->belongsTo('App\Models\Userdetails', 'id', 'user_id');     } Userrole Model public function userdetails(){         return $this->belongsTo('App\Models\Userdetails', 'id', 'user_role_id');     } More details get auth user details use Illuminate\Suppor...