All Code

Title Code
center
Any div or element want to center position...
just use this class...

<div class="center-block">
</div>

*******
.col-center-block {
    float: none;
    display: block;
    margin: 0 auto;
    /* margin-left: auto; margin-right: auto; */
}
table [insert]
<form action="store.php" method="POST">
     <div class="form-group">
            <label>Name: </label>
            <input type="text" class="form-control" name="" placeholder="" required>            
     </div>

     <div class="form-group">
            <label>Roll: </label>
            <input type="text" class="form-control" name="" placeholder="">            
     </div>

     <div class="form-group">
            <label>Age: </label>
            <input type="text" class="form-control" name="" placeholder="">            
     </div>
         <button type="submit" class="btn btn-primary">Submit</button>
</form>
textarea
textarea{
      text-align: justify;
      white-space: normal;
   }
target
Create a new tab on browser

<a class="btn btn-success" target="_blank" href="<?= $row['link']; ?>" >Click Now</a>
auto refresh
<head>
	<meta http-equiv="refresh" content="2" />
</head>
image
#userCompleteView {  
  background-image: linear-gradient(rgba(10,0,0,.1),rgba(0,10,0,.2)),url(\"../images/user.jpg\");
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  display: block;
  width: auto;  
  min-height: 80vh;
}


<img src=\"#\" class=\"img-thumbnail responsive\" alt=\"No Image found\" width=\"80\">


<img src="admin_image/aslam_<?=$rand;?>.jpg">
	<h5>Md Aslam Hossain</h5>

************

profile img{
    width: 160px;
    height: 160px;
    /*padding-top: 15%;*/
    color: #fff;
    border-radius: 50%; 
}
Footer design
https://css-tricks.com/couple-takes-sticky-footer/
Anchor tag
[float: right] PMAQUBGIJI
not working
<h4 style="float: right;">
   <a href="#company" data-slide="prev">company</a>
   <a href="#city" data-slide="next">city</a>
</h4>

It is working...
<h4 style="float: right; position:relative; z-index:5;">
   <a href="#company" data-slide="prev">company</a>
   <a href="#city" data-slide="next">city</a>
</h4>

Another example: 
  <div style="float: left; position:relative; z-index:5; left: 15px;">
               <a href="election.php?election=<?php echo $name; ?>" 
class="btn btn-info" style="padding: 8px 94px; 
margin: 0 auto; ">Back</a>
            </div>
fontawesome
fontawesome 5 font-family not work

link : https://stackoverflow.com/questions/47788847/fontawesome-5-font-family-not-work

HTML :
<link href="https://use.fontawesome.com/releases/v5.0.1/css/all.css" rel="stylesheet">
<a>User</a>
<i class="fas fa-shopping-basket"></i>

CSS :

a::after {
  content: "f007";
  font-family: 'Font Awesome 5 Free';
}
summernote
Textarea editor
https://summernote.org/

multiple use:
https://summernote.org/examples/
Range
1st style: 
<input type="range" min="0" max="100" step="5" value="0" name="range" id="range" class="form-control" list=mapsettings required>
<p>Value : <span id="showOutput"></span></p>

<script>
    var range = document.getElementById("range");
    var output = document.getElementById("showOutput");
    output.innerHTML = range.value;

    range.oninput = function() {
        output.innerHTML = this.value;
    }
</script>

2nd style
<input type="range" min="1" max="100" value="5" oninput="this.nextElementSibling.value = this.value" list=mapsettings>
<output>5</output>

3rd style
<input type="range" value="10" max="100" oninput="num.value = this.value" list=mapsettings>
<output id="num">0</output>

<datalist id=mapsettings>
   <option>20</option>
   <option>40</option>
   <option>60</option>
   <option>80</option>
   <option>100</option>
</datalist>
Change another element on :hover
/* .sibling-hover, #parent {
    cursor: pointer;
} */
.sibling-hover:hover ~ .sibling-highlight {
    background-color: blue;
    color: white;
}
#parent:hover .parent-highlight {
    background-color: red;
    color: white;
}
ul li { list-style:none; }
span{ margin-left:2em;}
ul li a:hover{
  color:blue; font-size:20px;
}
ul li a:hover span{
  background:green;
  color: #fff;
}

<b>sibling method:</b>
<div>
    <div class="sibling-hover">hover over me</div>
   	<br><br>
    <div class="sibling-highlight">I get highlighted</div>
</div>
<br>

<b>child method:</b>
<div id="parent">
    <div>hover over me</div>
    <br><br>
    <div class="parent-highlight">I get highlighted</div>
</div>

<b>Listing</b>
<ul>
	<li>
		<a href="">AAA 
			<span>aaa</span>
		</a>
	</li>
	<li>
		<a href="">BBB
			<span>bbb</span>
		</a>
	</li>
	<li>
		<a href="">CCC
			<span>ccc</span>
		</a>
	</li>
	<li>
		<a href="">CCC
			<span>ccc</span>
		</a>
	</li>
</ul>
scrollbar
Final css code
=========
body::-webkit-scrollbar{ width: 8px; }
body::-webkit-scrollbar-thumb { border-radius: 10px; -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); }
			
/*back part*/
body::-webkit-scrollbar-track { -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); border-radius: 10px; }
@media screen and (max-width: 992px) { body { font-size: 16px; } }

Source: 
http://jsfiddle.net/4xMUB/2/
fieldset, legend
HTML:
<fieldset>
       <legend>Title</legend>
        Message...
</fieldset>

CSS :
fieldset {
   border: 1px dashed skyblue !important;
   border-radius: 0.50rem;
   padding: 0 1em 1em 1em !important;
   margin: 0 0 1.5em 0 !important;
   -webkit-box-shadow:  0px 0px 0px 0px #000;
   box-shadow:  0px 0px 2px 0px #000;
}
legend{ 
   width:inherit;
   font-size: 1em !important;
   font-weight: bold !important;
   text-align: center;
   border: 1px solid pink; 
   background-color: whitesmoke;
   border-radius: 12px;   
   padding: 0px 10px; 
   margin-bottom:10px;
}
pre
pre{
   font-family: "Courier New", monospace;
   padding: 9px;
   font-size: 12px;
   color: #333;
   word-break: break-all;
   word-wrap: break-word;
   background-color: #dfe6e9; 
   border: 1px solid #ccc;
   border-radius: 4px;
}

<pre>Code</pre>
background
background: linear-gradient(to right,#000,#333,#666);
responsive
// Extra small devices (portrait phones, less than 576px)
@media (max-width: 575.98px) { ... }

// Small devices (landscape phones, 576px and up)
@media (min-width: 576px) and (max-width: 767.98px) { ... }

// Medium devices (tablets, 768px and up)
@media (min-width: 768px) and (max-width: 991.98px) { ... }

// Large devices (desktops, 992px and up)
@media (min-width: 992px) and (max-width: 1199.98px) { ... }

// Extra large devices (large desktops, 1200px and up)
@media (min-width: 1200px) { ... }
html include
<html>
      <div id="header"></div>
      <body>
              This is body
              <div id="footer"></div>
      </body>
</html>
	
<script>
	$(function(){
              $("#header").load("header.html");
	      $("#footer").load("footer.html")
	});
</script>
Nice button
<a href="/learn/" target="_self" style=" " class="button   9  " data-aa-title="default-cta">
Previous
</a>

<style>
   button:hover, .button:hover, button:focus, .button:focus {
      box-shadow: 0 10px 30pxrgba(0,0,0,0.4);
      background: linear-gradient(145deg,#f05a28 0,#ec008c 100%);
      color: white;
   }

   button, .button {
      font-family: sans-serif;
      font-weight: 700;
      font-size: 14px;
      line-height: 1.1;
      padding: 15px 30px;
      white-space: normal;
      border-radius: 2px;
      color: #fff;
      background: #ec008c;
      position: relative;
      text-align: center;
      text-decoration: none;
      display: inline-block;
      transition: box-shadow .3s ease-in-out;
      margin: 0 0 20px;
      letter-spacing: 1px;
      text-transform: uppercase;
   }
</style>
Radio input design
<style>
    div {
  display: inline-block;
  position: relative;
}
label {
  background: #fcb608;
  padding: 2px 10px 2px 1.5em;
  border: 1px solid transparent; /* keeps layout from jumping */ border-radius: 3px;
}
input {
  position: absolute;
}
input[type="radio"]:checked + label {
  background: #000;
  border-color: green;
  color: white;
 
}
</style>

<div>
    <input id="id1" type="radio" name="ad_caroserie" value="0">
    <label for="id1" class="radio">Berlina</label>
  </div>
  <div>
    <input id="id2" type="radio" name="ad_caroserie" value="1">
    <label for="id2" class="radio">Break</label>
  </div>
  <div>
    <input id="id3" type="radio" name="ad_caroserie" value="2">
    <label for="id3" class="radio">Cabrio</label>
  </div>
line circle line
<div class="title-line">
   <div class="tl-1"></div>
   <div class="tl-2"></div>
   <div class="tl-3"></div>
</div>

<style>
   .title-line {
      margin-top: -10px;
   }
   .tl-1 {
      width: 80px;
      height: 1px;
      display: inline-block;
      background: #eee;
   }
   .tl-2 {
      display: inline-block;
      height: 12px;
      margin: 0 5px;
      position: relative;
      top: 5px;
      width: 12px;
      border: 1px solid #ebc131;
      border-radius: 50px;
   }
   .tl-3 {
      width: 80px;
      height: 1px;
      display: inline-block;
      background: #eee;
   }
</style>
Dynamic bootstrap call
<?php
    $bootstrap = [
        '5.3.0-alpha1',
        '5.2.3',
        '5.1.3',
        '5.0.2',
        '4.6.2',
        '4.5.3',
        '4.4.1',
        '4.3.1',
        '4.2.1',
        '4.1.3',
        '4.0.0',
        '3.4.1',
        '3.3.7'
    ];

    $version = $bootstrap[3];
    //print : 5.0.2

    echo "https://cdn.jsdelivr.net/npm/bootstrap@".$version."/dist/css/bootstrap.min.css";
    echo "<br>";
    echo "https://cdn.jsdelivr.net/npm/bootstrap@".$version."/dist/js/bootstrap.min.js";
   
?>
   
<link href="https://cdn.jsdelivr.net/npm/bootstrap@{{$version}}/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@{{$version}}/dist/js/bootstrap.min.js"></script>
input field read only but still data back to a form?
<input type="text" name="date" placeholder="Day-Month-Year" value="{{date('d-m-Y', strtotime($date))}}" readonly='true' />
date range double calender
https://www.daterangepicker.com/
button hover effect
<a class="form-control btn border link" href="">aaa</a>	
<style>
		.btn { 
			position: relative;
			transition: color 200ms;
		}
		.btn::before {
			content: '';
			display: inline-block;
			position: absolute;
			inset: 0;
			background: #121212;
			transform: scaleX(0);
			transform-origin: left;
			z-index: -1;
			transition: transform 200ms;
		}
		.btn:hover { color: #ffffff; }
		.btn:hover::before { transform: scaleX(1); }
	</style>
autofocus
<button type="button" required class="btn" data-toggle="modal" data-target="#modal-sm3">Payment</button>

<div class="modal fade" id="modal-sm3" style="top: 15%; left: 30%;">
   <div class="modal-dialog modal-sm">
      <div class="modal-content">        
         <div class="modal-body payment_reload">
             <input type="text" class="form-control" id="cash"  autofocus>           
      </div>
      </div>
   </div>
</div>

<script>
 $('#modal-sm3').on('shown.bs.modal', function() {
        $('#cash').trigger('focus');
        $('input[type="number"]').trigger('focus');

    });
</script>

https://getbootstrap.com/docs/4.5/components/modal/
The Enter Key should Submit Forms
Enter = Submit

<div class="modal-body">
            <input type="number" id="discount" onkeypress="submitOnEnter(event)">        
            <button type="button" class="btn btn-primary submit2" id="submit">Add</button>
         </div>

    document.getElementById('discount').addEventListener('keypress', function(event) {
        if (event.keyCode == 13) {
            document.getElementById('submit').click();
        }
    });
    
    function submitOnEnter(e) {
        alert(e.which);
        if (e.which == 13) {
            document.getElementById('submit').click();
            or
            $('.submit2').click();
        }
    }

https://www.tjvantoll.com/2013/01/01/enter-should-submit-forms-stop-messing-with-that/
20+ HTML Input Types
https://morioh.com/a/06b4b5d373a1/20-essential-html-input-types-with-code-examples
Checks and radios
<div>
                        <input type="radio" class="btn-check" name="radio" id="cat" autocomplete="off" >
                        <label class="btn rounded-4" for="cat">
                           Lorem ipsum dolor, sit amet consectetur adipisicing elit. Animi, facere.
                        </label>

                        <input type="radio" class="btn-check" name="radio" id="dog" autocomplete="off">
                        <label class="btn rounded-4" for="dog">
                           Lorem ipsum dolor, sit amet consectetur adipisicing elit. Animi, facere.
                        </label>

                        <input type="checkbox" class="btn-check" name="checkbox" id="cat2" autocomplete="off" >
                        <label class="btn rounded-4" for="cat2">
                           Lorem ipsum dolor, sit amet consectetur adipisicing elit. Animi, facere.
                        </label>

                        <input type="checkbox" class="btn-check" name="checkbox" id="dog2" autocomplete="off">
                        <label class="btn rounded-4" for="dog2">
                           Lorem ipsum dolor, sit amet consectetur adipisicing elit. Animi, facere.
                        </label>
                    </div>

https://getbootstrap.com/docs/5.0/forms/checks-radios/
scrollbar
<div id="colorlib-aside">
Contant
</div>
#colorlib-aside {
    padding-top: 0.5em;
    padding-bottom: 40px;
    float: left;
    width: 300px;
    position: fixed;
    overflow-y: scroll;
    z-index: 1001;
    background: #f2f3f7;
    -webkit-transition: 0.5s;
    -o-transition: 0.5s;
    transition: 0.5s;
    height: 120px;
}
/*font part*/
                                #colorlib-aside::-webkit-scrollbar {
                                    width: 7px;
                                }
                                #colorlib-aside::-webkit-scrollbar-thumb {
                                    border-radius: 10px;
                                    -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);
                                }

                                /*back part*/
                                #colorlib-aside::-webkit-scrollbar-track {
                                    -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
                                    border-radius: 10px;
                                }
Cross (x) icon
x => &times;
a
a
single quote ( ' ) in JavaScript
alert("Sorry user! Your account don't create successfully. Please try again.");

NB: Just use 'backslash'  before any single or double quotetion.
Js print only this quation not 'backslash'

https://www.w3schools.com/js/js_strings.asp
alert
Html
@if (session('success'))
                           <div class="alert alert-success">
                              <strong>Success!</strong> {{ session('success') }}
                           </div>
@endif

js include
then
<script type="text/javascript">
      window.setTimeout(function() {
          $(".alert").fadeTo(500, 0).slideUp(500, function(){
              $(this).remove(); 
          });
      }, 2000);
</script>
defer
<!doctype html>
<body>
<p>...content before scripts...</p>

<script>
  document.addEventListener('DOMContentLoaded', () => alert("(1) DOM ready after defer!")); // (2)
</script>

<script defer src="https://javascript.info/article/script-async-defer/long.js?speed=1">
</script>

<script>
  document.addEventListener('DOMContentLoaded', () => alert("(2) DOM ready after defer!")); // (2)
</script>



<p>...content after scripts...</p>
</body>
first letter capital
<div  class="alert alert-success">
                              <strong>Success!</strong> {{ session('success') }}
                           </div>

<script type="text/javascript">
      $(".alert").each(function(){
        var txt =  $(this).text().replace(/\s+/g,' ').trim() ;
        $(this).text(txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase());
      });
   </script>
JQuery .on('click') not working in DataTables 2nd page
https://stackoverflow.com/questions/25414778/jquery-onclick-not-working-in-datatables-2nd-page-or-rows-past-11
js clock
<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <title>Simple setInterval clock</title>
    <style>
      p {
        font-family: sans-serif;
      }
    </style>
  </head>
  <body>
    <p class="clock"></p>
    <script>
      function displayTime() {
        let date = new Date();
        let time = date.toLocaleTimeString();
        document.querySelector('.clock').textContent = time;
      }

      displayTime();
      const createClock = setInterval(displayTime, 1000);
    </script>
  </body>
</html>
onclick action
<!DOCTYPE html>
<html>
<body>

<button class="btn copy" onclick="abc(this)">Copy</button>

<script>
  function abc(obj) {
    obj.style.backgroundColor = "blue";
    obj.style.color = "#fff";
    obj.innerHTML = "Copied";
    document.getElementById("demo").style.backgroundColor = "blue";
  }
</script>

<p id="demo" style="width:120px; height:120px; background-color:cyan;"></p>


</body>
</html> 
onclick default color
<!DOCTYPE html>
<html>
<body>

<script type="text/javascript">

function setToRed ( )
{
  document.getElementById("colourButton").style.color = "#FF0000";
  setTimeout ( "setToBlack()", 2000 );
}
clearInterval(setToBlack ( ));
function setToBlack ( )
{
  document.getElementById("colourButton").style.color = "#000000";
}

</script>

<input type="button" name="clickMe" id="colourButton" value="Click me and wait!" onclick="setToRed()"/>
</body>
</html>
setTimeout
<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Try it</button>
<p id="demo" style="width:100px; height:100px; background-color:cyan;"></p>
<script>

function myFunction() {
  var myVar = setTimeout(alertFunc, 2000);
}
function alertFunc() {
  document.getElementById("demo").style.backgroundColor = "blue";
}
</script>

</body>
</html>
Selector
<table class="table table-bordered text-center">
        <tr>
            <td>HTML</td>
            <td>Jquery</td>
        </tr>
        <tr>
            <td>
                <p>This normal selector</p>
            </td>
            <td>
                $("p").text("This normal selector2");
            </td>
        </tr>
        <tr>
            <td>
                <h4>Selector bold</h4>
            </td>
            <td>
                $("h4").html(<b>Selector bold2</b>);
            </td>
        </tr>
        <tr>
            <td id="newId">Id selector</td>
            <td>
                $("#newId").html("<b>Id selector2</b>");
            </td>
        </tr>
        <tr>
            <td class="newClass">Class selector</td>
            <td>
                $(".newClass").html("<b>Class selector2</b>");              
            </td>
        </tr>

        <tr class="parent">
            <td class="child">
                <h4>This is nested selector</h4>
            </td>
            <td>
                $(".parent .child h4").html("<b>This is nested selector2</b>");
            </td>
        </tr>
      </table>
ajax response type
$.ajax({	
	success: function (response) {
		alert(response);
	},
	failure: function (response) {
		alert(response.responseText);
	},
	error: function (response) {
		alert(response.responseText);
	}
});
button disable
<button class="without_p" id="without_p">Order Without Print</button>
<button class="with_p" id="with_p">Order With Print</button>

Nb: class not working sometime


    document.getElementById("without_p").disabled = true;
    document.getElementById("with_p").disabled = true;
    document.querySelector('#with_p').disabled = true;
autoFocus
<dialog id="favDialog">
                            Phone: <input type="text" name="mnfr" autofocus>
                        </dialog>
                        <menu>
                            <a class="btn btn-success" id="phoneDetails">Tell us about your phone</a>
                        </menu>


<script>
    var chooseButton = document.getElementById('phoneDetails');
    chooseButton.addEventListener('click', function onOpen() {
        if (typeof favDialog.showModal === "function") {
            favDialog.showModal();
        } else {
            alert("The <dialog> API is not supported by this browser");
        }
    });
</script>




    $(document).on("click", ".autoFocus", function () {
        alert('12');
        $('#cash').find('[autoFocus]').focus();
        $('#cash').focus();
    });



    function autoFocus(){
        $('.payment_reload').on('shown.bs.modal', function () {
            alert('123');
            $('#cash').focus();
        });
    }
append index number
<div>
                            <div id="input-container">
                                <input type="text" id="input0" value="Existing Input">
                            </div>
                            <button onclick="addInput()">Add Input Field</button>
                            
                            <script>
                                let inputIndex = 1;                            
                                function addInput() {
                                    const inputContainer = document.getElementById('input-container');
                                    const input = document.createElement('input');
                                    input.type = 'text';
                                    input.id = 'input' + inputIndex;
                                    input.value = 'New Input ' + inputIndex;
                                    inputContainer.appendChild(input);                                    
                                    inputIndex++;
                                }
                            </script>
                        </div>
PHP Notification Tutorial
https://www.cloudways.com/blog/real-time-php-notification-system/
put cursor at end of text input's value
js.cdn
<input type="text" id="txt1" value="Lorem"/>
$(function() {
      var input = $("#txt1");
    var len = input.val().length;
    input[0].focus();
    input[0].setSelectionRange(len, len);
    });



https://stackoverflow.com/questions/17780756/put-cursor-at-end-of-text-inputs-value
enter press and move another field
<div class="row justify-content-center">
        <div class="col">
            <label for="name">Name</label>
            <input type="text" class="form-control" id="name" autofocus>
        </div>
        <div class="col">
            <label for="email">Email</label>
            <input type="email" class="form-control" id="email" placeholder="type and press enter">
        </div>
        <div class="col">
            <button type="submit" class="btn btn-primary mt-4 px-5" onclick="javascript:alert('You press #Enter button#!')" id="submit">Submit</button>
        </div>        
    </div>

<script>
        $("#name").keypress(function(e) {
            if(e.which == 13){
                $('#email').focus();
            }
        });

        $("#email").keypress(function(e) {
            if(e.which == 13){
                $('#submit').focus();
            }
        });
    </script>
image upload with JavaScript
https://uploadcare.com/learning/file-uploader/js-image-upload/
loader
html
<div id='loader' style='display: none;'></div>

Ajax
    function combo_event($id) {
        var item_id = $id;
        $("#loader").show();
        $.ajax({
            url: "includes/combo_item_list.php",
            method: "POST",
            data: {
                item_id: item_id
            },
            dataType: "json",
            success: function(data) {
                $("#loader").hide();
            }
        });
    };

CSS


#loader{
    /* position: fixed;
    left: 0px;
    top: 0px;
    width: 100%;
    height: 100%;
    z-index: 9999; */
    /* background: url('//upload.wikimedia.org/wikipedia/commons/thumb/e/e5/Phi_fenomeni.gif/50px-Phi_fenomeni.gif') 50% 50% no-repeat rgb(249,249,249); */
    /* background: url('loader.gif') 50% 50% no-repeat rgb(249,249,249); */
    /* background-color: transparent; */    
}

