Posts

Showing posts from January, 2022

Laravel 8.x Custom Pagination Example Tutorial

   Step 1: CreatePagination Template As we are going to use laravel custom pagination template, that's why run below command to have it. php artisan vendor : publish -- tag = laravel - pagination PHP Copy   After running above command run you will get new folder "pagination" on views files(resources/views/vendor). In pagination folder you will get following files by default: default.blade.php bootstrap-4.blade.php simple-bootstrap-4.blade.php simple-default.blade.php semantic-ui.blade.php    But we are going to use our own custom pagination template. We don't use any of the above template.    Step 2: Add Route Now we need routes to see our pagination page. So create this below route and create some dummy data of users. routes/web.php Route :: get ( '/' , 'TestController@index' ) ; PHP Copy    Step 3: Add Controller  Ok, now we have to add new controller method "index()" in your TestController, so if you haven't created TestController th...

JS Rest Parameter

Rest Parameter  //Rest Parameter function multply (...args){ let multp= 1 ; for ( let num of args){ multp=multp*num ; } return multp ; } console . log ( multply ( 1 , 2 , 3 , 4 , 5 , 6 )) ;

Js Arrow Function

 Arrow Function //Function Expression function calSumexp (num1 , num2){ let sum=num1+num2 ; return sum ; } const result = calSumexp ( 23 , 56 ) ; console . log ( result ) ; //Arrow Function const calSumArr =(number1 , number2)=>number1+number2 ; console . log ( calSumArr ( 23 , 45 )) ; //Function Expression const mulBytwo = function (value1){ return value1* 2 ; } console . log ( mulBytwo ( 10 )) ; //Arrow Function const mulByTwoArr =(numb1)=>numb1* 2 ; console . log ( mulByTwoArr ( 44 )) ;

JS basic functions

Basic Functions function aboutMe(name, age){ const message=`Hello I am ${name} and I am ${age} Years Old` console.log(message); } aboutMe('Bhushan Gautam,',30); function calculate(num1, num2){ let sum=num1+num2; return sum; } let result= calculate(34,45); console.log(result);

JS JSON format Data

JSON format Data const user={ name:'Bhushan Gautam', age: 24, hobbies: 'play games', }; const copyUser=JSON.stringify(user); console.log(JSON.stringify(copyUser)); console.log(JSON.parse(copyUser));

JS Cloning Object

JS Cloning Object const user={ name:'Bhushan Gautam', age: 24, hobbies: 'play games', } // const copyUser={}; /* copyUser.name = user.name; copyUser.age = user.age; copyUser.hobbies = user.hobbies; console.log(copyUser); */ /* for(let key in user){ // console.log(key,user[key]); copyUser[key]=user[key]; console.log(key,copyUser[key]); } */ const copyUser=Object.assign({},user); console.log(copyUser)

JS Object Destructuring

Object Destructuring const user={ name:'Bhushan Gautam', age: 24, hobbies: 'play games', favBook:{ bookName:'Rich Dad Poor Dad', bookUrl:'http:://hostmero.com' } } const{name,age,hobbies,favBook}=user; const{bookName,bookUrl}=favBook; console.log(favBook.bookName); console.log(name); console.log(bookName); console.log(bookUrl);

JS Traversing Object Entries

JS Traversing Object Entries const profile={ name:'Aryan Kumar', age:20, sex:'Male', married:true, } for(let key in profile) { console.log(key, profile[key]); } // Another Way console.log(Object.keys(profile)); console.log(Object.values(profile)); //Another Way for(let val of Object.values(profile)){ console.log(val) } // Anotehr Exercies const salaries={ Bhushan:5999, Birkha:4500, Roshan:4000, Suman:6432, } let sum=0; for(let key in salaries){ console.log(key, salaries[key]); sum=sum+salaries[key]; } console.log('Total Salary =' +sum); // Other Example let total=0; for (let val of Object.values(salaries)){ total +=val; } console.log(total);

JS Object Methods This Keyword

Object Method and This Keyword const profile={ name:'Aryan Kumar', age:20, sex:'Male', married:true, introduction:function(){ console.log(`Hi I am ${this.age}`) } } profile.introduction();

Js adding Modify and Deleting Properties

Object Basics with Dot Bracket Notation const profile={ name:'Bhushan', age:20, sex:'Male', } console.log(profile); console.log(profile.name); console.log(profile['name']); Adding, Modifying Deleting Properties Adding Properties const profile={ name:'Bhushan', age:20, sex:'Male', } //profile.email='admin@admin.com' profile['email']='admin@admin.com' console.log(profile); Update Properties const profile={ name:'Bhushan', age:20, sex:'Male', married:true } profile.married=false; profile.name='Ramesh Kumar'; profile.age=age+3; console.log(profile); Delete Properties const profile={ name:'Bhushan', age:20, sex:'Male', married:true } delete profile.name console.log(profile);

Laravel 8.x Custom Pagination Example Tutorial

   Step 1: CreatePagination Template As we are going to use laravel custom pagination template, that's why run below command to have it. php artisan vendor : publish -- tag = laravel - pagination PHP Copy   After running above command run you will get new folder "pagination" on views files(resources/views/vendor). In pagination folder you will get following files by default: default.blade.php bootstrap-4.blade.php simple-bootstrap-4.blade.php simple-default.blade.php semantic-ui.blade.php    But we are going to use our own custom pagination template. We don't use any of the above template.    Step 2: Add Route Now we need routes to see our pagination page. So create this below route and create some dummy data of users. routes/web.php Route :: get ( '/' , 'TestController@index' ) ; PHP Copy    Step 3: Add Controller  Ok, now we have to add new controller method "index()" in your TestController, so if you haven't created TestController th...