Skip to content

Instantly share code, notes, and snippets.

View ImtiazEpu's full-sized avatar
🔐
I'm sudo root

Imtiaz Ahmed ImtiazEpu

🔐
I'm sudo root
View GitHub Profile
<?php
//Question 1:
//You have a Laravel application with a form that submits user information using a POST request. Write the code to retrieve the 'name' input field value from the request and store it in a variable called $name.
//=============================
Route::post( '/submit', function ( Request $request ) {
// Retrieve the 'name' input field value from the request
$name = $request->input( 'name' );
function multiplicationTable(num) {
for (let i = 1; i <= 10; i++) {
const product = num * i;
console.log(`${num} x ${i} = ${product}`);
}
}
// Test the function with different input numbers
multiplicationTable(5);
multiplicationTable(7);
-- Use the employees table to answer the following questions:
a. SELECT * FROM employees;
-- This command selects all columns and rows from the employees table.
b. SELECT name, salary FROM employees WHERE salary > 50000;
-- This command selects the name and salary columns of all employees with a salary greater than 50000.
c. SELECT AVG(salary) FROM employees;
-- This command calculates the average salary of all employees.
{
"title": "#58377",
"order_id": 58377,
"data": {
"line_items": {
"line_items": [
{
"product_id": 20782,
"product_img_url": "https:\/\/cdn.hoodsly.com\/wp-content\/uploads\/2020\/10\/07000809\/Curved-With-Strapping-300x300.jpg",
"product_name": "Quick Shipping Options",
{
"order_title": "U-41344",
"order_desc": "",
"billing": {
"first_name": "Adam",
"last_name": "Alig",
"company": "Riverside Cabinets",
"email": "uscd@hypemill.com",
"phone": "615 218 5072",
"address_1": "6451 E Buckeye Bottom Rd",
<?php
//Q 1: Write a PHP function to sort an array of strings by their length, in ascending order. (Hint: You can use the usort() function to define a custom sorting function.)
function sort_arr_by_length($arr) {
usort($arr, function($a, $b) {
return strlen($a) - strlen($b);
});
return $arr;
}
@ImtiazEpu
ImtiazEpu / setup_guied.md
Last active February 14, 2023 19:43
How to setup sendgrid email in Laravel

Setup sendgrid email in Laravel

Here are the steps to set up SendGrid email in Laravel:

  1. Sign up for a SendGrid account and obtain an API key.

  2. Add the SendGrid API key to your Laravel environment file (.env) by adding the following line:

SENDGRID_API_KEY=YOUR_SENDGRID_API_KEY
<?php
//Q: Write a Reusable PHP Function that can check Even & Odd Number And Return Decision
function check_even_odd_number($number): string {
if ($number % 2 == 0) {
return "The number is even.";
} else {
return "The number is odd.";
}
<?php
$tuition_fee = 25000;
$commission = (20000 < $tuition_fee) ? 'Your commission is twenty-five percent' :((10000 < $tuition_fee && 20000 >= $tuition_fee)?'Your commission is twenty percent':((7000 < $tuition_fee && 10000 >= $tuition_fee)?'Your commission is fifteen percent':'invalid'));
echo $commission;
<?php
$link = get_the_permalink();
$title = get_the_title();
$text_encoded =urlencode($title);
$fb_link = add_query_arg('u', urlencode($link), 'https://www.facebook.com/sharer/sharer.php');
$tw_link = add_query_arg('status', $title.' '.urlencode($link), 'https://twitter.com/home');
$ln_link = add_query_arg(array(
'url' => urlencode($link),
'title' => urlencode($title),