#loader {
    position:fixed;
    width:100%;
    left:0;right:0;top:0;bottom:0;
    background-color: rgba(255,255,255,0.7);
    z-index:9999;
    display:none;
}

or...........
@-webkit-keyframes spin {
	from {-webkit-transform:rotate(0deg);}
	to {-webkit-transform:rotate(360deg);}
}

@keyframes spin {
	from {transform:rotate(0deg);}
	to {transform:rotate(360deg);}
}

#loader::after {
    content:'';
    display:block;
    position:absolute;
    left:48%;top:40%;
    width:40px;height:40px;
    border-style:solid;
    border-color:black;
    border-top-color:transparent;
    border-width: 4px;
    border-radius:50%;
    -webkit-animation: spin .8s linear infinite;
    animation: spin .8s linear infinite;
}
progress-bar
<div class="container">
        <div class="progress">
            <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" style="width: 0%" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
        </div>
    </div>


<script>
    for(var i=1; i<=10; i++){
        doSetTimeout(i);
    }

    function doSetTimeout(i){        
        setTimeout(function() {
            var j = i*10;
            $('.progress-bar').attr('aria-valuenow', j).css('width', j + '%').text(j + '%');
        }, i*1000);
    }
</script>

https://shareurcodes.com/blog/real%20time%20progress%20bar%20in%20php
progress-bar2
<div class="container mt-4">
    <div class="progress">
        <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" style="width: 0%" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
    </div>
</div>

<div class="container mt-4">
    <div id="progressbar" style="border:1px solid #ccc; border-radius: 5px; "></div>
    <br>
	<div id="information" ></div>
</div>


<?php
    $total = 100;    
    for($i=1; $i<$total; $i++){
        $percent = intval($i/$total * 100)."%";

        sleep(1);

        echo 
            '<script>
                parent.document.getElementById("progressbar").innerHTML="<div style=\" width:'.$percent.'; background: #f00; height:35px; \"> &nbsp; </div>";
                parent.document.getElementById("information").innerHTML="<div style=\" text-align:center; font-weight:bold \">' .$percent. ' is processed.</div>";
            </script>';

        echo "<script> 
            $('.progress-bar').attr('aria-valuenow', $i).css('width', $i + '%').text($i + '%');            
        </script>";

        ob_flush();
        flush();

        $i = $i+9;
    }
    echo 
        '<script>
            parent.document.getElementById("information").innerHTML="<div style=\" text-align:center; font-weight:bold \">Process completed</div>";
        </script>';
?>
progress-bar dynamic
bootstrap

<div class="modal fade" id="myModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header py-2">
                <h5 class="modal-title" id="exampleModalLabel">Upload online database</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">

                <div id="one" style="display: none;">
                    <label for="">1st table invoice upload</label>
                    <div class="progress">
                        <div class="one progress-bar progress-bar-striped progress-bar-animated" role="progressbar" style="width: 0%" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
                    </div>
                </div>
                <div id="two" style="display: none;">
                    <label for="">2nd table Invoice upload</label>
                    <div class="progress">
                        <div class="two progress-bar progress-bar-striped progress-bar-animated" role="progressbar" style="width: 0%" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
                    </div>
                </div>

            </div>
            <div class="modal-footer py-2">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary">Save changes</button>
            </div>
        </div>
    </div>
</div>


<?php
    echo "<script> $('#myModal').modal('show'); </script>";

    $tables = ['one' => 4, 'two' => '5'];

    foreach($tables as $key => $total){
        for($i = 0; $i <= $total; $i++){
    
            echo "<script> $('#$key').show(); </script>";
    
            $percent = intval($i / $total * 100);
            setTime(1);
    
            echo
                "<script>
                    $('.$key').attr('aria-valuenow', $percent).css('width', $percent + '%').text($percent + '%');
                </script>";
            
            flushLoad();
        }
    }

    sleep(1);
    echo "<script> $('#myModal').modal('hide'); </script>";

    function setTime($n){
        return sleep($n);
    }
    
    function flushLoad(){
        ob_flush();
        flush();
    }
    echo "<script> location.href='index.php'; </script>";
?>
progress-bar final
<?php
    session_start();
    include("includes/header.php");
    include("includes/db_connect.php");
    include("includes/footer.php");
?>


<div class="modal fade" id="myModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header py-2">
                <h5 class="modal-title" id="exampleModalLabel">Upload online database</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body pb-2 pt-0">
                <!-- <div id="one" style="display: none;">
                    <label for="">1st table invoice upload</label>
                    <div class="progress">
                        <div class="one progress-bar progress-bar-striped progress-bar-animated" role="progressbar" style="width: 0%" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
                    </div>
                </div>
                <div id="two" style="display: none;">
                    <label for="">2nd table Invoice upload</label>
                    <div class="progress">
                        <div class="two progress-bar progress-bar-striped progress-bar-animated bg-success" role="progressbar" style="width: 0%" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
                    </div>
                </div> -->
            </div>
        </div>
    </div>
</div>


<?php
    echo "<script> $('#myModal').modal('show'); </script>";

    $tables = ['info' => 2, 'secondary' => '2', 'dark' => '2', 'primary' => '2', 'success' => '2','warning' => '2', 'danger' => '2'];
    $loop = 0;
    $colors = array('bg-info', 'bg-secondary', 'bg-dark', 'bg-primary', 'bg-success', 'bg-warning', 'bg-danger'); 

    foreach($tables as $key => $total){  
        echo $colors[$loop] ."<br>";

        echo
            "<script>
                var divName = '<div id=\"$key\"><label class=\"mb-0\">$key</label><div class=\"progress\"><div class=\"$key $colors[$loop] progress-bar progress-bar-striped progress-bar-animated\" role=\"progressbar\" style=\"width: 0%\" aria-valuenow=\"0\" aria-valuemin=\"0\" aria-valuemax=\"100\"></div></div></div>';                  
                $('.modal-body').append(divName);
            </script>";

        for($i = 0; $i <= $total; $i++){    
            // echo "<script> $('#$key').show(); </script>";
    
            $percent = intval($i / $total * 100);
            setTime(1);
    
            echo
                "<script>
                    $('.$key').attr('aria-valuenow', $percent).css('width', $percent + '%').text($percent + '%');
                </script>";
            flushLoad();
        }
        $loop++;
    }

    sleep(5);
    echo "<script> $('#myModal').modal('hide'); </script>";

    function setTime($n){
        return sleep($n);
    }
    
    function flushLoad(){
        ob_flush();
        flush();
    }
    echo "<script> location.href='index.php'; </script>";
?>
onKeyPress, onKeyUp
<html>
<body>
    <input id="edValue" type="text" onKeyPress="edValueKeyPress()" onKeyUp="edValueKeyPress()"><br>
    <span id="lblValue">The text box contains: </span>
</body>

<script>
    function edValueKeyPress()
    {
        var edValue = document.getElementById("edValue");
        var s = edValue.value;
    
        var lblValue = document.getElementById("lblValue");
        lblValue.innerText = "The text box contains: "+s;
    
        //var s = $("#edValue").val();
        //$("#lblValue").text(s);    
    }
</script>    

</html>


https://jsfiddle.net/VDd6C/8/
autofocus
<button onclick="discountModal('modalName')">Discount</button>
<div class="modal fade" id="modalName" data-backdrop="static">
<input type="number" id="discount" autocomplete="off">
</div>

function onclickModal(){
        $('#modalName').modal('show');
        $('#modalName').on('shown.bs.modal', function () {
           $('#discount').focus();
        });
    }
Dynamic
function onclickModal($name){
        var name = $name;
        $('#'+name).modal('show');
        $('#'+name).on('shown.bs.modal', function () {            
            $('#'+name+' input').focus(); 
        });
    }
How can I check if a checkbox is checked?
<div class="form-group form-check">
                            <input type="checkbox" class="form-check-input" id="approve">
                            <label class="form-check-label" for="approve">Appointment approve?</label>
                        </div>

if (document.getElementById('approve').checked) {
            alert("checked");
        } else {
            alert("You didn't check it! Let me check it for you.");
        }


https://stackoverflow.com/questions/9887360/how-can-i-check-if-a-checkbox-is-checked
get data attribute value of selected option
<select>
    <option data-id="1">one</option>
    <option data-id="2">two</option>
    <option data-id="3">three</option>
</select>

You need to find the selected option:

$(this).find(':selected').data('id')
or

$(this).find(':selected').attr('data-id')
although the first method is preferred.


 <select class="form-control" id="category" name="category" required>
                                                        <option for="123" value="">Select a Type</option>

 $(document).on("change", "#category", function() {
        // var category = document.querySelector("#category");
        // var value = category.options[category.selectedIndex].getAttribute('for');
        var value = $(this).find(':selected').attr('for')
        console.log(value);
}

        var value = $("#category").find(':selected').attr('for')
table [show]
<?php 	
	$sql="select*from child";
	$result=mysqli_query($conn,$sql);	
?>
    <h1 class="text-center mb">User information</h1>

    <table class="table"  border="1">
      	<thead>
                <th>Id</th>        
        	<th>Name</th> 
      	</thead>
      	<tbody>
		<?php while ($row=mysqli_fetch_assoc($result)) { ?>
			<tr>
		       	  <td><?php echo $row['id'];?></td>
		          <td><?php echo $row['name'];?></td>          
		        </tr>
			<td>
  				<a class="btn btn-info" href="view.php?id=<?php echo $row['id']; ?>">View</a>
  				<a class="btn btn-danger" onclick="return confirm('Are you sure?')"
					href="delete.php?id=<?php echo $row['id']; ?>">Delete</a>
  			</td>
	     	<?php } ?>
      	</tbody>
    </table>
alert
(1st part) ex: edit.php
	header("Location: index.php?success=1");
	<a class="btn btn-info" href="view.php?success=1">
	$_SESSION['success']=1;  //true
NB: number not mandatory

(2nd part...) 
<div class="col-md-9">
	<?php if(isset($_GET['success'])) { ?>
		<div class="alert alert-success">
			<strong>Success!</strong> Added successfully.
		</div>
	<?php } ?>
</div>

session_start();

<div class="col-md-9">
	<?php if(isset($_SESSION['success'])) { ?>
		<div class="alert alert-success">
			<strong>Success!</strong> Added successfully.
		</div>
	<?php } ?>
</div>
unset($_SESSION['success']);

NB: alert list
success, danger, info, warning

CSS: .alert {
  padding: 20px;
  background-color: #f44336;
  color: white;
}


<a href="index.php" class="confirmation"></a>
<script>
    $('.confirmation').on('click', function () {
        return confirm('Are you sure?');
    });
</script>

<a class="btn btn-danger btn-fill pull-center" onclick="return confir
table [show]
<?php $sql="select*from child where id=$id";
	$result=mysqli_query($conn,$sql);
  $row=mysqli_fetch_assoc($result); ?>

<table class="table">
	<tr>
		<th width="100" class="text-right">Name : </th>     
		<td class="text-left"> <?= $row['name']; ?></td>     
	</tr>
	<tr>
		<th width="100" class="text-right">Roll : </th> 
		<td class="text-left"> <?= $row['roll']; ?> </td>     
	</tr>
	<tr>
		<th width="100" class="text-right">Age : </th>    
		<td class="text-left"> <?= $row['age']; ?> </td>     
	</tr>					
</table>
table [edit]
<?php 
  	$id= $_GET['id']; 
	$conn=connectDB();
	$sql="select*from child where id=$id";
	$result=mysqli_query($conn,$sql);	
  	$row=mysqli_fetch_assoc($result);  
?>
  <h2>Edit Student</h2>

  <form action="update.php?id=<?php echo $id ?>" method="POST">

    	<div class="form-group">
      	<label for="name">Name: </label>
      	<input type="text" class="form-control" name="" placeholder="" value="<?= $row['name']; ?>" >
    	</div>

    	<div class="form-group">
      	<label>Roll: </label>
      	<input type="text" class="form-control" name="" placeholder="" value="<?= $row['roll']; ?>">
    	</div>

    	<div class="form-group">
      	<label>Age: </label>
      	<input type="text" class="form-control" name="" placeholder="" value="<?= $row['age']; ?>">
    	</div>
    
    	<button type="submit" class="btn btn-primary">Submit</button>
</form>
auth
laravel: 5.9 last
php artisan make:auth

laravel: 6.0 
composer require laravel/ui
php artisan ui vue --auth

laravel: 7.0
composer require laravel/ui:^2.4
php artisan ui vue --auth

laravel: 9
composer require laravel/ui
php artisan ui bootstrap
php artisan ui bootstrap --auth
database & backend code
1) create only database name in phpmysql
2) In project select [.env] see line no 9-14
	change it 
	DB_DATABASE=DB Name
	DB_USERNAME=root
	DB_PASSWORD=
3) Restart [php artisan serve] Off (Ctrl+C) then On
1st time Go
app/Providers/AppServiceProvider
write:  use IlluminateSupportFacadesSchema;  [line 6]
	   Schema::defaultStringLength(191); [function booth line 26]

php artisan migrate
php artisan migrate:status	[see create database]
php artisan migrate:rollback [remove data from database]
php artisan migrate:refresh or fresh  [remove data then create database]
1071 laravel error
edit your AppServiceProvider.php file and
 inside the boot method set a default string length:

use IlluminateSupportFacadesSchema;
public function boot()
{
    Schema::defaultStringLength(191);
}

app/Providers/AppServiceProvider
write:  use IlluminateSupportFacadesSchema;  [line 6]
	   Schema::defaultStringLength(191); [function booth line 26]
Session
Controller:
      return back()->with('status', 'Product insert successfully');

page.blade.php:

	@if (session('status'))
        	<div class="alert alert-success" role="alert">
                	{{ session('status') }}
                 </div>
        @endif
all in one
create model
$php artisan make:model Model_name -m

migrate
$ php artisan migrate

create controller
$ php artisan make:controller Controller_name

model, controler, migration all

$php artisan make:model Category -mc

Output all and also controller seen like CategoryController
but we put only Category
Laravel timeZone
https://carbon.nesbot.com/docs/
//All time zone set  [go config/app.config/line no 70]
'timezone' => 'UTC',  
to 
'timezone' => 'Asia/Dhaka', 

php artisan config:clear

Controller: 
Carbon::now('Asia/Dhaka')

Blade:
{{ $category->created_at->diffForHumans() }}
Laravel latest value show
@php
	$menus=App\Category::latest()->take(5)->get();
@endphp

@foreach ($menus as $menu)
	{{$menu->category_name}}	
@endforeach

Output: Now show the latest five(5) category name
view() redirect() back() with()
suppose your page location: 'contact' page
blog
---->views
	----->layouts
			--->home
			--->about
			--->contact
My present location 'contact' page and a action page working now
1) return view('layouts/contact', compact('something'));
	N:B: session   with()  not allow

2) return redirect(contact)->with('status', 'message allow');
	N:B: session with() allow

3) return back()->with('status', 'message allow');
	N:B: session with() allow


Session:

withStatus('Message send successfully!);

same meaning but 'status' should capital letter


@if (session('status'))
       <div class="alert alert-success" role="alert">
              {{ session('status') }}
       </div>
@endif
Laravel Mail
link: https://www.youtube.com/watch?v=iQoRh_9LkjU

video :9  duration: 33:55

https://laravel.com/docs/5.8/mail

#Driver Prerequisites
composer require guzzlehttp/guzzle

#generating-mailables
php artisan make:mail OrderShipped

N:B: Sometime it don't work when compact send the variable file.
So it is better to follow video link
error reporting
@php
	error_reporting(0);
@endphp
laravel github project run
Hello friends... Today I am going to show how to run github laravel projects.
link: https://www.youtube.com/watch?v=ngzOHoyITfM

1. download the laravel project from github.
2. copy that project in hotdocs folder and open the folder location in cmd.
3. now first rename the "env.example file to.env"
4. you can configure the database information here.
5. now open cmd and run some commands...
  composer install or php composer.phar install
  php artisan key:generate
  php artisan migrate
  php artisan db:seed to run seeders, if any.
  php artisan serve

that's all.. 
Problems discussion::
you may have the problem with the composer or the php...
check all are installed.. and the paths are added as the environment variable...
These two paths have to be added to run laravel project...
1. C:ProgramDataComposerSetupin
2. C:xamppphp 

if these are not added.. then add them 
.. thank you very much for watching... Please subscribe and share...:)
Categ
image upload
[video 6 [00.20.00]]
http://image.intervention.io/getting_started/installation
1st step: 
$composer require intervention/image

2nd step:
go-> config/app.php

search-> $providers [array]

paste: Intervention\Image\ImageServiceProvider::class,


search-> $aliases [array]
'Image' => Intervention\Image\Facades\Image::class,

3rd step:
use Image;

function insert_product(Request $request) {

//this part not need for image upload...
	$last_inserted_id = Product::insertGetId([
        	 'category_id'=>$request->category_id,
         	'name'=>$request->name
]);
      if ($request->hasFile('product_image')) {  //please link image upper... use Image;
            $photo_to_upload=$request->product_image;
            $fileName=$last_inserted_id.".".$photo_to_upload->getClientOriginalExtension();
            Image::make($photo_to_upload)->resize(400,380)
->save(base_path('public/Full_Project/images/product_images/'.$fileName));  
            //Image quality   save(ba
laravel project upload
https://www.youtube.com/watch?v=e7eSJCevo4c
Simple Laravel Layouts
https://scotch.io/tutorials/simple-laravel-layouts-using-blade
Laravel Calculate Age
<td>
       {{ $SingerList->DOB}} <br>
       {{\Carbon\Carbon::parse($SingerList->DOB)
	->diff(\Carbon\Carbon::now())
	->format('%y years, %m months and %d days')}}
</td>

Example:
Input: 1994-08-06

Output: 
1994-08-06 
25 years, 5 months and 16 days
Laravel pagination
Note : GET method
1) blade.php
   <form action="{{ url('all_singerName')}}" method="get">
      <input type="text" name="singerName" value="{{ old('singerName')}}" class="form-control" placeholder="Name">        
      <button class="btn btn-success btn-block" type="submit">Add Now</button>         
   </form>

2) web.php
   Route::get('all_singerName', 'Singer@all_singerName');

3)
   public function all_singerName(Request $request){
      $email = Auth::user()->email;

      $singerName = $request->singerName;

      {{-- 1st way input --}}
      $all_songs = AllSong::where('email', $email)->where('singerName', $singerName)->paginate(5);

      {{-- 2nd way input --}}
      $all_songs = AllSong::where('email', 'Like', '%'.$email.'%')->where('singerName', 'Like', '%'.$singerName.'%')->paginate(5);
      $all_songs->appends($request->only('singerName')); //get request

      return view('singerName', compact('all_songs'));
   }

4) Output 

   <div class="card-body">
      <table class="table">
            <tr class="text-center">
               <th>Sl. No</th>
               <th>Song name</th>                                             
            </tr>
         </thead>
         <tbody>
         
            @forelse($all_songs as $all_song)
               <tr class="text-center">
                  <td>{{$loop->index + $all_songs->firstItem()}}</td>
                  <td>{{ $all_song->songName}}</td> 
               </tr>
            @empty
               <tr class="text-center text-danger">
                  <td colspan="2">No data found...</td>
               </tr>
            @endforelse
         </tbody>
      </table>

      {{-- 1st way input --}}
      {{$all_songs->appends($_GET)->links()}}

      {{-- 2nd way input --}}
      {{$all_songs->links()}} 
      Or
      {{$all_songs->appends($_GET)->links()}}
   </div>
email (smtp)
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=aslamhossainctg@gmail.com
MAIL_PASSWORD=swnwfctznnjruscc
MAIL_ENCRYPTION=tls
laravel date
<td>
      {{ $category->created_at->format('d-M-Y  h:i:s A')}}
      {{ date('Y-m-d  h:i A', strtotime($category->created_at)) }}
      <br>
      {{ $category->created_at->diffForHumans()}}
</td>

date age

{{\Carbon\Carbon::parse($SingerList->DOB)->diff(\Carbon\Carbon::now())->format(' %y years ')}} 

{{ \Carbon\Carbon::parse($Song->created_at)->diffForHumans() }}
last five years
@foreach(range(date('Y')-5, date('Y')) as $y)
      {{$y}}
