Posts

jQuery form validation (CUSTOM VALIDATION)

Code Structure :  $.validator.addMethod("field_name","function(value){}","Message"); jQuery Custom NID Validation :  $.validator.addMethod("nid_valid",function(value){    if(value.length == 10 || value.length == 13 || value.length == 17){       return true;    }else{       return false;    } },"NID number length 10, 13, 17 is valid");

LARAVEL CUSTOM VALIDATION

NID Validation :) 1> app/Providers/AppServiceProvider.php public function boot(){    $this->app['validator']->extend('nid',function($attribute,$value,$parameters){    $length = strlen($value);    if(in_array($length,[10,13,17])){        return true;    }else{        return false;    } }); } 2> resources/lang/en/validation.php return [    'nid' => 'The :attribute valid NID must be 10 | 13 | 17', ];

PHP BUILT-IN FUNCTIONS

strtolower() - converts a string to lowercase. lcfirst() - converts the first character of a string to lowercase. ucfirst() - converts the first character of a string to uppercase. ucwords() - converts the first character of each word in a string to uppercase.

Bootstrap browse button

  a) For Multiple file upload..........     <label class="btn btn-primary btn-file">         <i class="fa fa-picture-o"></i> Browse         <input type="file" name="file[]" style="display:none;" multiple>     </label>   b) For Single file upload........     <label class="btn btn-primary btn-file">         <i class="fa fa-picture-o"></i> Browse         <input type="file" name="file" style="display:none;">     </label>

INCREASING SQL UPLOADING FILE SIZE

1> Go to php.ini file 2> Find : post_max_size = 8M upload_max_filesize = 2M max_execution_time = 30 max_input_time = 60 memory_limit = 8M 3> Replace : post_max_size = 35M upload_max_filesize = 35M max_execution_time = 5000 max_input_time = 5000 memory_limit = 1000M

LARAVEL STYLE and SCRIPT LINKING

CSS LINKING : {!!Html::style('assets/css/bootstrap.css')!!} JAVASCRIPT LINKING : {!!Html::script('assets/js/bootstrap.min.js')!!}

UBUNTU>TERMINAL>MYSQL>DATABASE>TABLE

How to Install MySQL sudo apt-get install mysql-server How to Access the MySQL shell mysql -u root -p How to Create and Delete a MySQL Database mysql> SHOW DATABASES; mysql> CREATE DATABASE db_name; mysql> DROP DATABASE db_name ; mysql> USE db_name; mysql> SHOW tables; How to Create a MySQL Table CREATE TABLE tbl_name (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, name VARCHAR(20), food VARCHAR(30), confirmed CHAR(1), signup_date DATE); mysql> SHOW TABLES; mysql> DESCRIBE tbl_name; How to Add Information to a MySQL Table INSERT INTO `tbl_name` (`id`,`name`,`food`,`confirmed`,`signup_date`) VALUES (NULL, "John", "Casserole","Y", '2012-04-11'); mysql> SELECT * FROM tbl_name; How to Update Information in the Table UPDATE `tbl_name` SET `confirmed` = 'Y' WHERE `tbl_name`.`name`='Sandy'; How to Add and Delete a Column ALTER TABLE tbl_name ADD email VARCHAR(40); ALTER TABLE tbl_name ADD email VARCHAR(40)...