@endforeach 

output: 
2015 	2016	2017 	2018	 2019	 2020
.env.example to .env
https://www.youtube.com/watch?v=xBFPGTle7nU

cmd

C:\Users\Aslam>cd C:\xampp\htdocs\folderName

dir

ren .env.example .env
Tinker
https://artisansweb.net/use-laravel-tinker/

composer require laravel/tinker
php artisan make:model Product
php artisan tinker

$p = new App\Product;
$p->name = 'Test Product';
$p->description = 'Test Product Body';
$p->password = Hash::make(12345678)
$p->save();

Output:
$a = new App\user;
$a = \App\user::first();
=> App\User {
     id: 1,
     name: "aslam2",
     email: "admin@admin.com",
     email_verified_at: null,
     created_at: "2020-07-15 15:47:09",
     updated_at: "2020-07-15 15:47:09",
   }
date & time
date_default_timezone_set("Asia/Dhaka");
$today= date("Y-m-d-D");

$lastDay = 
date ("Y-m-d", strtotime("-1 day", strtotime($today))); 
$lastMonth = 
date ("Y-m-d", strtotime("-1 month", strtotime($today))); 
$NextYear = 
date ("Y-m-d", strtotime("1 year", strtotime($today))); 

$todayday = date('l', strtotime($today));
small [L]
Ex: saturday, sunday etc...

$day = date('d', strtotime($lastMonth));
$month = date('m', strtotime($lastMonth));
$year = date('Y', strtotime($lastMonth));

Time	
//Example Y-m-d H:i:s date string.
$date = '2019-02-15 16:56:01';
 
//12 hour format with lowercase AM/PM
echo date("g:ia", strtotime($date))
echo date("h:ia", strtotime($date))
Ex: g= 05=5 without zero
	h=05=05 full
a= small am/pm  A=capital AM/PM

 $total=strtotime($end_time) - strtotime(date("H:i:s"));
   $minute=$total/60;
   $total=$minute/60;

Different two date
$startdate->diff($endDate)->format('%y years, %m months and %d days')
db connection
input 1: $conn
<?php
	function connectDB() {
	$conn =mysqli_connect('localhost','root','','bazar');
	return $conn;
	}
?> NB: server, user name, pass, db name

Call this function
<?php  $code = conn() ;?>

input 2: $result
<?php
	$conn=connectDB();
	$sql="select*from userinfo";
	$result=mysqli_query($conn,$sql);
	return $result;
?>
session
session_start();
 $_SESSION['adminLogin']=true; 
 $_SESSION['login']=$admin;
unset($_SESSION['id_pass_fail']);

/*logout*/
session_start();
session_destroy();

<?php $_SESSION['successfully']=true; ?>

<?php if(isset($_SESSION['successfully'])) { ?>
    <?php 
        if (isset($_GET['type'])) {
            $code_type =  $_GET['type'];
        }
        echo '<script type="text/javascript">
                alert("Hellow [  '.$code_type.'  ] code insert successfully.");
                </script>';
    ?>
<?php } ?>
include
<?php  include('connection.php'); ?>
header
<?php header("Location: index.php?id=$id"); ?>

<a href="index.php?id=$id"></a>

 echo "<script>window.location.href='index.php?id=$id'</script>";

$id= $_GET['id'];
isset
session_start();
if(!isset($_SESSION['login'])){
    header("location: index.php");
}
if(isset($_SESSION['login'])){
    header("location: about.php");
}
login, logout
(1st page) ex: login.php
up page:  <?php session_start(); ?>
..............
..............
(2nd page) ex: confirmLogin.php
$email=$_POST['email'];
$pass=$_POST['password'];

$sql="select * from admin where email='$email' AND password='$pass'";
$rowcount=mysqli_num_rows($result);

if($rowcount==1) {
	$_SESSION['login']=true;	
	header("Location: index.php");
} else {
......................
......................

(3rd page) ex: index.php

up page:  <?php session_start(); 
if(!isset($_SESSION['login'])){
header("Location: login.php");
}

(4th page) ex:logout.php
<?php 
session_start();
session_destroy();
header("Location: login.php");

description limitation
<a href="view.php" class="btn btn-default">
<?= substr($row['description'], 0, 80) . '...' ?>
</a>
confirm password
(2nd page )
<?php
$name=$_POST['name'];
$pass=$_POST['pass'];
$conPass=$_Post['con_pass'];

	if($pass !=$conPass) {
	session_start();
	$_SESSION['error_msg']="password and confirm Password don't match";
	heade("Location: registration.php");
?>
	$con=.....
	$sql="insert into ....";

(1st page registration.php)
<?php if(isset($_SESSION['error_msg'])) { ?>
	<div class="alert alert-warning">
	<strong>Warning!</strong> <?php echo $_SESSION['error_msg']; ?>
	</div>
<?php } ?>
root path
<?php
	$url='http://localhost/class/blog/admin/';
?>

<a href="<?php echo $url; ?> post/index.php"> Post </a>
image upload
image is (varchar(150))
(1st page)
<form action="store.php" enctype="multipart/form-data" method="POST">
	<label	for="image">Image</lable>
	<input	type="file" name="president_photo">	
</form>

(2nd)
N:B: "upload" folder will be root position
$president_photo='profile_picture/'. $_FILES['president_photo']['name'];
move_uploaded_file($_FILES['president_photo']['tmp_name'],$president_photo);
$sql= "insert.... (null, $president_photo);

(3rd index.php)
image show when click the "view" button

<img src="<?php echo $row['image']; ?>" width='100'>
	
(4th) click 'delete' button

$id=$_GET['id'];
$sql="select*from posts where id=$id'";
$data=mysqli_fetch_assoc($reslt);
$image_location='$data['image'];

if(file_exists($image_location)){
unlink($image_location);=> for image delete code(unlink)
}

$sql="delete*from posts where id=$id'";
$result;
header ('Location: index.php');

if(file_exists($image_location)){
	echo "File have";
}else{
echo "don't have";
}
calculating Age
$_age = floor((time() - strtotime('1986-09-16')) / 31556926);

31556926 is the number of seconds in a year.

[365*24*60*60]
random number
use Illuminate\Support\Str;
 echo Str::random(10);

echo time()."<br>";
echo microtime(true)."<br>";
echo uniqid()."<br>";
echo rand()."<br>";
echo rand(2,50)."<br>";

$uniqid = uniqid();
$rand_start = rand(1,5);
$rand_8_char = substr($uniqid,$rand_start,8);

echo '<script type="text/javascript">
	alert("See Logic: Result will be 8 digit:
Full: '.$uniqid.'
Distance:  '.$rand_start.'
Result:   '.$rand_8_char.'");
		      </script>';
replace
$search = array("_", "-", "A");
$replace  = array("/", "_", "a");
$target='A_s-lAm';
$result=str_replace($search, $replace, $dob.$today);

echo $result;
input		A_s-lAm
Output		a/slam
time
Time to time minus or plus

$total=strtotime("12:10") - strtotime("12:00");
Ans: 600

only time: 
$total=strtotime("10:10");
ans: 1564373400
because it convert to year from now then convert to second

So u should convert it...
$total=strtotime("10:10") - strtotime("09:00");
ans:4200

$total=strtotime("10:10") - strtotime("00:00");
ans:36600 [10h*60m + 10=610m*60s=36600s]






php page code
// Only page name
//Smart way
echo basename($_SERVER['PHP_SELF']);
Output: page.php

// Old way
$folder = "/job/";
$link = $_SERVER['PHP_SELF']; 
Output:  /job/page.php
$page = str_replace($folder, "", $link);
Output: page.php

Suppose my server URL now....  
http://localhost/job/page.php?id=1

php code...
1) echo $_SERVER['PHP_SELF'];	
Output: /job/page.php

2) echo $_SERVER['SERVER_NAME'];	
Output: localhost

3) echo $_SERVER['REQUEST_URI'];	
Output: /job/page.php?id=1

So if i want full URL i can use
1) echo $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'];
Output: localhost/job/page.php

2) echo $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
Output: localhost/job/page.php?id=1 

3) Full URL
$_SERVER['SCRIPT_FILENAME'];
Output: E:/laragon/www/job/page.php?id=1 

4)  After all
$from	= $_SERVER['REQUEST_URI'];
$to	= $_SERVER['PHP_SELF'];

$goTo = str_replace($from, $to, $from);

N:B: It work only project name then show URL.
So it is helpfull for redirect to final page 

Example:
from) /project/page.php
to)   /project/loginPage.php?id=2

goTo) /project/loginPage.php?id=2
How to remove -index.php- from the URL
This is the basic rule to hide index.php 
from the URL. Put this in your root .htaccess file. 
mod_rewrite must be enabled with PHP 
and this will work for the PHP version 
higher than 5.2.6.
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
For PHP version less than 5.2.6 try this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
You can also use the following code:
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /(.*)index.php($| |?)
RewriteRule ^ /%1 [R=301,L]
Code for Database Class (PHP-MySQLi Connection)
config.php
<?php
define("DB_HOST", "localhost");
define("DB_USER", "root");
define("DB_PASS", "");
define("DB_NAME", "your_db_name");
?>
Database Calss:
<?php
Class Database{
 public $host   = DB_HOST;
 public $user   = DB_USER;
 public $pass   = DB_PASS;
 public $dbname = DB_NAME;
 
 
 public $link;
 public $error;
 
 public function __construct(){
  $this->connectDB();
 }
 
private function connectDB(){
 $this->link = new mysqli($this->host, $this->user, $this->pass, 
  $this->dbname);
 if(!$this->link){
   $this->error ="Connection fail".$this->link->connect_error;
  return false;
 }
 }
 
// Select or Read data
public function select($query){
  $result = $this->link->query($query) or 
   die($this->link->error.__LINE__);
  if($result->num_rows > 0){
    return $result;
  } else {
    return false;
  }
 }
 
// Insert data
public function insert($query){
 $insert_row = $this->link->query($query) or 
   die($this->link->error.__LINE__);
 i
Session Class for any PHP Project
Session.php
<?php
/**
*Session Class
**/
class Session{
 public static function init(){
  if (version_compare(phpversion(), '5.4.0', '<')) {
        if (session_id() == '') {
            session_start();
        }
    } else {
        if (session_status() == PHP_SESSION_NONE) {
            session_start();
        }
    }
 }

 public static function set($key, $val){
  $_SESSION[$key] = $val;
 }

 public static function get($key){
  if (isset($_SESSION[$key])) {
   return $_SESSION[$key];
  } else {
   return false;
  }
 }

 public static function checkSession(){
  self::init();
  if (self::get("login")== false) {
   self::destroy();
   header("Location:login.php");
  }
 }

 public static function checkLogin(){
  self::init();
  if (self::get("login")== true) {
   header("Location:index.php");
  }
 }

 public static function destroy(){
  session_destroy();
  header("Location:login.php");
 }
}
?>
Use for Login Controller:
<?php
/**
* 
Use for Sample Login Page:
<?php 
 include '../lib/Session.php';
 Session::init();
?>

<?php include '../config/config.php'; ?>
<?php include '../lib/Database.php'; ?>
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Login</title>
<link rel="stylesheet" type="text/css" href="css/stylelogin.css"/>
</head>
<body>
<div class="container">
<section id="content">
<?php
 $db = new Database();

 if($_SERVER["REQUEST_METHOD"] == "POST"){
 $username = mysqli_real_escape_string($db->link, $username);
 $password = mysqli_real_escape_string($db->link, $password);

    $query = "SELECT * FROM user WHERE username='$username' 
     and password='$password'";
    $result = $db->select($query);
    if ($result != false) {
        $value = $result->fetch_assoc(); 
        Session::set("login", true);
        Session::set("username", $value['username']);
        Session::set("userId", $value['id']);
        header("Location: index.php");
       //echo "<script>window.location = 'index.php';</scri
if (ternary operator)
{{ ($category->menu_status == 1) ? 'Yes':'No'}}

it means

if($category->menu_status == 1){
    echo "Yes";
}else{
    echo "No";
}
DatePicker
Linl: https://gijgo.com/datepicker/example/bootstrap

<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Bootstrap DatePicker</title>
    <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://unpkg.com/gijgo@1.9.13/js/gijgo.min.js" type="text/javascript"></script>
    <link href="https://unpkg.com/gijgo@1.9.13/css/gijgo.min.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <input id="datepicker" width="270" />
    <script>
        $('#datepicker').datepicker({
            uiLibrary: 'bootstrap'
        });
    </script>
</body>
</html>
datatable
Source : 
server side rendering
https://datatables.net/

head:
-----
   <link rel="stylesheet" href=" //cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css">

body:
-----
   <table class="table table-bordered">
      <thead>
         <th>Sl</th>
         <th>Name</th>
         <th>age</th>
         <th>Action</th>
      </thead>
      <tbody>
         <tr>
            <td width="10">1</td>
            <td>Mr Jhon</td>
            <td>20</td>
            <td width="15">
               <div class="btn-group">
                  <a class="btn btn-sm btn-outline-info py-0 " href=" ">View</a>
                  <a class="btn btn-sm btn-outline-danger py-0 " href="">Delete</a>
               </div>
            </td>
         </tr>
         <tr>
            <td width="10">1</td>
            <td>Mr Jhon2</td>
            <td>19</td>
            <td width="15">
               <div class="btn-group">
                  <a class="btn btn-sm btn-outline-info py-0 " href=" ">View</a>
                  <a class="btn btn-sm btn-outline-danger py-0 " href="">Delete</a>
               </div>
            </td>
         </tr>
      </tbody>
   </table>

end body:
footer:
---------
   <script src="//cdn.datatables.net/1.11.4/js/jquery.dataTables.min.js"></script>

   <script type="text/javascript">
      $(document).ready( function () {
         $('.table').DataTable();
      } );

      $('.table').DataTable({
         "lengthMenu": [ [5, 10, 25, 50, -1], [5, 10, 25, 50, "All"] ]
      });
   </script>


stylesheet:
-----------
/*Datatable*/
/*header & footer*/
.dataTables_wrapper .dataTables_length, 
.dataTables_filter, 
.dataTables_info, 
.dataTables_paginate {
   background-color: paleturquoise;

}

.dataTables_wrapper .dataTables_filter, 
.dataTables_wrapper .dataTables_paginate{ 
   float: none;
}

.dataTables_wrapper .dataTables_length label, 
.dataTables_wrapper .dataTables_filter label{ 
   padding: 0.175rem 0.5rem; 
   margin-bottom: 0rem; 
}

/*header left + right*/
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
   background-color: #fff; padding: 0px;
}

/*Table body*/

table.dataTable { margin: 5px 0px; border-collapse: collapse; }

.table-bordered, .table-bordered td, .table-bordered th { /*border: 1px solid #dee2e6; border: 1px dashed;*/ }

table.dataTable thead th, table.dataTable.no-footer{ border-bottom: unset; }

table.dataTable thead th, 
table.dataTable thead td { padding: 2px 20px; text-transform: capitalize; 
   background-color: turquoise; text-align: center;
}

table.dataTable tbody td { text-align: center; vertical-align: middle; padding: 2px; }
table.dataTable tbody tr { background-color: whitesmoke; }


/*Buttom*/
.dataTables_wrapper .dataTables_info { padding: 0.5rem; }
.dataTables_wrapper .dataTables_paginate { padding: 0.25em; }

.dataTables_wrapper .dataTables_paginate .paginate_button { 
   min-width: 1.5em; padding: 0.2em 0.6em; margin-left: 2px;
}

<--The end-->
datatable order by
 // datatable order by
         // https://datatables.net/reference/api/order()
<script>
         var table = $('.table').DataTable();
 
         // Sort by column 1 and then re-draw
         table
             .order( [ 0, 'desc' ] )      //[ 0, 'asc' ], [ 1, 'asc' ] ist part work properly, 
             .draw();                     // 0, 1, 2 colum number

</script>
join table
create table student_info(
	roll int NOT NULL AUTO_INCREMENT,
	name varchar(30) NOT NULL,
	gender varchar(30),
	age int,
	PRIMARY KEY (roll)
	);

create table result_info(
	reg_number int NOT NULL ,
	roll int,
	gpa double(3,2),
	group_name varchar(30),
	gender varchar(30),
	PRIMARY KEY (reg_number)
	);

Query for details=>>

select student_info.roll, reg_number, name, student_info.gender, group_name, gpa
from student_info,result_info
where student_info.roll=result_info.roll;
insert
1)	$sql="insert into child values(null,'Raiz',15)";

2) 	suppose: 4 cloumn	(id, name, age, mobile)

if u insert all

insert into child (name, age, mobile) values ('Raiz',15, 0168060)";
id: auto increment...

3) 	if insert only name, mobile 

insert into child (name, mobile) values ('Raiz' 01680607293)";
N:B: Always fill up the 2nd column.
After (id) auto increment the 2nd column(name) must be filled.  123222333111
Search string
$search = "companyLogo/companyLogo";
      $row = CompanyLogo::where('id', 1)->where('imageSource', 'LIKE', '%'.$search.'%')->first();

      if ($row && $row!=null) {
         unlink($row->imageSource);
         
         CompanyLogo::find(1)->update([
            'imageSource'=>"backend/images/companyLogo/logo.jpeg",
            'created_at' => Carbon::now()
         ]);
         return back()->with('success',' Default logo selected..');

      }
      if($row==null){
         return back()->with('success',' Default logo already selected..');
      }
htaccess make
<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^ ^$1 [N]

    RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
    RewriteRule ^(.*)$ public/$1 

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ server.php

</IfModule>
delete
<!-- Blade file -->
	<div class="btn-group" role="group" aria-label="Basic example">
	   <a class="btn" href="{{ url('softDelete', $all_Code->id)}}" onclick="return confirm('Alert message')">Soft-Delete</a>
	   <a class="btn" href="{{ url('forceDelete', $all_Code->id)}}" onclick="return confirm('Alert message')">Fource Delete</a>
	   <a class="btn" href="{{ url('restore', $all_Code->id)}}">Restore</a>
           <a class="btn" href="{{ url('trashedCode')}}">Trashed Code</a>
	</div>


<!-- web.php -->
	Route::get('softDelete/{id}', 'CodeController@softDelete')->name('softDelete');
	Route::get('forceDelete/{id}', 'CodeController@forceDelete')->name('forceDelete');
	Route::get('restore/{id}', 'CodeController@restore')->name('restore');
	Route::get('trashedCode', 'CodeController@trashedCode')->name('trashedCode');


<!-- Controller -->

	public function softDelete($id){
	   AllCode::find($id)->delete();
	   return back()->with('danger', 'Code soft delete successfully');
	}

	public function forceDelete($id){
	   AllCode::onlyTrashed()->find($id)->forceDelete();
	   return back()->with('forceDelete', 'Code permanently delete successfully');
	}

	public function restore($id){
	   AllCode::onlyTrashed()->find($id)->restore();
	   return back()->with('success', 'Code restore successfully');
	}
	public function trashedCode(){
	   $AllCodes = App\AllCode::onlyTrashed()->get();
           
           foreach($AllCodes as $all_Code){
              echo $all_Code->id;
           }
	}
composer & version
Composer
	composer
Update : composer self-update [Ex: 1.0 to 2.0]
return old : composer self-update --rollback [Ex: 2.0 to 1.0]

Laravel
	php artisan --version
        Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})

php
	php -v
        php -version
        php --version
laravel collection
$LanguageKeys = App\LanguageKey::pluck('id');

$dataList  = collect($subtitleKeys)->unique()->pluck('languagekey_id');
double id pass
<a class="btn" href="{{url('/edit', [$user->id, $user->age])}}">

Route::get('edit/{id}/{age}', 'Controller@edit')->name('edit');

public function edit(Request $request){
      echo $request->id;
      echo $request->age;
}
status change
Blade :
<td>
    @if($social->status == 1)
        <a href="{{ url('change', [$social->id, $social->status])}}" class="btn">Active</a>
    @else
        <a href="{{ url('change', [$social->id, $social->status])}}" class="btn">Inactive</a>
    @endif
</td>

web.php :
Route::get('/change/{id}/{status}', 'Controller@change')->name('change');

Controller :
public function change($id, $status){

   	$socialId = SocialMedia::find($id);

      if ($status == 0) {
         $socialId->status = true;
      }
      if ($status == 1) {
         $socialId->status = false;
      }      
      $socialId->save();
      
      return back()->with('success','Social media status change');
   }

N:B: if change have 1 button
public function change($id){
    if(SocialMedia::find($id)->status==0){
         SocialMedia::find($id)->update([
             "status" => true
         ]);
   }else{
         SocialMedia::find($id)->update([
            "status" => false
         ]);
   }
}
Relationship error
ErrorException
Trying to get property 'name' of non-object 
Solve : 
{{$alluser->admin->name}}
{{$alluser->admin['name']}}
Trying to access array offset on value of type null
catch the relationship error on missing foreign key
------
public function ApproveBy(){
     return $this->belongsTo(Admin::class, 'approveBy', 'id')->withDefault();
}
------
{{ $term->ApproveBy['name']}}
Redirect to a Specific Tab in Laravel
blade:

   <header class="panel-heading panel-heading-gray custom-tab ">
      <ul class="nav nav-tabs mt-2" id="tabMenu">
         <li class="nav-item">
            <a href="#firstTab" data-toggle="tab" class="active">1st tab</a>
         </li>
         <li class="nav-item">
            <a href="#secondTab" data-toggle="tab">2nd tab</a>
         </li>                      
      </ul>
   </header>

   <div class="panel-body">
      <div class="tab-content">  
         <div class="tab-pane active" id="adminSocialMedia">
            <a href='{{ url('firstTab') }}' target="_blank">Click 1st tab</a>
         </div>
          <div class="tab-pane active" id="adminSocialMedia">
            <a href='{{ url('secondTab') }}' target="_blank">Click 2nd tab</a>
         </div>
      </div>
   </div>

Controller:
   public function secondTab(){
      return back()->with('success', 'This 2nd tab alert')
      ->withInput(['tab' => 'secondTab']);
   }

Js :
   <script>
      //redirect to specific tab
      $(document).ready(function () {
         $('#tabMenu a[href="#{{ old('tab') }}"]').tab('show')
      });
   </script>

Link: https://medium.com/@grmcameron/redirect-to-a-specific-tab-in-laravel-149398a9e655
Route hightlight [Side bar]
<li class="nav-item start {{ (request()->routeIs('socialMedia*'))  ? 'active' : '' }}">
   <a href="#" class="nav-link nav-toggle">
      <i class="far fa-share-square" aria-hidden="true"></i>
      <span class="title">Social Media</span>
      <span class="selected"></span>
      <span class="arrow open"></span>
   </a>
   <ul class="sub-menu">
      <li class="nav-item {{ (request()->routeIs('socialMedia.admin*'))  ? 'active' : '' }}">
         <a href="{{ route('socialMedia.admin') }}" class="nav-link ">
            <span class="title">Admin</span>
         </a>
      </li>
      <li class="nav-item {{ (request()->routeIs('socialMedia.owner*'))  ? 'active' : '' }}">
         <a href="{{ route('socialMedia.owner') }}" class="nav-link ">
            <span class="title">Owner</span>
         </a>
      </li>
   </ul>
</li>

Route hit [route name]
	<li class="nav-item {{ (request()->routeIs('socialMedia.admin*'))  ? 'active' : '' }}">
      <a href="{{ route('socialMedia.admin') }}" class="nav-link">
         <span class="title">Admin</span>
      </a>
   </li>

	Route::get('/social-media/admin','Admin\SocialMediaController@admin')->name('socialMedia.admin');


url hit [route url]
   <a class="btn btn-primary" href='{{ url('social-media/admin') }}'>Admin Social Link</a>

   Route::get('/social-media/admin','Admin\SocialMediaController@admin')->name('socialMedia.admin');
Clear
Route::get('/clear', function() {
   Artisan::call('cache:clear');
   Artisan::call('config:clear');
   Artisan::call('config:cache');
   Artisan::call('view:clear');
   Artisan::call('route:clear');   
   
   return "Cleared!";
});

php artisan optimize
migrate
migrate                                                                                                                            
      migrate:fresh                                                                                                                      
      migrate:install                                                                                                                    
      migrate:refresh                                                                                                                    
      migrate:reset                                                                                                                      
      migrate:rollback                                                                                                                   
      migrate:status 

Rollback[Drop] Last table
N:B: Migrate table's "batch" colum's value will be big
php artisan migrate:rollback
then
php artisan migrate

[Special]
if batch serial no :: 2,2,2,2
if i want rollback last one by primary key
php artisan migrate:rollback --step=1
output : 2,2,2
if i want rollback last two by primary key
php artisan migrate:rollback --step=2
output : 2
then migrate

Warning for below
Be careful! This command will drop all data from your DB:

Rollback[Drop] all table
php artisan migrate:reset

Rollback[Drop] & migrate all table
php artisan migrate:fresh
or
php artisan migrate:refresh
google map api key
https://www.youtube.com/watch?v=OGTG1l7yin4&ab_channel=ImranEmu

1. Firstly Go to Google Maps - https://console.cloud.google.com/​
2. Sign In with your Google account and agree with the terms and conditions
3. Create a project and name it as you want
4. Select the project and click on it
5. Navigate to APIs and Services and  click on Libraries
6. Enable the following Libraries one by one 
   1. Google Javascript API 
   2. Google Place API 
   3. Google Direction  API 
   4. Google Geolocation API 
   5. Google Geocoding  API
7. Navigate to APIs and Services and  click on Credentials 
8. Click on Create Credentials and then the API key and it will show up a screen with API Key
9. Now you can optionally restrict the API key.


https://developers.google.com/maps/documentation/javascript/overview#Inline

<script async
    src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap">
</script>

if my key abc123
AIzaSyD6V8wBnr9Yb_kcXWFpTsT68okra7TxPCw

<script async
    src="https://maps.googleapis.com/maps/api/js?key=abc123&callback=loadMap">
</script>
route vs url
<li class="nav-item start {{ (request()->routeIs('socialMedia*'))  ? 'active' : '' }}">
   <a href="#" class="nav-link nav-toggle">
      <i class="far fa-share-square" aria-hidden="true"></i>
      <span class="title">Social Media</span>
      <span class="selected"></span>
      <span class="arrow open"></span>
   </a>
   <ul class="sub-menu">
      <li class="nav-item {{ (request()->routeIs('socialMedia.admin*'))  ? 'active' : '' }}">
         <a href="{{ route('socialMedia.admin') }}" class="nav-link ">
            <span class="title">Admin</span>
         </a>
      </li>
      <li class="nav-item {{ (request()->routeIs('socialMedia.owner*'))  ? 'active' : '' }}">
         <a href="{{ route('socialMedia.owner') }}" class="nav-link ">
            <span class="title">Owner</span>
         </a>
      </li>
   </ul>
</li>

Route hit [route name]
	<li class="nav-item {{ (request()->routeIs('socialMedia.admin*'))  ? 'active' : '' }}">
      <a href="{{ route('socialMedia.admin') }}" class="nav-link">
         <span class="title">Admin</span>
      </a>
   </li>

	Route::get('/social-media/admin','Admin\SocialMediaController@admin')->name('socialMedia.admin');


url hit [route url]
   <a class="btn btn-primary" href='{{ url('social-media/admin') }}'>Admin Social Link</a>

   Route::get('/social-media/admin','Admin\SocialMediaController@admin')->name('socialMedia.admin');
value to ignore
unique:users,username,id,1 // table, field, idcolumn, value to ignore
Ternary Operator
<a href="{{ url('owner/mealStatus', [$meal->id, 'breakfast'])}}"

Route::get('/mealStatus/{id}/{tab}','Owner\MealController@mealStatus')->name('owner.mealStatus');        

public function mealStatus($id, $tab){
      $mealId = Meal::find($id);
      ($mealId->status == true) ? $mealId->status = false : $mealId->status = true;     
      $mealId->save();  
      return back()->with('success','Meal status change')->withInput(['tab' => $tab]);
   }
laravel column
if (Schema::hasTable('users')) {
    // The "users" table exists...
}

if (Schema::hasColumn('users', 'email')) {
    // The "users" table exists and has an "email" column...
}
Order By Action
Sql table's[skill] column name : orderBy

Controller::
$data['Skill'] = Skill::orderBy('orderBy')->get();
return view('backend.pages.skills', $data);

Blade.php
@foreach($Skill as $item)
   <tr>
      <td width="8%">
         <div class="btn-group">
            <button type="button" class="btn dropdown-toggle" data-toggle="dropdown">
               <i class="far fa-check-circle"></i>
               {{$item->orderBy}}
            </button>
            <div class="dropdown-menu" style="min-width: 4rem; background-color: thistle;">
               @for($i=1; $i <= $Skill->count(); $i++)                                          
                  <a href="{{ url('orderBy', ['skills', $item->id, $i, 'tabName'])}}"
                     class="{{$i==$item->orderBy ? 'bg-info disabled pl-2' : 'text-center'}} dropdown-item">
                     @if($i==$item->orderBy)
                        <i class="far fa-check-circle"></i>
                     @endif
                     {{$i}}
                  </a>
               @endfor
            </div>
         </div>
      </td>
   </tr>
@endforeach

// Web.php   
Route::get('orderBy/{model}/{id}/{targetId}/{tab}','BackendController@orderBy')->name('orderBy');

// Controller
public function orderBy($model, $id, $targetId, $tab){
   DB::table($model)->where('id', $id)->update(['orderBy' => $targetId]);
   return back()->with('success', $model.' orderBy change')->withInput(['tab' => $tab]);
}
Return back
header("Location: home.php");
header('Location: ' . $_SERVER['HTTP_REFERER']);
Php faker
Base
   randomNumber // 79907610
   randomFloat // 48.8932
   randomLetter // 'b'

Lorem
   word // 'aut'
   sentence // 'Sit vitae voluptas sint non voluptates.'
   paragraph // 'Ut ab voluptas sed a nam. Sint autem inventore aut officia aut aut blanditiis.'
   text //($maxNbChars = 200) // 'Fuga totam reiciendis qui architecto fugiat nemo.'
   realText //Meaning full sentence...
   
Person                                       // 'Jr.'
   name($gender = null|'male'|'female')      // 'Dr. Zane Stroman'
   ssn                                       // '123-45-6789' [Social Security Number]
   
Address
   city                                // 'West Judge' //A city is a large and permanent settlement //Smaller than a state
   state                               // 'NewMexico' //A state is a larger area, which is often governed by its own government. 
                                       //Larger than a city
   postcode                            // '17916'
   address                             // '8888 Cummings Vista Apt. 101, Susanbury, NY 95473'
   country                             // 'Falkland Islands (Malvinas)'
   latitude($min = -90, $max = 90)     // 77.147489
   longitude($min = -180, $max = 180)  // 86.211205

PhoneNumber   
   phoneNumber             // '201-886-0269 x3767'
   
Company
   company                 // 'Bogan-Treutel'
   jobTitle                // 'Cashier'

DateTime
   unixTime($max = 'now')                // 58781813
   date($format = 'Y-m-d', $max = 'now') // '1979-06-09'
   time($format = 'H:i:s', $max = 'now') // '20:49:42'
   amPm($max = 'now')                    // 'pm'
   dayOfWeek($max = 'now')               // 'Friday'
   monthName($max = 'now')               // 'January'
   year($max = 'now')                    // '1993'   
   timezone                              // 'Europe/Paris'

Internet
   email                   // 'tkshlerin@collins.com'
   userName                // 'wade55'
   password                // 'k&|X+a45*2['
   url                     // 'http://www.skilesdonnelly.biz/aut-accusantium-ut-architecto-sit-et.html'
   slug                    // 'aut-repellat-commodi-vel-itaque-nihil-id-saepe-nostrum'
   macAddress              // '43:85:B7:08:10:CA'

Payment
   creditCardType          // 'MasterCard'
   creditCardNumber        // '4485480221084675'
   bankAccountNumber       // "SA0218IBYZVZJSEC8536V4XC"
   creditCardExpirationDateString // '04/13'
   iban($countryCode)      // 'IT31A8497112740YZ575DJ28BP4'
   swiftBicNumber          // 'RZTIAT22263'

Color
   hexcolor               // '#fa3cc2'
   rgbcolor               // '0,255,122'
   rgbCssColor            // 'rgb(0,255,122)'
   safeColorName          // 'yellow'
   colorName              // 'SkyBlue'
   
File
   fileExtension          // 'avi/jap/png'

Image
   imageUrl($width = 640, $height = 480) // 'http://lorempixel.com/640/480/'
   image($dir = '/tmp', $width = 640, $height = 480) // '/tmp/13b73edae8443990be1aa8f1a483bc27.jpg'
   
   uuid                    // '7e57d004-2b97-0e7a-b45f-5387367791cd'
                           [Universally unique identifier]

Barcode
   ean13          // '4006381333931' //International Article Number(ean)
   ean8           // '73513537'
   isbn13         // '9790404436093' //International Standard Book Number(isbn)
   isbn10         // '4881416324'

Miscellaneous
   boolean // false/true
   md5           // 'de99a620c50f2990e87144735cd357e7'
   sha1          // 'f08e7f04ca1a413807ebc47551a40a20a0b4de5c'
   sha256        // '0061e4c60dac5c1d82db0135a42e00c89ae3a333e7c26485321f24348c7e98a5'
   locale        // en_UK
   countryCode   // UK
   languageCode  // en
   currencyCode  // EUR
   emoji         // 😁

HtmlLorem
   randomHtml    // <html><head><title><table>any code</table></body></html>
--------------
   total : 63
auth 6
composer create-project laravel/laravel name
composer require laravel/ui
php artisan ui vue --auth
npm install && npm run dev


laravel 6

composer create-project --prefer-dist laravel/laravel blog "6.*"
composer require laravel/ui "^1.0" --dev
php artisan ui vue --auth
npm install && npm run dev
auto refresh
Database :
----------
   CREATE TABLE `refresh_status` (
     `id` bigint(20) NOT NULL AUTO_INCREMENT,
     `time` bigint(20) NOT NULL DEFAULT '5' COMMENT 'Second',
     `status` tinyint(4) NOT NULL COMMENT '0=hide, 1=show',
    PRIMARY KEY (`id`)
   );
   INSERT INTO `refresh_status` (`id`, `time`, `status`) VALUES (1, 5, 1);

==============
head.blade.php
--------------
    <head>
      @php 
         $time = DB::table('refresh_status')->where('status', true)->first();
      @endphp               
      <meta http-equiv="refresh" content="{{ ($time==true)? $time->time:''}}">
   </head>

----------------
header.blade.php
----------------
   <ul class="navbar-nav m-auto">         
      <li class="nav-item pl-2" style="margin-top: -6.5px;">
         
         <small class="title">Refresh Status</small>         
         @php 
            $status = DB::table('refresh_status')->first();
         @endphp
         
         <!-- 1st style -->
         <a style="line-height: 18px; display: block;" href="{{ url('refreshStatus', 'status') }}"
            class="btn btn-sm py-0 {{($status->status==true) ? 'btn-success':'btn-danger'}}" title="Click for {{($status->status==true) ? 'Off':'On'}}">{{($status->status==true) ? 'On':'Off'}}
         </a> 

         <!-- 2nd style -->
         <div style="display: flex;" class="btn-group">
            <a class="p-0 btn btn-sm btn-danger" href="{{ url('refreshStatus', 'decrease') }}" title="Click for {{($status->status==true) ? 'decrease[-]':''}}" {{($status->status==true) ? '':'hidden'}} {{($status->time==0) ? 'hidden':''}} {{$status->time}}>−</a>
            <a class="p-0 btn btn-sm {{($status->status==true) ? 'btn-secondary':'btn-danger'}}" href="{{ url('refreshStatus', 'status') }}" title="Click for {{($status->status==true) ? 'Off':'On'}}" style="line-height: {{($status->status==true) ? 'normal':'18px'}};">{{($status->status==true) ? 'On ['.$status->time.'”]':'Off'}}</a>
            <a class="p-0 btn btn-sm btn-success" href="{{ url('refreshStatus', 'increase') }}" title="Click for {{($status->status==true) ? 'increase[+]':''}}" {{($status->status==true) ? '':'hidden'}}>+</a>
         </div>
      </li>
   </ul>

=======
web.php
-------
   // Page refresh status
   Route::get('/refreshStatus/{value}', 'HomeController@refreshStatus')->name('refreshStatus');

==================
HomeController.php
------------------
use DB;
class HomeController extends Controller {

   public function refreshStatus($value){
      $dbInfo = DB::table('refresh_status')->first();
      if ($value=='status'){
         $refreshStatus = $dbInfo->status;
         ($refreshStatus==1) ? $changeValue=false : $changeValue=true;         
         $field = 'status';

      }elseif($value=='decrease' || $value=='increase'){
         $time = $dbInfo->time;         
         ($value=='decrease') ? $changeValue=$time-1 : $changeValue=$time+1;        
         $field = 'time';
      }      
      DB::table('refresh_status')->update([$field => $changeValue]);
      return back();
   }
}
<-------The End-------->
seeder
php artisan make:seeder UserSeeder
---
UserSeeder:
   
   public function run(){
      DB::table('user')->insert([
         'name' => 'Aslam',
         'email' => 'aslam@email.com',
         'email_verified_at' => now(),
         'password' => '12345678', // password
         'remember_token' => '123321',
      ]);  
   }
}
---
DatabaseSeeder:

   public function run(){      
      $this->call([
         UserSeeder::class,
         AdminSeeder::class,
         ClientSeeder::class,
      ]);
   }

php artisan db:seed
or
php artisan migrate:refresh --seed

If use laravel faker

UserSeeder:
   use Faker\Factory as Faker;
   
   public function run(){
      $faker = Faker::create();
      foreach (range(1, 5) as $value) {
         
         DB::table('users')->insert([
            'name' => $faker->name,
            'email' => $faker->email,
            'email_verified_at' => now(),
            'password' => Hash::make('123456'), // password
            'remember_token' => '123321',
         ]);

         NB: also use another DB;
      }
   }
}
get previous array values in foreach
$arr = array('January', 'February', 'July', 'August', 'March', 'April', 'May', 'June', 'September', 'October', 'November', 'December');
  
      $arr2 = $arr;
      $loop=1;

      foreach ($arr as $k => $currVal) {
         unset($arr2[$k]);
         foreach ($arr2 as $k => $v) {
            $nextVal = $v;
            break;
         }
         echo $loop.") "."Current=>".$currVal;
         echo "<-->";
         echo "Next=>".$nextVal."<br>";
         $loop++;
      }
Link: https://stackoverflow.com/questions/4148501/get-previous-array-values-in-foreach
Dynamic route & controller
Blade.php
=========
<?php $array = array('country','city', 'area'); ?>
   @foreach($array as $key => $country)
      <form action="{{url($country)}}" method="post">
         @csrf
         <button type="submit" class="mt-2 btn btn-success">{{$country}}</button>
      </form>
   @endforeach

web.php
=======
$pages = ltrim(\Request::getRequestUri(), '/');
Route::post($pages, [CountryController::class, 'itrerate'])->name($pages);

CountryController.php
=====================
public function itrerate(Request $request){
   echo $request->route()->uri;
   echo 'Anything';
}
Dynamic arrayList
1) One-dimensional array
========================
    Input
    -----
    $array = array('country', 'city', 'area');
    or
    $array = ['country', 'city', 'area'];

    Output
    ------
    @foreach($array as $k => $country)
    {{$country}}
    @endforeach

    // Smart way to call array
    Controller.php
    ==============
    $data['trees'] = Tree::all();

    Blade.php
    =========
    //array_column() expects at least 2 parameters

    $array = array_column($trees->toArray(), 'name_column');
    @foreach($array as $k => $country)
    {{$country}}
    @endforeach

*********************************************

2) Two-dimensional array
========================
    Input
    -----
    @php
        $teams = [
            [
                'name' => 'Abc',
                'age' => 12
            ],
            [
                'name' => 'Abc2',
                'age' => 15
            ]
        ];
    @endphp

    Output
    ------
    @foreach ($teams as $team)
        {{$team['name']}}
        {{$team['age']}}
    @endforeach

array:3 [▼
  "base" => "EUR"
  "date" => "2023-01-19"
  "rates" => array:168 [▼
    "AED" => 4.147043
    "AFN" => 118.466773
    "ALL" => 120.73174
];
or

$lists =
                [
                    [1, 'private', 'withdraw', '0.003'],
                    [2, 'private', 'deposit', '0.0003'],
                    [3, 'business', 'withdraw', '0.005'],
                    [4, 'business', 'deposit', '0.0003']
                ];

        foreach($lists as $list){
            foreach($list as $value){
                echo $value;
            }
        }
==========
 $currencyAPI = 'https://developers.paysera.com/tasks/api/currency-exchange-rates';

$data['todayCurrency'] = json_decode(file_get_contents($currencyAPI), true);
@foreach($todayCurrency['rates'] as $name => $value)
      <tr>
            <td>{{ $name }}</td>
            <td>{{ $value }}</td>
      </tr>
@endforeach

*********************************************

3) Three-dimensional array
==========================
    Input
    -----
    @php
        $teams = [
            'management_team' => [
                'name' => 'Management Team',
                'data' => [
                    [
                        'name' => 'Abc',
                        'age' => 15
                    ],
                    [
                        'name' => 'Abc2',
                        'age' => 18
                    ]
                ]
            ]
        ];
    @endphp

    output
    ------
    {{$teams['management_team']['name']}} 
    @foreach ($teams['management_team']['data'] as $team) 
        {{$team['name']}}
        {{$team['designation']}}
    @endforeach  

*********************************************

4) Three-dimensional array(Multiple)
===================================
    Input
    -----
    @php
        $teams = [
            'management_team' => [
                'name' => 'Management Team',
                'data' => [
                    [
                        'name' => 'Abc',
                        'age' => 18
                    ],
                    [
                        'name' => 'Abc2',
                        'age' => 20
                    ]
                ]
            ],
            
            'management_team2' => [
                'name' => 'Management Team2',
                'data' => [
                    [
                        'name2' => 'Abc',
                        'age2' => 18
                    ],
                    [
                        'name2' => 'Abc2',
                        'age2' => 20
                    ]
                ]
            ]        
        ];
    @endphp

    output
    ------
    @foreach ($teams as $key => $team)               
        {{$team['name']}}
        @foreach ($team['data'] as $info) 

            {{$info['name']}}
            {{$info['designation']}}

        @endforeach       
    @endforeach 

=== The end ===
Laravel 404 page
1) Default:

web.php
Auth::routes();
Route::fallback(function () {
   return abort(404);
});

2) If u want register not working
web.php
//Auth::routes();
Auth::routes(['register' => false]);
Route::fallback(function () {
   return abort(404);
});

3) Coustom 404 make

Route::fallback(function () {
   return view('404');
});

views/404.blade.php
/*
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>404 : Error Page</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
</head>
<body>
    <div class="container mt-5 pt-5">
        <div class="alert alert-danger text-center">
            <h2 class="display-3">404</h2>
            <p class="display-5">Oops! Something is wrong.</p>
            <a href="https://aslambd.com" class="btn btn-primary">Return homepage</a>
        </div>
    </div>
</body>
</html>
*/
laravel error message
// App\Http\Controllers\Redirect;

use Redirect;

$validator = Validator::make($request->all(),[
   'iconName'=> 'required|unique:code_type_icons,iconName',
   'iconLink'=> 'required|unique:code_type_icons,iconLink'
]);

if($validator->fails()) {
   $messages = $validator->messages();// get the error message.       
   return Redirect::back()->withErrors($validator);
}

1st...

 @if($errors)
    @foreach ($errors->all() as $error)
        <div class="alert alert-danger text-center alert-block">
         <button type="button" class="close" data-dismiss="alert">×</button>  
         <strong>{{ $error }}</strong>
      </div>
    @endforeach
@endif

2nd...  
return back()->with('success', 'Code type add successfully');

@foreach (['success', 'danger', 'warning', 'info'] as $alert)         
   @if ($message = Session::get($alert))
      <div class="alert alert-{{$alert}} text-center alert-block">
         <button type="button" class="close" data-dismiss="alert">×</button>  
         <strong>{{ $message }}</strong>
      </div>
   @endif
@endforeach

<script type="text/javascript">
   window.setTimeout(function() {
      $(".alert").fadeTo(500, 0).slideUp(500, function(){
         $(this).remove(); 
      });
   }, 5000);
</script>

another way...

return back()->with('success', 'Code type icon add successfully');
return back()->with('danger', 'Code type icon add successfully');
return back()->with('info', 'Code type icon add successfully');

@foreach (['success', 'danger', 'warning', 'info'] as $alert)         
   @if ($message = Session::get($alert))
      <div class="alert alert-{{$alert}} text-center alert-block">
         <button type="button" class="close" data-dismiss="alert">×</button>  
         <strong>{{ $message }}</strong>
      </div>
   @endif
@endforeach

<script type="text/javascript">
   window.setTimeout(function() {
      $(".alert").fadeTo(500, 0).slideUp(500, function(){
         $(this).remove(); 
      });
   }, 5000);
</script>


<style type="text/css">
   .alert { 
      margin-top: 0px; 
      position: absolute; 
      right: 0px; 
      z-index: 1; 
      color: white;
   }
   .close { color: #000 !important; margin: 0 -8px 0px 10px; line-height: 20px; }
   ul li { list-style: none; margin-top: 20px; }
   .close:hover { color: black; }
</style>
laravel switch
@php
   $languageId = session()->get('languageId');
   $id=$languageId;
   switch ($languageId) {
       case $id:
         $Language = App\Language::find($id);
         echo $Language->name;
           break;
       default:
           echo "321";
   }
@endphp
migration last one
in db
migration batch id inclise  [1->2]
php artisan migrate:rollback
php artisan migrate
unick number find
$uniqueNumberFound = false;
		while (!$uniqueNumberFound){

    		$employee_id=rand(1, 5);
    		$sql3="SELECT * FROM employee where employee_id='$employee_id'";
			$rowcount=mysqli_query($hrm, $sql3);
			$num= mysqli_num_rows($rowcount); 
			   if ($num==0){  
			      $uniqueNumberFound = true;  
			   }
		}
		echo $employee_id; 
 	?>  
unique validation
$validated = $request->validate([     
    'codeType' => 'required|unique:code_types,codeType,userId'.\Auth::user()->id,
 ]);   

or


$id = $request->id;
$validator = Validator::make($request->all(),[
       'field'=>"required|unique:table,colum,$id"
]);
Laravel sql query
Add new column
public function new(){
      $table  = 'members';
      $column = 'abc';
      DB::select("ALTER TABLE $table ADD $column VARCHAR(255)");
      DB::statement("ALTER TABLE $table ADD $column VARCHAR(255)");
      return view('admin.member.registration');
}
link::https://blog.quickadminpanel.com/5-ways-to-use-raw-database-queries-in-laravel/
SoftDeletes Model
namespace App\Models;
use Illuminate\Database\Eloquent\Model;

class Notice extends Model{
   use SoftDeletes;
   protected $guarded = [];
}
Seed sql file
1st:
php artisan make:seeder SqlFileSeeder
----------

2nd:
put the sql file here
database\test.sql
----------

3rd:
database\seeds\SqlFileSeeder.php;
<?php
use Illuminate\Database\Seeder;
class SqlFileSeeder extends Seeder {   
   public function run(){
      $path = 'database\test.sql'; 
      $sql = file_get_contents($path);
      DB::unprepared($sql);
   }
}
----------

4th:
database\seeds\DatabaseSeeder.php

<?php
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder {
    public function run() {
        $this->call(SqlFileSeeder::class);
    }
}

----------
3rd + 4th: Shortcuts way
database\seeds\DatabaseSeeder.php
use DB;
class DatabaseSeeder extends Seeder {    
    public function run(){
        $path = 'database\test.sql';
        $sql = file_get_contents($path);
        DB::unprepared($sql);
    }
}
----------
5th:
php artisan db:seed
php artisan db:seed --class=SqlFileSeeder
----------

6th:
Delete full db's table from phpmysql
php artisan db:wipe
==========

Link::
https://www.nicesnippets.com/blog/how-to-run-sql-file-or-query-in-laravel-seeder
gather than lass than
'min'=>"required|numeric",
'max'=>"required|numeric|gt:min",

lt lessthan
gt gatherthan
gte gatherthan equal

https://github.com/laravel/framework/issues/24650
Print array list
name="user_type[]"
$user_type = $request->input('user_type');
            
      $array = [];
      $serial = 0;
      foreach ($user_type as $field) {
         $array[$serial] = $field;
         $serial = $serial + 1;
      }      
      $field = "(".implode(', ', $array).")";
image upload
$path="images/general/";
      $default="default.jpg";
      if ($request->hasFile('photo')){
         if($files=$request->file('photo')){
            $photo = $request->photo;
            $fullName=time().".".$photo->getClientOriginalExtension();
            $files->move(public_path($path), $fullName);
            $photoLink = $path . $fullName;
         }
      }else{
         $photoLink = $path . $default;
      }

https://www.codegrepper.com/code-examples/php/laravel+upload+image+to+public+folder
multiple-checkboxes insert
html
====
<div class="form-group col-4">
    <select class="multiple-checkboxes" multiple="multiple" name="user_type[]">
        @foreach($userTypes as $user)
            <option value="{{$user->name}}">{{$user->name}}</option>
        @endforeach
    </select>
</div>

Controller
==========
$user_type = $request->input('user_type');
if ($user_type){
    $array = [];
    $serial = 0;
    foreach ($user_type as $field) {
    $array[$serial] = $field;
    $serial = $serial + 1;
    }      
    $user_type = implode(', ', $array);         
}

output
======
user, user2, user3...
file_put_contents
composer dump-autoload
composer install
php artisan cache:clear
php artisan clear-compiled
<-- OR -->
Deleted the file "/public_html/bootstrap/cache/config.php"
then I ran "php artisan config:cache"
Laravel Redirect to page & data
return Redirect::to('Blade page name');

With data
return Redirect::route('settings')->with(['data' => $data])->withInput(['tab' => $tab]);
insert last id
insert() [Does not insert (created_at, updated_at)]	
create() [Insert (created_at, updated_at)]
----------------------------
$user = User::insertGetId([
             'name' => $request->name
              [Does not insert (created_at, updated_at)]
]);
Answer: $user = 2;
--------------------
$user = User::create([
             'name' => $request->name
              [Insert (created_at, updated_at)]
]);
Answer: $user->id = 2;
-------------------------
N:B: createGetId [Not working]
laravel print Alphabet
Capital : A-Z, small : a-z
@foreach(range('a','z') as $letter)                                                  
   {{$letter}}         
@endforeach
Answer: a, b, c, d
------------------
@foreach($users as $user)
   {{ chr(64+ $loop->iteration) }}) {{$user->name}}
@endforeach
Answer: A) user, B)User2
------------------------
@foreach($users as $user)
   {{ chr(96+ $loop->iteration) }}) {{$user->name}}
@endforeach
Answer: a) user, b)User2
------------------------
https://laracasts.com/discuss/channels/site-improvements/loop-iteration-as-a-in-blade
Sql filter row
$questionList = QuestionList::with('getOption')->pluck('id');
$answerList = AnswerList::where('userId', $user)->pluck('questionId');
 
$unVoteQuestion = $questionList->diff($answerList);
$data['addVote'] = QuestionList::with('getOption')->whereIn('id', $unVoteQuestion)->get(); 
      
return view('home', $data);
Laravel csv file read
https://blog.quickadminpanel.com/how-to-import-csv-in-laravel-and-choose-matching-fields/

https://www.itsolutionstuff.com/post/laravel-create-csv-file-from-custom-array-using-maatwebsiteexample.html

https://makitweb.com/export-data-to-csv-excel-format-in-laravel-8/
Three table
<!-- All Column -->
                  <?php if(isset($_SESSION['tableName'])){ ?>
                     <div class="tab-pane" id="column">
                        <p class="bg-success text-center mb-2"><?= $_SESSION['tableName']; ?>'s [columns]</p>
                        <?php
                           // $tableName = $_SESSION['tableName'];
                           $column = "SHOW columns FROM $tableName";
                           $columnResult = mysqli_query($conn, $column);
                           $TotalColumn = mysqli_num_rows($columnResult);
                           $col_4 = 1;
                           $loop = 1;
                           $headFirst = 1;
                        ?>
                        <form action="action.php" method="POST">
                           <div class="row">
                              <?php while($row = mysqli_fetch_array($columnResult)){ ?>
                                 <?php if($col_4=='1'){ ?>
                                    <table id="example1" class="table table-bordered table-striped col-4 mb-0">
                                       <?php if($headFirst=='1'){?>
                                          <thead>
                                             <tr class="text-center">
                                                <th class="bg-secondary">No</th>
                                                <th>Column name</th>
                                                <th>Action</th>
                                             </tr>
                                          </thead>
                                       <?php } ?>
                                       <tbody>
                                          <tr>
                                             <td width="20%" class="bg-secondary text-center"><?= $loop; ?></td>
                                             <td width="auto"><?= $row['Field']; ?></td>
                                             <?php if($row['Field']!='id') {?>
                                                <td width="20%" class="text-center"><a class="btn btn-sm btn-danger" href="action.php?columnName=<?=$row['Field']; ?>&tab=column">Delete</a></td>
                                             <?php }else{ ?>
                                                <td width="20%" class="bg-warning text-center p-0">
                                                   Primary key can't delete
                                                </td>
                                             <?php } ?>
                                          <tr>                                           
                                       </tbody>
                                    </table>
                                 <?php }elseif($col_4=='2'){ ?>
                                    <table id="example1" class="table table-bordered table-striped col-4 mb-0">
                                       <?php if($headFirst=='2'){?>
                                          <thead>
                                             <tr class="text-center">
                                                <th class="bg-secondary">No</th>                                                
                                                <th>Column name</th>
                                                <th>Action</th>
                                             </tr>
                                          </thead>
                                       <?php } ?>
                                       <tbody>
                                          <tr>
                                             <td width="20%" class="bg-secondary text-center"><?= $loop; ?></td>
                                             <td width="auto"><?= $row['Field']; ?></td>
                                             <?php if($row['Field']!='id') {?>
                                                <td width="25%" class="text-center"><a class="btn btn-sm btn-danger" href="action.php?columnName=<?=$row['Field']; ?>&tab=column">Delete</a></td>
                                             <?php }else{ ?>
                                                <td width="25%" class="bg-warning text-center p-0">
                                                   Primary key can't delete
                                                </td>
                                             <?php } ?>
                                          <tr>
                                       </tbody>
                                    </table>
                                 <?php }else{ ?>
                                    <table id="example1" class="table table-bordered table-striped col-4 mb-0">
                                       <?php if($headFirst=='3'){?>
                                          <thead>
                                             <tr class="text-center">
                                                <th class="bg-secondary">No</th>                                                
                                                <th>Column name</th>
                                                <th>Action</th>
                                             </tr>
                                          </thead>
                                       <?php } ?>
                                       <tbody>
                                          <tr>
                                             <td width="20%" class="bg-secondary text-center"><?= $loop; ?></td>                                            
                                             <td width="auto"><?= $row['Field']; ?></td>
                                             <?php if($row['Field']!='id') {?>
                                                <td width="20%" class="text-center"><a class="btn btn-sm btn-danger" href="action.php?columnName=<?=$row['Field']; ?>&tab=column">Delete</a></td>
                                             <?php }else{ ?>
                                                <td width="20%" class="bg-warning text-center p-0">
                                                   Primary key can't delete
                                                </td>
                                             <?php } ?>
                                          <tr>
                                       </tbody>
                                    </table>
                                 <?php } ?>
                              <?php (($col_4=='1'||'2') ?  $col_4++ : $col_4='1' ); $loop++; $headFirst++; } ?>              
                           </div>
                        </form>
                     </div>
                  <?php } ?>
Download file
<td>
                              <a href="{{asset('')}}/{{$report->file}}" class="btn btn-large pull-right" target="_blank" download="">
                                 <i class="fas fa-download pr-2"></i>Download
                              </a>
                            </td>
Group by with single print
Controller
$data['patients'] = Appointment::where('doctor_id', Auth::id())->get()->groupBy('patient_id');

Blade
 @foreach($patients as $patient2)
     @foreach($patient2->take(1) as $patient)
         {!!$patient->date!!}
     @endforeach
@endforeach
Room booking search
Rooms [id, room_no] -> Ex:1, 2, 3, 4, 5;
CabinBooking [id, check_in, check_out, room_no] -> 2, 5

UnBook: 1, 3, 4

// All rooms
$rooms = Room::where('room_type', 'cabin')->orderBy('room_no', 'Asc')->pluck('room_no');
***********

// Booked
$booked = CabinBooking::where([
        ['cabin_bookings.check_in', '<=', $check_in],
        ['cabin_bookings.check_out', '>=', $check_out]
    ])
    ->orwhere([
        ['cabin_bookings.check_in', '>=', $check_in],
        ['cabin_bookings.check_out', '<=', $check_out]
    ])->pluck('room_no');
-----------
// Or
$booked = CabinBooking::where([
    ['cabin_bookings.check_in', '<=', $check_in],
    ['cabin_bookings.check_out', '>=', $check_in]
])
->orwhere([
    ['cabin_bookings.check_in', '>=', $check_out],
    ['cabin_bookings.check_out', '<=', $check_out]
])->pluck('room_no');
-----------
// Or
$booked = CabinBooking::whereBetween('cabin_bookings.check_in', [$check_in, $check_out])
->orWhereBetween('cabin_bookings.check_out', [$check_in, $check_out])
->orWhere(function ($query) use ($check_in, $check_out) {
    $query->where('cabin_bookings.check_in', '<', $check_in)
        ->where('cabin_bookings.check_out', '>', $check_out);
})->pluck('room_no');

***********
// UnBook filter
$data['unBook'] = $rooms->diff($booked);
Check if a query has results
@if (count($posts))
@if($query->isEmpty())
Time date
@php
                           $hours_start = strtotime('08:00:00');
                           $hours_end = strtotime('18:00:00');

                           $hours = $hours_end - $hours_start; //amount of hours working in day
                           $hours = $hours / 1800; // 30 munite slot
                           
                           for($i = 0; $i <= $hours; $i++){ // double hours for 30 minute increments
                              $minutes_to_add = 1800 * $i; // add 30 - 60 - 90 etc.
                              $timeslot = date('h:i:s', strtotime($hours_start)+$minutes_to_add);
                              date('h:i a', strtotime($timeslot)). "<br>";
                           }
                         @endphp

06:00 am
06:30 am
07:00 am
07:30 am
08:00 am
Convert 12 hours to 24 hours in PHP
mktime(hour, minute, second, month, day, year, is_dst);

<?php
                        $iTimestamp = mktime(1,0,0,1,1,date('Y'));
                        for ($i = 0; $i < 48; $i++) {
                            echo 1+$i.") ". date('h:i a', $iTimestamp) . "\n<br />";
                            $iTimestamp += 1800;
                        } 
                    ?>

======================

$hour = -1;
                    while($hour++ < 23)
                    {
                        $timetoprint = date('h:i a',mktime($hour,0,0,1,1,2011));
                        echo 1+$hour.")" .$timetoprint . "<br>";
                    }

{{-- # 24 hrs 
H:i 
// output 14:20

# 12 hrs 
h:i 
// output 2:20 --}}
check_in check_out validation
$validator = Validator::make($request->all(),[            
'check_in'=>'required|date|before_or_equal:check_out',
'check_out'=>'required|date|after_or_equal:check_in',
]);

return [
        'pay_period_start'=>'date',
        'pay_period_end' => 'date',
        'work_date' => 'date|after_or_equal:pay_period_start|before_or_equal:pay_period_end',
    ];
multiple column check sql
https://stackoverflow.com/questions/54775177/select-where-all-3-columns-are-not-null-at-the-same-time-laravel-query-builder
Add appointment
1) Html
=======
<form action="{{ route('appointment.add') }}" method="post" enctype="multipart/form-data">
    @csrf
    <input type="hidden" name="user_id" value="{{ $doctorId = $doctor->user_id }}">
    <input type="text" class="select-date datepicker" name="date" id="date" placeholder="Day-Month-Year"/>
    <select class="select-time" name="time" id="time">
        <option value="">Select time</option>
    </select>
    <button type="submit">Add now</button>
</form>

2) Js action
=========
<script>
    $(document).ready(function() {
        $('.select-date').change(function() {
            var date = $(this).val();
            var doctorId = '{{ $doctorId }}';
            $('.select-time').html('');
            $.ajax({
                url: "{{ route('search.date') }}",
                method: "get",
                data: {
                    date: date,
                    doctorId: doctorId
                },
                success: function(result) {
                    $('.select-time').append('<option selected>Select time</option>');
                    $.each(result, function(key, value) {
                        $('.select-time').append('<option disabled2 value="' + value + '">' + value + '</option>');
                    });
                }
            })
        });
    });
</script>

3) web.php
==========
Route::get('search-date', 'PatientController@search_date')->name('search.date');   

4) PatientController
====================
public function search_date(Request $request) {
    $allTime = array('8:10 AM', '8:15 AM', '8:20 AM', '8:25 AM', '8:30 AM');
    $booked =   Appointment::where('doctor_id', $request->doctorId)
                ->where('date', date('Y-m-d', strtotime($request->date)))
                ->pluck('time')->toArray();   
    $unBook = array_diff($allTime, $booked);
    return response()->json($unBook);
}

5) web.php
==========
Route::post('appointment-add', 'PatientController@appointment_add')->name('appointment.add');

6) PatientController
=================
public function appointment_add(Request $request){   
    Appointment::Create([            
        'appointment_id' => uniqid(),
        'patient_id' => Auth::id(),
        'doctor_id' => $request->user_id,
        'date' => date('Y-m-d', strtotime($request->date)),
        'time' => $request->time
    ]);
    return back()->with('success', 'Appointment add successfully');
}

database table
==============
Schema::create('appointments', function (Blueprint $table) {
    $table->id();
    $table->string('appointment_id')->nullable();
    $table->integer('patient_id');
    $table->integer('doctor_id');
    $table->date('date')->nullable();
    $table->string('time')->nullable();
});
Two array add
https://stackoverflow.com/questions/32387575/how-to-properly-merge-multiple-collections-in-laravel

$paid = Payment::pluck('id')->toArray();
$newCompete = array(2=>'Others');
$paid2 =    collect($paid)->concat($newCompete)->toArray();
Install XSender WhatsApp on cPanel
https://youtu.be/_xOAdCprXY0
Basic Microservices
https://www.youtube.com/watch?v=iaj4rQ8UH24&t=1010s&ab_channel=JustSteveKing
calculation
<style>
                                        input{width: 100%; text-align: center;}
                                        input::-webkit-outer-spin-button,
                                        input::-webkit-inner-spin-button {
                                            display: none;
                                        }
                                    </style>
                                    <tbody style="font-weight: bold;">
                                        <tr>
                                            <td colspan="5">Subtotal:</td>
                                            <td id="sb_total"></td>
                                        </tr>
                                        <tr>
                                            <td colspan="5">Discount:</td>
                                            <td width="10">
                                                <input type="number" min="0" id="a_discount" value="0">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="5">Less Amount:</td>
                                            <td>
                                                <input type="number" min="0" id="b_less" value="0">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="5">Vat:</td>
                                            <td>
                                                <input type="number" min="0" id="c_vat" value="0">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="5">Total:</td>
                                            <td id="t_amount"></td>
                                        </tr>
                                    </tbody>



    <script>
        $('#sb_total, #a_discount, #b_less, #c_vat').blur(function(){

            var list_total = $('#subtotal').val();
            var vat_amount = 0;
            var less_amount = 0;

            // $('#a_discount').each(function(){
                var discount = $('#a_discount').val();
                var discount_type = $('#a_discount').attr('data');
                if(!(discount)){
                    discount = 0;
                }if(!(discount_type)){
                    discount_type = 0;
                }
                var discount_amount = (list_total*(discount/100));
                if(discount_type == '1'){
                    discount_amount = discount;
                }    

                // Less
                var less_amount = $('#b_less').val();
                if(!(less_amount)){
                    less_amount = 0;
                }

                // vat
                var vat = $('#c_vat').val();
                if(!(vat)){
                    vat = 0;
                }
                var vat_amount = (list_total*(vat/100));
            // });
            var total_amount = (parseInt(list_total)+parseInt(vat_amount))-(parseInt(discount_amount)+parseInt(less_amount));  

            $('#t_amount').html(total_amount.toFixed(2));
            $('#t_amount').append('<input type="hidden" name="t_amount" value="'+total_amount+'"/>');


        })
        // $('#t_amount').text(discount.toFixed(2));
    </script>
                  

    function load_cart(){
        $.ajax({
            url:"includes/cart_process.php",
            method:"GET",
            dataType:"json",
            success:function(data) {
                $('#cart_details').html(data.cart_details);
                $('#sb_total').text(data.sub_total);
                $('#total').html(data.total);
                $(".mem_details").html(data.member.member_details);
                $("#m_info").html(data.member.member_info);
                calculation();
            }
        });
    }
foreach
<?php
$sql = "SELECT * FROM users";
$result = mysqli_query($con, $sql);
// if single output
$result->fetch_assoc()['name'];
// Loop data
foreach($result as $row): 
           echo $row["name"];
endforeach; 
?>
Select single
$sql2 = "SELECT count(id) as id, sum(total_rcv) as total FROM sd_order_more WHERE (mobile= '$mobile' && customerID = 0) and activity = 1";
                                    $result2 = mysqli_query($mysqli, $sql2);
                                    $result3 = mysqli_query($mysqli, $sql2);
                                    $service_number =  $result2->fetch_assoc()['id'];
                                    $total_expense = $result3->fetch_assoc()['total'];
Sql import command
λ mysql -u root -p
show databases;
use databaseName;
source sqlPath; // also File drag and drop allow.
Session time for timer
$_SESSION['postTimer'] = (time()+(24*60*60))*1000;

<?php if(isset($_SESSION['postTimer']) && (time()*1000 < $_SESSION['postTimer'])){ ?> 
		<script>
			// Set the date we're counting down to
			var countDownDate = <?= $_SESSION['postTimer']; ?>;

			var x = setInterval(function() {

				var now = new Date().getTime();
				var distance = countDownDate - now;
				
				// var days = Math.floor(distance / (1000 * 60 * 60 * 24));
				var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
				var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
				var seconds = Math.floor((distance % (1000 * 60)) / 1000);				
				document.getElementById("timeCount").innerHTML = hours + "h " + minutes + "m " + seconds + "s ";
				
				if (distance < 0) {
					clearInterval(x);
					document.getElementById("submitButton").disabled = false;
					document.getElementById("timeCount").style.display = "none";
				}else{
					document.getElementById("submitButton").disabled = true;
				}
			}, 1000);
		</script>
	<?php }else{
		unset($_SESSION['postTimer']);
	} ?>
Faker
$faker = Faker\Factory::create();
        foreach (range(1, 10) as $value) {
            DB::table('subjects')->insert([               
                'name' => $faker->name
            ]);
        }
Laravel Eloquent exists() and doesntExist() Example
https://www.itsolutionstuff.com/post/laravel-eloquent-exists-and-doesntexist-exampleexample.html
laravel pdf
https://spatie.be/docs/laravel-pdf/v1/introduction
spatie::pdf package requires PHP 8.2+, Laravel 10+.

All see another four(4) pdf generator
https://spatie.be/docs/laravel-pdf/v1/alternatives
1) laravel-dompdf
2) wkhtmltopdf 
3) mPDF
4) FPDF
insert all
$input = $request->except('_token', 'image_path');
How to fix Error: laravel.log could not be opened?
https://stackoverflow.com/questions/23411520/how-to-fix-error-laravel-log-could-not-be-opened
colors
@php 
                                            $colors = array('bg-info', 'bg-secondary', 'bg-dark', 'bg-primary', 'bg-white', 'bg-success', 'bg-warning', 'bg-secondary', 'bg-danger', 'bg-dark'); 
                                        @endphp
email setup
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=abc@gmail.com
MAIL_PASSWORD=abc
MAIL_FROM_ADDRESS=abc@gmail.com
MAIL_FROM_NAME=Name
MAIL_ENCRYPTION=tls
session cart quantity add
if($_POST["action"] == "add" && $_POST["type"] == "service"){                        
            if(!empty($_SESSION["shopping_cart"])){
                $itemList = array();    
                
                foreach($_SESSION["shopping_cart"] as $keys => $values) {
                    $itemList[] = array('itm_id'=>$values["itm_id"], 'qty_id'=>$values["qty_id"]);
                }

                $key = array_search($_POST["itm_id"], array_column($itemList, 'itm_id'));

                if ($key !== false) {
                    $qty_id = $itemList[$key]['qty_id'];
                    // this line add quantity...
                    $_SESSION["shopping_cart"][$key]['qty_id'] =  $qty_id+1;
                }else{
                    $item_array = array('itm_id'=>$_POST["itm_id"], 'qty_id'=>1, 'type'=>$_POST["type"]);
                    $_SESSION["shopping_cart"][] = $item_array;
                }                
            }else{
                $item_array = array('itm_id'=>$_POST["itm_id"], 'qty_id'=>1, 'type'=>$_POST["type"]);
                $_SESSION["shopping_cart"][] = $item_array;
            }
        }
auto invoice id create
if ($stmt_m1->num_rows == 0) {
        $orderID = 'INV-0000001';
    }else{
        if ($stmt_m = $mysqli->prepare("SELECT id, CONCAT( '" . $prefix . "-', LPAD(id + 1,7,'0') )
                    FROM sd_order_more ORDER BY id DESC")) {
            $stmt_m->execute();
            $stmt_m->store_result();
            $stmt_m->bind_result($prefx_id, $orderID);
            $stmt_m->fetch();
            $stmt_m->close();
        }
    }
2d arraay create and save
<?php
    session_start();
    require_once("db_connect.php");

    $p_cart = array();
    $c_cart = array();
    foreach($_SESSION["shopping_cart"] as $keys => $values){
        if($values["type"] == "product"){
            $p_cart[] = array('itm_id'=>$values['itm_id'], 'qty_id'=>$values["qty_id"]);
        }
    }

    foreach($_SESSION["combo_cart"] as $keys => $values){
        $c_cart[] = $values['combo_id'];
    }
    
    $product = json_encode($p_cart);
    $combo = json_encode($c_cart);


    if(isset($_POST["action"])){
        $cartName = $_POST["cartName"];

        $sql = "INSERT INTO cart_hold VALUES(null, '$cartName', '$product', '$combo')";
        $result = mysqli_query($mysqli, $sql);
    }

    unset($_SESSION["shopping_cart"]);
    unset($_SESSION["combo_cart"]);

    $data = array(
        'cart'     => $cartName
    );      
    echo json_encode($data);
?>
Dynamic Variable Names in PHP
$payment_mtd = 'bKash';
$paid = 20;
$bkash = 10;

$lists = ['bkash', 'cash'];
    foreach($lists as $name){
        if($name == $payment_mtd){
            $$name = $paid;
            or
             ${$name} = $paid;
        }
    }
echo bkash;
print : 20;

https://wholesomecode.net/dynamic-variable-names-in-php/
sql query where condition array colluction
https://www.geeksforgeeks.org/how-to-bind-an-array-to-an-in-condition-in-php/

 <?php
                                                            $category = ['salary', 'bonus', 'other'];
                                                            $type2 = implode('\', \'', $category);

                                                            $sql = "SELECT * FROM sd_expns_c WHERE type2 IN ('$type2') && activity = 1 ORDER BY id ASC";
                                                            $result = mysqli_query($mysqli, $sql);
                                                            while ($row = $result->fetch_assoc()) { ?>
                                                                <option value="<?= $row['id']; ?>"><?= $row['menu_name']; ?></option>
                                                            <?php } ?>
compare a variable to multiple values
$test_variable = 'value1';

// 1st way
if ($test_variable === 'value1' || $test_variable === 'value2' || $test_variable === 'value3' || $test_variable === 'value4') {
    // code
}

// 2nd way
if (in_array($test_variable, ['value1', 'value2', 'value3', 'value4'])) {
    // code
}

// 3rd way
$test_array = ['value1', 'value2', 'value3', 'value4'];
if (in_array($test_variable, $test_array)) {
    // code
}

https://inthedigital.co.uk/use-phps-in_array-to-compare-a-variable-to-multiple-values/#:~:text=August%2028th%2C%202020-,Use%20PHP's%20in_array()%20to%20compare%20a%20variable%20to%20multiple,instead%20of%20complex%20if%20expressions.
date without zero 1-9
echo date('y-n-j', strtotime('2024-09-03'));
result: 24-9-3
model $fillable vs $guarded
$fillable => serves as a "white list" of attributes that should be fillable.
$guarded => serves as a "black list" of attributes that should not fillable.
$fillable is opposite $guarded

Example 1
protected $fillable = ['name', 'email'];
It means we want to insert only name, email colmn values

Example 2
protected $guarded = ['name', 'email'];
It means we want to ignore(block) only name, email. That means we don't want to insert name, email colmn value

Example 3
protected $guarded = [];
We want to insert all columns values

If we want to ignore all the fields, we can use:
protected $guarded = ['*'];

If we want to insert all fields, we can use:
protected $guarded = [];
json data search
[data.json => code, message column)
$link = file_get_contents(public_path('data.json'));
        $dataArray = json_decode($link, true);       
        
        $errorList = array();
        foreach ($errors as $error){           
            $result = array_filter($dataArray, function($item) use ($error) {
                return $item['code'] === $error;
            });

            $result = array_values($result);

            // return dd($result[0]['message']);
            
            $errorList[] = $error .': '. $result[0]['message'];       
        }
GDrive with laravel (Google Drive)
https://www.luckymedia.dev/blog/google-drive-api-setup-for-laravel-10-integration-part-1

https://www.luckymedia.dev/blog/laravel-project-setup-for-google-drive-api-integration-part-2
Api call
<?php

namespace App\Traits;

use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Storage;

trait WasabiFile
{
    public function saveFile($path, $file)
    {
        try {
            $result = Storage::disk('wasabi')->put($path, fopen($file, 'r'));

            // return $result;
   
            if ($result) {
                echo "File uploaded successfully.";
            } else {
                echo "Failed to upload file.";
            }
        } catch (\Exception $e) {
            Log::error('Wasabi upload failed: ' . $e->getMessage());
            echo "Error: " . $e->getMessage();
        }
    }

    public function deleteFile($filePath)
    {
        try {
            $result = Storage::disk('wasabi')->delete($filePath);

            if ($result) {
                echo "File remove successfully.";
            } else {
                echo "Failed to remove file.";
            }
        } catch (\Exception $e) {
            Log::error('Wasabi remove failed: ' . $e->getMessage());
            echo "Error: " . $e->getMessage();
        }
    }

    public function bucketName()
    {
        try {
            // API endpoint URL
            $url = "https://stats.wasabisys.com/v1/standalone/utilizations/bucket";

            // Query parameters
            $queryParams = [
                'pageNum' => 0,
                'pageSize' => 1,
                'latest' => 'true',
                'from' => '1223-12-25',
                'to' => '2024-12-25'
            ];

            $AccessKey = env('WAS_ACCESS_KEY_ID');
            $SecretKey = env('WAS_SECRET_ACCESS_KEY');

            $response = Http::withHeaders([
                'Authorization' => $AccessKey .':'. $SecretKey,
            // ])->get($url, $queryParams);
            ])->get($url);

            // dd($response);

            if ($response->successful()) {
                return response()->json($response->json());
            } else {
                return response()->json(['error' => 'Failed to fetch data'], $response->status());
            }
        } catch (\Exception $e) {
            return response()->json(['error' => $e->getMessage()], 500);
        }
    }
}
itemDelete
public function itemDelete($model, $id, $tab)
    {
        $itemId = DB::table($model)->find($id);
        if (Schema::hasColumn($model, $column='photo')){
            ($itemId->$column!=null) ? (file_exists($itemId->$column) ? unlink($itemId->$column) : '') : '';
        }
        $dbStatus = DB::table($model)->where('id', $id)->delete();

        if($dbStatus){
            $code = 'success';
            $dbOutput = ' delete successfully';
        }else{
            $code = 'danger';
            $dbOutput = ' delete fail';
        }
        
        $words = explode('_', $model);
        if (isset($words[1])) {
            $words[1] = rtrim($words[1], 's'); 
        }else{
            $words[0] = rtrim($words[0], 's'); 
        }

        $model = ucfirst(implode(' ', $words));
        return back()->with($code, $model . $dbOutput)->withInput(['tab' => $tab]);
    }
Command
1st create a folder for git on pc
Basic configration...

$ git init	create .git file 
$ git --version
$ git config --global user.name "Aslam"
$ git config --global user.email "aslam@gmail.com"
$ git config --list
clear

Each of every project user & email
$ git config user.name "aslam"
$ git config user.email "aslam@gmail.com"


upload file...
$ git status
$ git add file.txt	[save this file]
$ git add --all	 or
$ git add .
$ git commit -m "message"
$ git remote add origin https...
$ git push -u origin master 

download file...
git status
git log
first create a folder...
git clone https link...

update.....
git status
git add .
git commit -m "message"
git log
git pull	
git push	[upload to master branch]

log 	[list of commit]
$ git log
$ git log --oneline

download from branch
create a branch first in git hub...

git clone https link...  -b branchName
branchName= about, help, contact etc
command2
switch go any repository or branch
git checkout  a1b2c3

How to switch back to 'master' with git?

git stash or git commit -m "abcd"
git checkout master
git branch -D merchantApi

Note: Above steps will delete the branch locally.

For deleting the branch you have to stash
 the changes made on the branch 
or you need to commit the changes
 you made on the branch. 
Follow the below steps if you made
 any changes in the current branch.
Github delete last commit
2nd commit : 2020
1st commit : 1010
---------------------
git reset --hard 1010
git push --force
Git check user
Local check
git config user.name
git config user.email
-----------------------
Global check
git config --global user.name
git config --global user.email
-----------------------
Change local
git config user.name "gitHub-UserName"
git config user.email "gitHub-email"
-----------------------
Change global
git config --global user.name "gitHub-UserName"
git config --global user.email "gitHub-email"
git info
github set project url
	->git remote set-url origin [repository link]
	
	example: https://github.com/aslamcsebd/project.git

github show project url
	->git remote show origin

https://mhagemann.medium.com/how-to-fix-ssh-permission-denied-with-git-clone-f669b65f90ac
Rename last commit
git commit --amend -m "New commit message"
git move other commit
git fetch origin [commit no]
git checkout FETCH_HEAD
Undo Git Pull
git reset commitNumber --hard
Git Uncommit
git reset --soft HEAD~1
git project url change
git remote set-url origin https://github.com/projectName.git
git push -u origin main
git branch
create branch
=> git branch anyName

edit branch
You edit branch which branch you stay
=> git branch -m newName

delete branch
You don't delete this branch which branch you stay now.
=> git branch -d branchName

Switch any branch
=> git checkout branchName

branch status see
=> git branch

->dev
->*main

[(* icon) means you are now stay main branch]


N:B: You are now [main branch] and you have 3 commit. when you create [dev branch] the main branch's all commit copy from main to dev branch.
So you should work now dev branch and when you have 5 commit you can merger the main branch.

But if you want to dev branch merge, you stay now main branch and pull/copy code from dev branch.

=> git merge dev


git merge: if you are now main branch with no code or commit, but want to merge/copy from another/dev branch.

In locally pc
-------------
git merge origin dev --allow-unrelated-histories


from server/cloud
-----------------
git pull origin masterOrDev --allow-unrelated-histories


N:B: if you want default main branch to dev, it working in the github server. There are many option to rename, default any branch as root/main branch.
How to reset your Git Settings
git config --global --unset user.name
git config --global --unset user.email
git config --global --unset credential.helper
cmdkey /delete:LegacyGeneric:target=git:https://github.com
git config --global user.name “username”
git config --global user.email emailaddr
git config  credential.helper ‘store’
git remote add origin repolink
git remote -v
git init 
git add .   (Stage)
git commit -m “message”  (Commit)
git push origin master  (Push)


https://www.youtube.com/watch?v=HGfT8JFkC2I
git reset last work and move last commit
git reset --hard
ssh key create
open terminal root folder
open .ssh folder or create
cmd: ssh-keygen -o -t rsa -C githubEmail
see: ls
cmd: open id_rsa.pub

copy then add : https://github.com/settings/keys

also use: ssh-keygen -t ed25519 -C "your_email@example.com"
for small key
update
1)	$sql="update child set name='Aslam' where id=8";
2)	$sql="update child set roll=1 where id=7";

3) 	$sql="update child set name='$name',roll='$roll' where id=$id";
sum
table

id	salary	bonus	extra	sum..?

01	500	200	300
02	100	200	400
03	500	200	300

$sql=select id,(select sum(salary),(bonus),(extra) as tblSum(Earnings))

from table_name");

Search Last or first input
ASC
..........
$sql  ="select * from table_name order by id ASC limit 1";
$result  =  mysqli_query($conn,$sql);

DESC
..........
$sql  ="select * from table_name order by id DESC limit 1";
$result  =  mysqli_query($conn,$sql);
......
N:B: order by id, date, age no matter...
......
select all without last one
$sql ="SELECT * FROM table ORDER BY id DESC LIMIT 13 OFFSET 1";

Or...
$sql ="select *from table where id!=(select max(id) from table )";
UNION all
$sql  ="select id,item,code from html UNION all
                 select id,item,code from css UNION all
                 select id,item,code from bootstrap UNION all
                 select id,item,code from js UNION all
                 select id,item,code from php UNION all
                 select id,item,code from laravel UNION all
                 select id,item,code from mysql UNION all
                 select id,item,code from android UNION all
                 select id,item,code from editor UNION all
                 select id,item,code from softwere UNION all
                 select id,item,code from github UNION all
                 select id,item,code from other
               ";
         $result  =  mysqli_query($code,$sql);

Same output 

$type = 'code_type';

         $all_item ="select *from $type where id!=(select max(id) from $type)";
         $all_row_result = mysqli_query($code,$all_item);

         $last_item ="SELECT * FROM $type ORDER BY ID D
xampp sql maximum length varchar
Although VARCHAR supports 
the maximum size at 65535 characters
the actual maximum value depends 
on other columns in the table and 
character set: Maximum row size
 is 65535 bytes in MySQL that shared 
among all columns in the table
except TEXT/BLOB columns.
phpmyadmin default login page
C:\laragon\etc\apps\phpMyAdmin\templates\login\form.twig

Line no : 51
change : value="{{ default_user }}" to value="root"
sql mode or group by not working
phpmyadmin
left side click "new"
right side top "variables"
search "sql_mode"
edit  & remove "ONLY_FULL_GROUP_BY," 

then save
Transfer Data From One Table to Another table
$hostName = "localhost";
 $userName = "root";
 $password = "";
 $dbName = "name";
 
 $mysqli = new mysqli($hostName, $userName, $password, $dbName);
// Make sure table_1 and table_2 same column (same database)
$sql = "insert table_1 SELECT * FROM table_2";
    $query = mysqli_query($mysqli, $sql);
    if($query){
        echo "Success";
    }else{
        echo "Fail";
    }
Or...........
$sql = "insert offline_online2(invoice_id, status) SELECT invoice_id, status FROM offline_online where invoice_id = 'INV-0000121'";
    $query = mysqli_query($mysqli, $sql);
    if($query){
        echo "Success";
    }else{
        echo "Fail";
    }

Source: https://www.youtube.com/watch?v=epIyuRZC_q0&ab_channel=CodingShiksha
Transfer Data From one database to another database
NB: Same localhost server

    $sql = "INSERT INTO pos_test.offline_online SELECT * FROM pos_restaurant.offline_online WHERE invoice_id = 'INV-0000120'";
    $query = mysqli_query($mysqli, $sql);
    if($query){
        echo "Success";
    }else{
        echo "Fail";
    }
Dynamic all column and value list
<?php
    // onlne, offline table [id, invoice_id, status]
    $mysqli = new mysqli($hostName, $userName, $password, $dbName);

    $tableName = 'offline';
    
    $sql = "SELECT * FROM $tableName";
    $query = mysqli_query($mysqli, $sql);
    $row = mysqli_fetch_assoc($query);
    
    $columnList = implode(', ', array_keys($row));

    echo "<pre>";
    var_export($columnList);
    echo "</pre>";
    
    // Fatch offline row
    $sql = "SELECT * FROM offline WHERE status = 'pending'";
    $query = mysqli_query($mysqli, $sql);
    
    while($row = mysqli_fetch_assoc($query)){
        $order_id = $row['invoice_id'];

        $sql2 = "SELECT * FROM $tableName where invoice_id = '$order_id'";
        $query2 = mysqli_query($mysqli, $sql2);
    
        $array = [];
        while($row3 = mysqli_fetch_assoc($query2)){
            foreach($row3 as $key => $value){
               $array[$key] = "'" .$value. "'";
            }
            $valueList = implode(', ', $array);
    
            $sql3 = "INSERT INTO online ($columnList) VALUES ($valueList)";
            $query3 = mysqli_query($mysqli, $sql3);      

            echo (($query3) ? 'Success' : 'Fail');
        }    
    }
?>
Multiple table data copy to another db's table
<?php
    $hostName = "localhost";
    $userName = "root";
    $password = "123456";

    $offline = "offline";
    $mysqli = new mysqli($hostName, $userName, $password, $offline);
    
    $online = "online";
    $mysqli_online = new mysqli($hostName, $userName, $password, $online);

    $tableName = 'sd_order_list';
    
    $sql = "SELECT * FROM $tableName";
    $query = mysqli_query($mysqli, $sql);
    $row = mysqli_fetch_assoc($query);
    
    $columnList = implode(', ', array_keys($row));

    $sql = "SELECT * FROM list ";
    $query = mysqli_query($mysqli, $sql);
    
    while($row = mysqli_fetch_assoc($query)){
        $invoice_id = $row['invoice_id'];
        
        $tables = ['sd_order_more'=> 'order_id', 'sd_payment_rcvd' => 'invoiceID', 'sd_order_list' => 'orderID',];
        foreach($tables as $key => $value){
            $tableName = $key;
            $columnName = $value;

            $sql2 = "SELECT * FROM $tableName where $columnName = '$invoice_id'";
            $query2 = mysqli_query($mysqli, $sql2);        
            
            $array = [];
            while($row3 = mysqli_fetch_assoc($query2)){
                foreach($row3 as $key => $value){
                    if($value == ''){
                        $array[$key] = 'null';
                    }else{
                        $array[$key] = "'" .$value. "'";
                    }
                }

                $valueList = implode(', ', $array);

                $sql3 = "INSERT INTO $tableName VALUES ($valueList)";
                $query3 = mysqli_query($mysqli_online, $sql3);                 

                $status = (($query3) ? 'Success' : 'Fail') . "<br>";
                
                echo "Invoice id: " .$invoice_id. " Target table: " .$tableName. " status: " .$status. "<br>";
            } 
        }
    }    
?>

<!-- 
    sd_order_more x 1
    sd_payment_rcvd x 1
    sd_order_list x more
-->
sublime auto save & tab size
code auto save
if i want to save all last edit code automatically

Go> preferences > setting > 
Right side window [user]
{
   "save_on_focus_lost":true,

   "tab_size": 3,
   "translate_tabs_to_spaces": true,
   "detect_indentation": false
} 
save & close window...
sublime
Sublime not showing folder structure

***
view > side bar > show side bar
sublime License
YouTube link
It is working well...

****
www.youtube.com/watch?v=csjG0xoDMcE
or
www.youtube.com/watch?v=yNsRvBybMIA
sublime [enter]
How to input new line character in Find and Replace field

solution:
Ctrl+enter, [replace place]
or you can turn on regex mode and enter a
Sublime: Package List
link: https://www.youtube.com/watch?v=FeuZtBdS20c
First : Tools/Install Package Controlles
Preference/package control...
1) Laravel Blade Highlighter
2) Laravel Blade AutoComplete
3) Bootstrap4 autocomplete
4) HTMLBeautify
5) Terminus
command-course
	Question:											Answer/Code

	cmd background & font color 					color 0A
	List of color:										color/?	or color ?
	Default color 										color
	Clear all											cls

	-->Folder/File Matter<--
	**[Create]**
	make folder 										mkdir folderName
	----------
	----------
	make file  											echo >fileName.extension
	make file with text  							echo text >fileName.extension
	write extra text to the file 					echo text >>fileName.extension
	copy text to another file 						copy sourceFile targetFile
	copy all file & folder details in text 	dir >> fileName.extension
		
	**[Read]**
	see all file this folder						dir
	show all file with hidden						dir/a
	----------
	----------
	open/read file on window						tabButton continue for see file/video/audio name [enter]
															or type file name then [enter]
	read text file in Command Prompt 			type fileName.extension

	**[Edit/Update]**
	rename folderName 								move Name.extension targetFileName.extension [move a.txt b.txt]
	----------
	----------
	rename fileName 									move fileName.extension targetFileName.extension [move a.txt b.txt]
	First Name  [this word edit easily] 		cd First Name [Ctrl -> or <-]

	**[Delete]**
	Delete folder when empty						rmdir folderName
	Delete folder when have file					rmdir /s folderName
	----------
	----------
	delete file 										del fileName.extension

	**[Other action]**
	Move folder											cd folderName
	move folder without type  						cd tabButton continue & enter
	move folder without type & filter			cd folderFirstWord tabButton continue
	Ex: a1, a2, b1, b2  [type: cd b TAB continue] Output: b1, b2
	Move a folder to another folder 				move folderName destinationFolderName
	back from folder 									cd..	or cd ..
	two step back folder 							cd ../..
	list a particular type							dir *.extension
	----------
	Desk name list 									wmic logicaldisk get name
															Output: C: D: E: F: G:
	Move any Drive this pc 							driveName: 			Ex: D:  or E:
	Folder structure with tree 					tree

	c programming file run 							gcc hello.c   
															automatically create a random new file.exe,
															type file name and enter.
	Edit c random ficompile file name 			gcc -o chooseName file.c
															then ckooseName & enter
delete forder
Blank folder
rmdir folder

Folder have data
rm -r  folderName
Chrome speed
cmd/open with administory

***********
1) C:Windowssystem32>ipconfig /flushdns
2) C:Windowssystem32>netsh winsock reset
3) C:Windowssystem32>exit
Laragon setup
laragon: https://laragon.org/download/index.html
phpMyAdmin : https://www.phpmyadmin.net/

Now if you want to use phpMyAdmin in Laragon 
please follow below steps:

1) Download latest phpMyAdmin zip file.
2) Extract to path/to/laragon/etc/apps
    Example: C:laragonetcapps
3) The folder name must be phpMyAdmin
4) Restart Laragon must.

phpmyadmin
username= root
password= ""
XAMPP Autorun
https://www.youtube.com/watch?v=hqQehWUWEpY&ab_channel=SoftwareGeek
link
1) http://www.primitivetype.com/articles/quotes_inputs.php

2) https://stackoverflow.com/questions/2004298/input-field-containing-double-quotes-value

3) https://www.google.com/search?client=firefox-b-d&q=how+to+send+a+single+quote+text+input
screen/display
what is my screen resolution ?

**********
https://bestfirms.com/what-is-my-screen-resolution/
Why is there a "/? I=1"
When You are using free hosting it will automatic add ?i=1
But I have Solution for it.

Add following code in .htaccess file to remove ?i=1 from URL.

Code:

RewriteCond %{QUERY_STRING} ^(.*)i=[^&]+(.*)$ [NC]

RewriteRule ^(.*)$ /$1?%1%2 [R=301,L]
string length
Calculate String Length

link:
https://codebeautify.org/calculate-string-length
Auto Scroll Chrome
1)	Best Auto Scroll
https://chrome.google.com/webstore/detail/best-auto-scroll/bmbodajfpkgodcdkdiakjdhmdpppedbb/related

2)	Simple Auto Scroll
https://chrome.google.com/webstore/detail/simple-auto-scroll/dccjkemhmffnljlnnoffljpkhkfpldff/related?hl=en
Dark Mode [W10]
1) To put Windows 10 in dark mode, first open the [Start Menu] and type [dark theme settings].
Click on the first option that appears.

2) [Start menu] --> settings --> personalization --> color --> see down ^ choose your default  app mood.
FileZilla transfer very fast
1) In Filezilla click Edit.
2) Click Settings….
3) Click Transfers.
4) Increase Maximum simultaneous transfers to 10.
5) Click Ok.
W10 activator [save dot cmd]
windows 10 home & other: https://productkey.net/free-windows-10-home-product-key-2019/

G-Drive link: https://drive.google.com/open?id=10pX6RTx3IzbtmFQe7kPdYa8cd5WjQfpf

Chrome hang
1) cmd with administor: netsh winsock reset
2) in chrome: setting: below--> show advanced settings
	system
	Use hardware acceleration when available
	off
Screen resolution
https://bestfirms.com/what-is-my-screen-resolution/
Office 2019 free
link:
https://www.youtube.com/watch?v=aif9g-hcAew
All softwere
http://103.85.156.222/

bdplex
top 10
Top 10 Sites for your career:
1. LinkedIn
2. Indeed
3. Naukri
4. Monster
5. JobBait
6. Careercloud
7. Dice
8. CareerBuilder
9. Jibberjobber
10. Glassdoor
Top 10 Tech Skills in demand in 2019:
1. Machine Learning
2. Mobile Development
3. SEO/SEM Marketing
4. Data Visualization
5. Data Engineering
6. UI/UX Design
7. Cyber-security
8. Cloud Computing/AWS
9. Blockchain
10. IOT
Top 9 Sites for Free Online Education:
1. Coursera
2. edX
3. Khan Academy
4. Udemy
5. iTunesU Free Courses
6. MIT OpenCourseWare
7. Stanford Online
8. Codecademy
9. Open Culture Online Courses
Top 10 Sites to learn Excel for free:
1. Microsoft Excel Help Center
2. Excel Exposure
3. Chandoo
4. Excel Central
5. Contextures
6. Excel Hero
7. Mr. Excel
8. Improve Your Excel
9. Excel Easy
10. Excel Jet
Top 10 Sites to review your resume for free:
1. Zety Resume Builder
2. Resumonk
3. Resume dot com
4. VisualCV
5. Cvmaker
6. ResumUP
7. Resume Genius
8. Resumebuilder
9. Res
Responsive site
http://www.responsinator.com/
free hosting
https://cp1.awardspace.net/file-manager/
km player all song
option/
play/
after playback/
play next file in the folder

N:B: All file not show in playlist but all song play one by one

software version  2020.03.24.15  + more
google map api key
https://www.youtube.com/watch?v=OGTG1l7yin4&ab_channel=ImranEmu

1. Firstly Go to Google Maps - https://console.cloud.google.com/​
2. Sign In with your Google account and agree with the terms and conditions
3. Create a project and name it as you want
4. Select the project and click on it
5. Navigate to APIs and Services and  click on Libraries
6. Enable the following Libraries one by one 
   1. Google Javascript API 
   2. Google Place API 
   3. Google Direction  API 
   4. Google Geolocation API 
   5. Google Geocoding  API
7. Navigate to APIs and Services and  click on Credentials 
8. Click on Create Credentials and then the API key and it will show up a screen with API Key
9. Now you can optionally restrict the API key.


https://developers.google.com/maps/documentation/javascript/overview#Inline
.htaccess
<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^ ^$1 [N]

    RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
    RewriteRule ^(.*)$ public/$1 

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ server.php

</IfModule>
markdown
<details>      
	<summary></summary>
		<pre>
      </pre>   
</details>

<details>
   <summary>1) Create Table</summary>
</details>
Ram faster
1) Control Panel\All Control Panel Items\Power Options
	select[High performance]
   
2) Disable unwanted startup program
	tast manager[startup-> disable]

3) start->search[defragment and optimize drives]
	select[]c drive -> click[optimize ]

4) delete temporary files 
	start-> run-> %temp%
	start-> run-> temp
	start-> run-> prefetch

5) clean up memory
	my computer-> c drive-> propertise-> disk cleanup-> selete-> clean up system files.-> ok

6) reduce run time service
	start-> run-> msconfig-> services-> click[hide all microsoft services]-> ok

7) registry tweaks
	start-> run-> regedit
		Hkey_current_user-> control panel-> desktop-> MenuShowDelay-> 10[previous 400] ok
						    mouse-> MouseHoverTime-> 10[previous 400] ok

8) visual effects
	start-> system-> advanced system settings-> 1st preformance[settings]-> click[adjust for best performance] choose[example-> show shadows under mouse pointer]
skill
1) Programming language
2) soft skill
	* Communication,
	* negociation, 
	* team builing, 
	* team working, 
	* coppration, 
	* supportive.

3) cv
4) interview
company mission vision, client
5) job circular requirnment
6) about yourself
	weakness, overcome this weakness by time
7) job search 
	linkin profile, professional experience, job search
job search web: monster, indeed
wifi password
cmd
netsh wlan show profiles
netsh wlan show profiles "name" key=clear

see below
Security settings
key content:	value.... :)
HDD delete
cmd
C:source>diskpart
->list disk
->select disk 0
->clean
->create partition primary
->format fs=ntfs quick
sherine
Bi Kelma Menak
Katar Khayre
Koly Melkak
El Watar El Hassas
Esaal Alaya
Ana Mesh Bitaat El Kalam Dah (remix)
Ah Ya Donia شيرين عبد الوهاب اه يا دنيا
Bayyaeen El Sabr
انا مش بتاعت الكلام ده (ريمكس)
El Kadabeen
Kont 'Arfa
Habeit
Fakirne Eyh
We Meen Ekhtar
Tagroba Molema
Tag Rasak
Metakhda Mn El Ayam
Inkhatably Omr
Mashaaer (From Hikaeyt Hayat Series)
Shereen Just a Dream (feat. Nelly)
شيرين عبد الوهاب مشاعر تتر مسلسل حكاية حياة
Bethke Fe Eih
لازم أعيش
Da Mesh Habibi
W Meen Ekhtar
Khaletny Akhaf
Kolly Melkak
هتروح
نفسى افهم ليه
ماتحاسبنيش
انكتبلى عمر
Shokran Ya Shahm
Da' El-Saytara (Studio)
على بالي
Mesh Khayfa
Batamenak
Hatrooh
بتحكى فى ايه
Ma Thasebneesh
كتر خيرى
Fe Leila
Ya Layali (Studio)
'Aala Baly
Metakhda Men El-Ayam (Studio)
جرح تاني
Hobboh Ganna
Kolly Melkak (Studio)
علي بالي
قال صعبان عليه
W Meen Ekhtar شيرين ومين اختار
font
font-family: "Space Grotesk",sans-serif;
Real Estate company
a. Zillow com
b. Realtor com
c. RealEstate com au
d. Loopnet com
e. Domain com au
cmder install
https://cmder.app/
zip folder unzip then store this folder c drive.
cmder.exe open with adminester
then type : 
.\cmder.exe /REGISTER ALL

then see as global
See for reference...
https://github.com/cmderdev/cmder
https://youtu.be/j1SMXgXv0Fc?t=333
Mouse remove unused right click
Search : Registry Editor
Computer\HKEY_CLASSES_ROOT\Directory\Background

https://www.youtube.com/watch?v=rypIQR5BmhA&ab_channel=Buzz2dayTech
Opening a PDF file in 100% view
Edit>Preferences>Page Display>Default layout and zoom.
Zoom [Automatic To 100%]

https://community.adobe.com/t5/acrobat-reader-discussions/opening-a-pdf-file-in-100-view/td-p/3056780
Service Container & Provider
Container 
https://www.youtube.com/watch?v=oj8Fnp1a2uE&t=82s&ab_channel=WebJourney

Provider 
https://www.youtube.com/watch?v=J7cqVUxU7fs&ab_channel=WebJourney
Design pattern
Which design pattern you usually implement in your projects?*
 Builder
 Factory
 Template
 Pipeline
 Adaptor
 Strategy
 Observer
 None of the above
Why we should hire you?*
I'm serious about my work, dateline work, mode communication skill for solve the major issue from team, documentad wist work, work record to google calender for future reviow work, and if i face any major issue i, i discuss more the problem and try to solve before project dateline. That means project date line is dateline
smtp
asctg
xfyghxsykixfdsgr
Proposal
I'm an independent web developer
experienced and I offer my services to create or redesign websites for business and individuals.
I specialize in creating dynamic and modern websites, using technologies like HTML, CSS, JavaScript, PHP, and MySQL. As a frame, I use Laravel for PHP and Tailwindcss for CSS.
My services include:
• Creating custom websites
• Redesigning existing websites
• Integration of features and add-ons
• Speed and speed optimization
performance
• Integrating online payment solutions
• Support technique and maintenance
I am flexible and adapt to your needs and goals, while offering you a job of
quality at competitive rates.
If you are interested in my services or have any questions, please feel free to contact me. I look forward to working on it
you on your next web project.

website, whatsapp
About me
Hi, I am Aslam Hossain. After completion of B.Sc degree in CSE in the year 2019 & complete my final project called Market Info. I started Internship from Affable Technology as a Full Stack Developer . I completed three dynamic web applications (HRM, Online Voting, Job portal) and update a courier service website.

Then I complete a University’s ‘question & blood bank’ project & also complete a coreCode project where I save my important code for using future.

In October-2019 to February-2020, I completed two laravel projects(eCommerce, mySong) and create a color code project using php.
Bid
Hi Sir/Madam
At first take my cordial love. I hope you are keeping well.

I have 1 year coding experience. i m also a CSE engineer so that i know about HTML5, CSS3, bootstrap4.2, javascript[medaim], php and mysql server.
If you want to give me your project , i will completely work hard and sole to complete you project

N:B I need maximum 7 days to complete your valuable project.
For your kink information, I m a fresh coder.

myFinal project: http://bazarinfo.ml/
Github Link : https://github.com/aslamcsebd/

Thnaks a lot sir.
why should we hire you?
I m so much Sencetive about my work, project  dynamic matter, project dateline, easy to use project access, clean code, about project documentation for better project understanding and future backup use github.
It i don't help you any single project matter, i try to know u quickly so that you solve another way and save both time for next project.
allow me a remote
If you allow me a remote developer, i will give you my best effort, if possible please give me a chance to work in your company, it is better for my career, at last i will join your company in future when u & me understand clearly, Example : I m a good developer, you are a good team leader. If prove it, i will create my future career in your valuable company.
Monitor size
hp vs benq (21.5")
height :  14" to 15.5"
width  :  19" to 19.5"

Table size
height :  17"
width  :  27" to 37"
Freelancer
Hello Sir, 
I complete your website within 5 days.
I am a full stack web developer.
I complete your website with secure by laravel framework.
If possible please share with me your project demo or any link.

Can i have more detail please?

I am willing to start right away.

Please check my profile for work and experience.

Regards

Md Aslam
Workplace About
Hi,
	I am Md Aslam. I am  Graduated in Computer Science and Engineering. I am a full stack developer from 2018 to now. I have completed many projects related to database and web development. I am well skill [Html5, css3, Bootstrap4, JavaScript], [C, Java, MVC, Php (Laravel), MySQL], [Photoshop, Git, MS office, MS Excel] and other similar tools and technologies. I always keep concentrate on my work for efficient results. Worked so many Project With Best Quality and Client Satisfaction.

If you have any queries feel free to contact me. Thank you
Rocket Journey
dhaka to barisal
সোম বৃহস্পতি 

শনি বুধ
barisal to dhaka
VS Extension
Vs code path:
    C:\Users\Aslam\AppData\Local\Programs\Microsoft VS Code
Vs code extension path:
    C:\Users\Aslam\.vscode\extensions
Background color
    Shades of Purple
    One Dark Pro

SynthWave
    href to view <i>href</i>
    ctrl+shift+p
    SynthWave [Enable neon]

icon
    Material Icon Theme
    vscode-icons

Auto Close Tag
Auto Rename Tag

Code Spell Checker
Prettier - Code formatter
https://www.youtube.com/watch?v=z9K1XBf01ls&ab_channel=CODESHARK

Live Server
Live Share

Bracket Pair Colorizer
indent rainbow
extension
PHPDoc Comment
HTML CSS Support
IntelliSense for CSS class names in HTML
PHP IntelliSense
PHP Namespace Resolver
Laravel Blade formatter
Laravel Blade Snippets
Save Commands
How to disable codelens in VS code? disable references
settings.json
 "editor.codeLens": false or true
tab size 4
setting/tab search
tab size : 4 set

Editor: Detect Indentation : Uncheck 
If uncheck, the tab 4 work globally
FTP
https://www.youtube.com/watch?v=SknrqcTzh1g
[
	{
		"name": "",
		"host": "",
		"port": 21,
		"type": "ftp",
		"username": "",
		"password": "",
		"path": "/",
		"autosave": true,
		"uploadOnSave": true,
                Or
                "autoUpload": true,
		"confirm": false
	}
]
VS code extension Power by AI
Github copilot
tabnina
blackbox
code gpt
bito ai
mintlify doc writer
readable
denigma

https://youtu.be/6wilewRV3xQ?t=2439
auto close tag
auto impot es6, ts jsx...
auto rename
Eslint
npm intellisence
path intellisence
postman or thunder clint
prettier
reactjs code snippets
snipped
styleint
tailwind css
vscode react refactor
vscode-icons
formetter
Ctrl + shift +P

select : formate document
php function button click
PHP Intelephense
PHP Namespace Resolver
vscode keyboard shortcuts setup
Vs code editor the press

Ctrl K S
The view the keyboard shortcuts

https://www.youtube.com/watch?v=pilep_-SSQI&ab_channel=GhostTogether
markdown preview (readme.md)
In the readme.md pahe
Press

Ctrl V
Save Commands
global command
php --version > sudo update-alternatives --config php
php artisan serve
php artisan db:wipe; php artisan  migrate
npm run dev
apache2 restart > sudo systemctl restart apache2
all clear >
php artisan cache:clear;
php artisan config:clear;
php artisan config:cache;
php artisan view:clear;
php artisan route:clear;
php artisan optimize:clear;

update & upgrade > sudo apt update; sudo apt upgrade
composer install
Collapse All Functions
Ctrl K 0

https://www.youtube.com/watch?v=EmSuX3e6Ejs&ab_channel=GhostTogether
Terminal open
search 
1) Manage Shell (Or git version control->click : Manage Shell Plugin)
2) click : Enable SSH access

-----------------------------
|  Access Details: 	    |
|----------------------------
|  Server ip	: 12.13.14  |
|----------------------------
|  UserName	: abcUser   |
|----------------------------
|  SSH port	: 12345     |
-----------------------------


3) check : on/off switch

go to the index page another tab and see advance/Terminal icon show now

4) now click terminal

5) command bellow
ssh -p port username@Server ip

example
ssh -p 12345 abcUser@121314

then cPanel password

just ok

https://www.youtube.com/watch?v=NfN6gGJkg3g&ab_channel=TonyTeachesTech
did not match expected CN=`smtp.gmail.com'
stream_socket_enable_crypto(): Peer certificate CN=`server.cpanelmanager.com' did not match expected CN=`smtp.gmail.com'

.env file
MAIL_MAILER=sendmail

config/mail.php
'default' => env('MAIL_MAILER',  'sendmail'),

https://www.youtube.com/watch?v=0tHdid5cnzE
There is no existing directory at /storage/logs and its not buildable: Permission denied
https://stackoverflow.com/questions/51041196/there-is-no-existing-directory-at-storage-logs-and-its-not-buildable-permissio
Moodle install
https://www.youtube.com/watch?v=nd4dytem4DA&ab_channel=EdtechFans

php extension  intl
---------------------
path php/php.ini
add 4 line
-----------
extension= php_intl.dll
[intl]
intl.default_locale = en_utf8
intl.error_level = E_WARNING

php_extension	soap
path php/php.ini

;extension=soap
to
extension=soap

https://stackoverflow.com/questions/2509143/how-do-i-install-soap-extension


php_extension	sodium
https://www.youtube.com/watch?v=lTMEU6Xp5fE&ab_channel=ThiwankaraPAP


php_setting		opcache.enable
https://www.youtube.com/watch?v=6dnCgXsURhk&ab_channel=FSingenieria


max_input_vars

go to : apache2/php.ini

;max_input_vars = 1000

max_input_vars = 5000



============================
This site can't be reached during installation
https://moodle.org/mod/forum/discuss.php?d=387587#p1562603

go to XAMPP-Cotroll and open Apache->Config->httpd.conf
and add
 
<IfModule mpm_winnt_module>
   ThreadStackSize 8888888
</IfModule>

to the end
Theme install
theme install
We choose now spae 2.1.3 version theme.

Go to
Site administration > Plugins > Install plugins > Choose a file... > Upload a file (zip file) > Upload this file
Wait some time


Now select the space theme on this moodle as default

Go to
Site administration > Appearance > Themes > Theme selector > Default(Boost) Change theme > 	
Space (2.1.2) (Use theme) > Continue


Or...
Unzip the Space file the Paste the project "Theme folder"

the end
Purge caches
Dashboard > Site administration > Development > Purge caches > Purge all caches
Uninstall theme plugin
If you uninstall "Space" theme plugin

Site administration > Plugins > Plugins overview
N:B: but you don't see the Action's uninstall option. Because you already use this plugin.
So select default theme(Classic) then you see the action's uninstall option.

https://www.youtube.com/watch?v=kJGMQco1BcA&ab_channel=LMSTutorial
Theme settings
Logo add
Navbar color add
Navbar option add

etc all setting go to

Site administration > Appearance > Themes > Theme settings
Site administration > Appearance > Themes > Theme > Space > Top Bar
Site administration > Appearance > Themes > Theme settings > Custom menu items
Add hero image
Site administration > Appearance > Themes > Space 
Left side chose Block #3 (Hero image)

Right side Turn on and add image bellow
Language add
Site administration > Language > Language packs > Select > language and install
Sass install setup
Initialize your project

    npm init -y`

Install bootstrap    

    npm i bootstrap@next

If it no working you should install any [particular version](https://getbootstrap.com/)

    npm install bootstrap@5.3.0-alpha1

[install bootstrap icons](https://www.npmjs.com/package/bootstrap-icons)

    npm i bootstrap-icons
  
Create *index* page

    touch index.html

Create a scss folder and include main.scss file

    mkdir scss
    cd scss
    touch main.css

Include all of Bootstrap’s sass
    import this line
    
    @import "../node_modules/bootstrap/scss/bootstrap";
    File path: scss/main.scss

Source: https://www.youtube.com/watch?v=rGUvzhVTqhw&t=603s

Run sass command
    sass --watch .

Stop
    Press Ctrl-C
Scss Vs Sass
Scss input
-----------
$color: blue;
body {
    background-color: $color;
}

Scss output
-----------
body {
    background-color: blue;
}

================

Sass input
-----------
$color: blue;
body
    background-color: $color;
}

Sass output
-----------
body {
    background-color: blue;
}

https://www.geeksforgeeks.org/what-is-the-difference-between-scss-and-sass/
Sass edit
Suppose i want to change card background color

_card.scss
    .card{
        --#{$prefix}card-bg: #{$card-bg};
    }


_variable.scss

    $card-bg:  var(--#{$prefix}body-bg) !default;


_root.scss

    :root,
    [data-bs-theme="light"] {
        --#{$prefix}body-bg: #{$body-bg};

        N:B: Go to _variable.scss
        $body-bg:                   $white !default;
        $white:    #fff !default;
    }

    @if $enable-dark-mode {
        @include color-mode(dark, true) {
            --#{$prefix}body-bg: #{$body-bg-dark};

            N:B: Go to _variable-dark.scss
            $body-bg-dark:     $gray-900 !default;

                _variable.scss
                    $gray-900:  #212529 !default;

                    $dark:      $gray-900 !default;
                    $body-color:    $gray-900 !default;

        }
    }
sslcommerze env problem
https://stackoverflow.com/questions/63338991/how-to-solve-laravel-sslcommerze-integration-error
sslcommerze redirect
go to
config/sslcommerz.php

add the project path

'success_url' => 'projectName/success',

Ex: $path = "/eCom";
'success_url' => $path.'/success',
redirect session problem
https://github.com/sslcommerz/SSLCommerz-Laravel/issues/38
Url pass js to modal
https://laracasts.com/discuss/channels/laravel/pass-an-id-to-a-modal-window-and-then-delete-a-record
model data pass
 <div class="p-2 my-1 border border-primary item_remove" data-toggle="modal" data-target="#item_remove" data-id='123' style="cursor: pointer;">
    </div>

    <div class="modal fade" id="item_remove" data-backdrop="static" data-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" style="display: none;" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header py-2">
                    <h5 class="modal-title" id="staticBackdropLabel">Item remove</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">×</span>
                    </button>
                </div>
                <h5 class="modal-body text-danger">                                    
                    Are you want to remove this item?
                </h5>                
                <div class="modal-footer py-2">
                    <button type="button" class="btn btn-secondary px-3" data-dismiss="modal">No</button>
                    <button type="button" onclick="" data-dismiss="modal" class="btn btn-danger yes px-4">Yes</button>
                </div>
            </div>
        </div>
    </div>

    <script type="text/javascript">
        $(document).on("click", ".item_remove", function () {  
        Or
        $('.item_remove').click(function() {             
            var id = $(this).data('id');
            $('.yes').attr('onClick','item_remove('+id+')');
        });

        function item_remove($id){
            var id = $id;
            var action = 'remove';
            $.ajax({
                url:"action.php",
                method:"POST",
                data:{
                    id:id,
                    action:action
                },
                success:function(){
                    location.reload();
                }
            });
        }
    </script>
Tutorial
https://www.youtube.com/watch?v=JJFhOGDvQw8&list=PLnZgHKyxHOEDtwU2gdk3v2Qxt6_cU7q4-
React eCommerce Website
https://www.youtube.com/watch?v=R500Rdfsg00&list=PLnZgHKyxHOECKS3EcBTx8BoJ0SBBfWT4I
React and Node
https://www.youtube.com/watch?v=6a4B7ev3vd0
blocked by CORS policy: No 'Access-Control-Allow-Origin'
//install cors using terminal/command  
        $ npm install cors

//If your using express in your node server just add
        var cors = require('cors');
        app.use(cors())

//Node.js, express.js [route call here]
        app.use('/api/workouts', workoutRouters)

https://stackoverflow.com/questions/41497674/access-control-allow-origin-issue-when-api-call-made-from-react-isomorphic-ap
Uncaught (in promise) SyntaxError: Unexpected token '<', "<!doctype "... is not valid JSON
.
Php all version
https://www.apachelounge.com/viewtopic.php?t=6359

https://windows.php.net/downloads/releases/
SMTP Email setup
myaccount.google.com/
security
App passwords [See bottom]

then set [App name]
multiple command with artisan terminal
php artisan view:clear; 
php artisan route:clear; 
php artisan cache:clear; 
php artisan config:clear
Mongo DB into Laragon
Laragon > Menu > Tools > Quick add > Configuration
Add bellow line

# MongoDB https://www.mongodb.com/download-center/community

mongodb-6=https://fastdl.mongodb.org/windows/mongodb-windows-x86_64-6.0.11.zip

# Robomongo
robomongo=https://download.studio3t.com/robomongo/windows/robo3t-1.4.4-windows-x86_64-e6ac9ec5.zip

Import [mongodb, robomongo]
Laragon > Menu > Tools > Quick add > click [mongodb, robomongo]

https://www.youtube.com/watch?v=ZbYcyshf1dI
package list
php artisan package:discover --ansi
     
	output list
	Discovered Package: facade/ignition
	Discovered Package: fideloper/proxy
	Discovered Package: fruitcake/laravel-cors
	Discovered Package: laravel/tinker
	Discovered Package: laravel/ui
	Discovered Package: nesbot/carbon
	Discovered Package: nunomaduro/collision
	Package manifest generated successfully.

Remove/uninstall package

	Syntax:
	composer remove <package>
	
	Example:
	composer remove laravel/tinker
design principles
Understanding of key design principles (SOLID, DRY, KISS etc).

Kiss : Keep it simple, stupid (KISS) principle
DRY : Don’t repeat yourself (DRY) principle

SOLID
S => Single Responsibility Principle
O => Open-Closed Principle
L => Liskov Substitution Principle
I => Interface Segregation Principle
D => Dependency Inversion Principle
Laravel Queue full video
https://www.youtube.com/watch?v=fYNAi2oZ9y8&list=PLVWmHBgSb-u8slYKd7B1dM4HpGwRX6B1X&ab_channel=ProgrammingwithCodeSteps
php test case
php artisan make:test UserTest
php artisan make:test ExampleTest --unit

location: tests/[Unit, Feature]/ExampleTest.php
public function test_example(){
AAA
// Arrange
// Act
// Assert
}

Run all
php artisan test
Run singel
php artisan test --filter studentTest
php Synchronous
Synchronous PHP refers to the traditional way PHP applications execute code: synchronously, or in a blocking manner. In synchronous PHP, tasks are executed sequentially, meaning that each task must finish before the next one starts.

Index
$_COOKIE
$_ENV
$_FILES
$_GET
$_POST
$_REQUEST
$_SERVER
$argc
$argv
$HTTP_RAW_POST_DATA
$php_errormsg
$this
__call() Method
__callStatic() method
__clone() method
__get() method
__invoke() method
__isset() method
__serialize() method
__set() method
__set_state() method
__sleep() method
php Magic Methods
The following method names are considered magical: __construct(),
__destruct(), 
__call(), 
__callStatic(), 
__get(), 
__set(), 
__isset(), 
__unset(), 
__sleep(), 
__wakeup(), 
__serialize(), 
__unserialize(), 
__toString(), 
__invoke(), 
__set_state(), 
__clone(), and 
__debugInfo().
Write down your five key JD's
What are the 5 elements of a job description?
Job Description Components. A job description contains the following components: job title, job purpose, job duties and responsibilities, required qualifications, preferred qualifications, and working conditions.
Linux software update
1st: Go to the software update option from search, then next next.

2nd: terminal
sudo apt update
sudo apt upgrade
Software install
sudo apt install vlc kmplayer vscode
Software install(deb)
Google chrome install. This software don't have default on linux. So download google for google chrome on deb application

sudo dpkg -i '.deb file link'
If you select the deb file and throw the terminal, automatically path working
Unstall app
sudo apt remove vlc
mp3, mp4 not open?
sudo apt install ubuntu-restricted-extras
Linux battery backup problem
If battery charge loss quickly. Run this 2 command

sudo apt install preload
sudo apt install tlp tlp-rdw
Linux version
uname -r
uname -a
lsb_release -a
Windows software install linux
1st:
sudo dpkg --add-architecture i386 
sudo mkdir -pm755 /etc/apt/keyrings
sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key

2nd: check linux version : lsb_release -a
then install version wise command:
see link: https://wiki.winehq.org/Ubuntu
Then : sudo apt update

3rd: Install Wine
Three option have, but install anyone. (Stable branch	
: is better)

https://www.youtube.com/watch?v=9jBt8RAj1ks&ab_channel=ProgrammingKnowledge2
Linux mouse one click
Go any folder
3 dot
Step 2: Click on the menu icon (3 horizontal lines) at the top right. Then click on the "Preferences" option on the dropdown menu.

action to open item (single click)
tar.gz file install
sudo apt-get install alien (1st time)
sudo aline -d 'file path'

see the .deb file

then install .deb file
sudo dpkg -i "path"
Linux system restore
sudo dconf dump
dconf reset -f /
whatsapp
sudo snap install whatsapp-for-linux
Server install
sudo apt install git

Apache Web Server
https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-ubuntu-20-04


PHP-FPM
https://www.digitalocean.com/community/tutorials/how-to-run-multiple-php-versions-on-one-server-using-apache-and-php-fpm-on-ubuntu-20-04


mysql
https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-20-04


phpmyadmin
https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-20-04
phpMyAdmin
phpMyAdmin
https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-20-04
error
Problem : sudo: /etc/sudo.conf is world writable
Solution : sudo chmod -R 640 /etc/sudo.conf
sudoers.so = 644 (File permission)

https://www.youtube.com/watch?v=QeOlLqh8YYU&ab_channel=LinuxeHub
Permission (folder, file)
sudo chmod -R 777  (folder, file name path)
Popup Notifications not working
sudo apt-get install --reinstall mate-notification-daemon-common
sudo apt-get install --reinstall mate-notification-daemon
The stream or file "/var/www/html/storage/logs/laravel.log"
sudo chmod o+w ./storage/ -R
Laravel showing code of index.php on home page
sudo a2enmod actions fcgid alias proxy_fcgi
404 Not Found The requested
1) sudo a2enmod rewrite

2) Goto and open [/etc/apache2/apache2.conf]
Or sudo nano /etc/apache2/apache2.conf

3)
Original
<Directory /var/www/>
     AllowOverride None
</Directory>

Update To
<Directory /var/www/>
    AllowOverride all
</Directory>

4) systemctl restart apache2

https://stackoverflow.com/questions/18853066/404-not-found-the-requested-url-was-not-found-on-this-server
Laravel: file_put_contents() failed to open stream:
sudo chown -R $USER:www-data storage
sudo chown -R $USER:www-data bootstrap/cache
sudo chmod -R 775 storage
sudo chmod -R 775 bootstrap/cache
vlc
sudo snap install vlc
anydesk install
sudo dpkg -i anydesk.deb path
sudo apt-get install libgtkglext1
sudo apt --fix-broken install

link: https://www.youtube.com/watch?v=fqOPukxJ8oE&ab_channel=CodeWithArjun
sql file import
mysql -u root -p
Enter password

mysql> create database newDB;
mysql> show databases;
mysql> use newDB;
mysql> source /var/www/html/newDB;
save history
history -w print.txt
or
history > print.txt
multiple same name input using ajax and php
foreach ($pro as $item) {
    <input type="hidden" name="combo_pro_id[]" value="<?= $item; ?>" readonly>

<select class="form-control combo_emp_id" required name="combo_emp_id[]" id="combo_emp_id">
          <option value="">Select now</option>
          <option value="1">1</option>
          <option value="2">2</option>
</select>

<button type="button" id="combo_add_cart">Add</button>
}
   $(document).on("click", "#combo_add_cart", function() {
        var combo_id = $("#combo_emp_id").val();
        if (combo_id == '') {
            $('.manAlert').show();
        } else {
            var combo_id = $("#combo_id").val();

            var combo_pro_id = {};
            var i = 1;
            $("input[name='combo_pro_id[]']").each(function(){
                combo_pro_id[i] = $(this).val();
                i++;
            });
            
            var combo_emp_id = {};
            var j = 1;
            $("select[name='combo_emp_id[]']").each(function(){
                combo_emp_id[j] = $(this).val();
                j++;
            });
                        
            // alert(JSON.stringify(combo_emp_id));

            var type = 'combo';
            $('#combo_modal').modal('toggle');
            $("#combo_emp_id").val('');

            var action = "add";
            $.ajax({
                url: "includes/cart_action.php",
                method: "POST",
                data: {
                    combo_id: combo_id,
                    combo_pro_id: combo_pro_id,
                    combo_emp_id: combo_emp_id,
                    type: type,
                    action: action
                },
                success: function(data) {
                    service_load_cart();
                }
            });
        }
    });

    $(document).on("click", ".combo_close", function() {
        $('.manAlert').hide();
    });




https://stackoverflow.com/questions/43890074/how-to-send-data-multiple-same-name-input-using-ajax-and-php
ajax live search
html
 <div class="col-md-2">
                                        <div class="form-group">
                                            <label>Customer Name</label>
                                            <input type="text" class="form-control" id="searchName" placeholder="Customer Name" />
                                            <div id="searchOutput"></div>
                                        </div>
                                    </div>

js
$(document).ready(function() {
        $('#searchName').on("keyup", function() {
            var getName = $(this).val();
            $.ajax({
                url: 'includes/customer_name.php',
                method: 'POST',
                data: {
                    name: getName
                },
                beforeSend: function() {
                    $("#searchName").css("background", "#FFF url(loader.gif) no-repeat 165px");
                },
                success: function(data){
                    $("#searchOutput").show();
                    $("#searchOutput").html(data);
                    $("#searchName").css("background", "#FFF");
                }
            });
        });
    });

    function selectName(val) {
        $("#searchName").val(val);
        $("#searchOutput").hide();
    }

file: customer_name.php
<?php
session_start();
require_once("db_connect.php");

$name = $_POST['name'];
$sql = "SELECT * FROM sd_client WHERE name LIKE '$name%'";
$query = mysqli_query($mysqli, $sql); ?>

<select id="searchList" multiple name="m_id" class="form-control">
    <?php
        while ($row = mysqli_fetch_assoc($query)) { ?>
            <option onClick="selectName('<?= $row["name"]; ?>');" value="<?= $row["id"]; ?>"> <?= $row["name"]; ?> </option>
    <?php } ?>
</select>

css

<style>
    #searchList {
        float: left;
        list-style: none;
        margin-top: -3px;
        padding: 0;
        width: 240px;
        position: absolute;
        overflow-y: auto;
        height: auto;
    }

    #searchList option {
        padding: 8px;
        border-bottom: #bbb9b9 1px solid;
    }

    #searchList option:hover {
        background: #ece3d2;
        cursor: pointer;
    }

    #searchName {
        padding: 10px;
        border: #a8d4b1 1px solid;
        border-radius: 4px;
    }
</style>

source
https://phppot.com/jquery/jquery-ajax-autocomplete-country-example/
ajax send for() attr value and receive
html
<input type="number" for="" id="unitPrice">
php
$data = array(
     'unit'  => $unit,
     'sell'  => $sell
);
echo json_encode($data);

ajax store
dataType: "json",
success: function(data){
   $('#unitPrice').val(data.sell);
   $('#unitPrice').attr('for', data.unit);
}

ajax receive
$("#unitPrice").attr('for');
npm
npm list
npm install name
npm uninstall name
nodemon
nodemon
sudo npm install -g nodemon [but package.json not record]
npm install --save-dev nodemon
npm install nodemon -D

nodemon app.js

[nodemon] app crashed - waiting for file changes before starting...

sudo pkill -f node

nodemon restart

npx nodemon app.js
faker.js
[Faker install](https://fakerjs.dev/guide/)

### [Faker install](https://fakerjs.dev/guide/)
- npm install @faker-js/faker --save-dev
- import { faker } from '@faker-js/faker';
- const randomName = faker.person.fullName(); // Rowan Nikolaus
- const randomEmail = faker.internet.email(); // Kassandra.Haley@erich.biz

```
Location folder: seeders/seed file[category-seeder.js]
------------------------
const { faker } = require('@faker-js/faker');

const users = [...Array(20)].map((user) => (
    {
        name: faker.person.firstName(),
        createdAt: new Date(),
        updatedAt: new Date()
    }
))

module.exports = {
    async up (queryInterface, Sequelize) {    
        await queryInterface.bulkInsert('Categories', users, {});
    },

    async down (queryInterface, Sequelize) {
        await queryInterface.bulkDelete('Categories', null, {});
    }
};
Code style
https://www.markdownguide.org/basic-syntax/
token dynamic set
Environment: create a project name env
create tokan variable name: userToken
 
Scripts code
var res = pm.response.json();
var token = res.data.access_token;
pm.environment.set('userToken', token);

use: another request
Authentcation/Auth Type/ Bearer token  : {{userToken}}