Available Column Types in Laravel

CommandDescription
$table->id();Alias of $table->bigIncrements('id').
$table->foreignId('user_id');Alias of $table->unsignedBigInteger('user_id').
$table->bigIncrements('id');Auto-incrementing UNSIGNED BIGINT (primary key) equivalent column.
$table->bigInteger('votes');BIGINT equivalent column.
$table->binary('data');BLOB equivalent column.
$table->boolean('confirmed');BOOLEAN equivalent column.
$table->char('name', 100);CHAR equivalent column with a length.
$table->date('created_at');DATE equivalent column.
$table->dateTime('created_at', 0);DATETIME equivalent column with precision (total digits).
$table->dateTimeTz('created_at', 0);DATETIME (with timezone) equivalent column with precision (total digits).
$table->decimal('amount', 8, 2);DECIMAL equivalent column with precision (total digits) and scale (decimal digits).
$table->double('amount', 8, 2);DOUBLE equivalent column with precision (total digits) and scale (decimal digits).
$table->enum('level', ['easy', 'hard']);ENUM equivalent column.
$table->float('amount', 8, 2);FLOAT equivalent column with a precision (total digits) and scale (decimal digits).
$table->geometry('positions');GEOMETRY equivalent column.
$table->geometryCollection('positions');GEOMETRYCOLLECTION equivalent column.
$table->increments('id');Auto-incrementing UNSIGNED INTEGER (primary key) equivalent column.
$table->integer('votes');INTEGER equivalent column.
$table->ipAddress('visitor');IP address equivalent column.
$table->json('options');JSON equivalent column.
$table->jsonb('options');JSONB equivalent column.
$table->lineString('positions');LINESTRING equivalent column.
$table->longText('description');LONGTEXT equivalent column.
$table->macAddress('device');MAC address equivalent column.
$table->mediumIncrements('id');Auto-incrementing UNSIGNED MEDIUMINT (primary key) equivalent column.
$table->mediumInteger('votes');MEDIUMINT equivalent column.
$table->mediumText('description');MEDIUMTEXT equivalent column.
$table->morphs('taggable');Adds taggable_id UNSIGNED BIGINT and taggable_type VARCHAR equivalent columns.
$table->uuidMorphs('taggable');Adds taggable_id CHAR(36) and taggable_type VARCHAR(255) UUID equivalent columns.
$table->multiLineString('positions');MULTILINESTRING equivalent column.
$table->multiPoint('positions');MULTIPOINT equivalent column.
$table->multiPolygon('positions');MULTIPOLYGON equivalent column.
$table->nullableMorphs('taggable');Adds nullable versions of morphs() columns.
$table->nullableUuidMorphs('taggable');Adds nullable versions of uuidMorphs() columns.
$table->nullableTimestamps(0);Alias of timestamps() method.
$table->point('position');POINT equivalent column.
$table->polygon('positions');POLYGON equivalent column.
$table->rememberToken();Adds a nullable remember_token VARCHAR(100) equivalent column.
$table->set('flavors', ['strawberry', 'vanilla']);SET equivalent column.
$table->smallIncrements('id');Auto-incrementing UNSIGNED SMALLINT (primary key) equivalent column.
$table->smallInteger('votes');SMALLINT equivalent column.
$table->softDeletes('deleted_at', 0);Adds a nullable deleted_at TIMESTAMP equivalent column for soft deletes with precision (total digits).
$table->softDeletesTz('deleted_at', 0);Adds a nullable deleted_at TIMESTAMP (with timezone) equivalent column for soft deletes with precision (total digits).
$table->string('name', 100);VARCHAR equivalent column with a length.
$table->text('description');TEXT equivalent column.
$table->time('sunrise', 0);TIME equivalent column with precision (total digits).
$table->timeTz('sunrise', 0);TIME (with timezone) equivalent column with precision (total digits).
$table->timestamp('added_on', 0);TIMESTAMP equivalent column with precision (total digits).
$table->timestampTz('added_on', 0);TIMESTAMP (with timezone) equivalent column with precision (total digits).
$table->timestamps(0);Adds nullable created_at and updated_at TIMESTAMP equivalent columns with precision (total digits).
$table->timestampsTz(0);Adds nullable created_at and updated_at TIMESTAMP (with timezone) equivalent columns with precision (total digits).
$table->tinyIncrements('id');Auto-incrementing UNSIGNED TINYINT (primary key) equivalent column.
$table->tinyInteger('votes');TINYINT equivalent column.
$table->unsignedBigInteger('votes');UNSIGNED BIGINT equivalent column.
$table->unsignedDecimal('amount', 8, 2);UNSIGNED DECIMAL equivalent column with a precision (total digits) and scale (decimal digits).
$table->unsignedInteger('votes');UNSIGNED INTEGER equivalent column.
$table->unsignedMediumInteger('votes');UNSIGNED MEDIUMINT equivalent column.
$table->unsignedSmallInteger('votes');UNSIGNED SMALLINT equivalent column.
$table->unsignedTinyInteger('votes');UNSIGNED TINYINT equivalent column.
$table->uuid('id');UUID equivalent column.
$table->year('birth_year');YEAR equivalent column.

Complete Laravel installation and API guide

How to install Laravel using composer

composer create-project laravel/laravel example-app

cd example-app

php artisan serve

Create View in Laravel

<!-- View stored in resources/views/home.blade.php -->

<html>
    <body>
        <h1>My Home Page {{ $name }}</h1>
    </body>
</html>


<!-- Route stored in routes/web.php -->


Route::get('/', function () {
    return view('greeting', ['name' => 'James']);
});

Create model, controller and view in Laravel

Step 1: Create model and controller

php artisan make:controller HomeController --resource --model=Home

Step 2: Create View in Laravel



<!-- View stored in resources/views/home.blade.php -->

<html>
    <body>
        <h1>My Home Page {{ $name }}</h1>
    </body>
</html>

Step 3: call controller using route and display view




<!-- Route stored in routes/web.php -->

Route::get('/home', 'App\Http\Controllers\HomeController@index');

or 

Route::get('/home', 'HomeController@index');

Note: changing the RouteServiceProvider.php file in App/Providers/ path by uncommenting the code.

protected $namespace = ‘App\Http\Controllers’;

Create and Rest Api in Laravel

php artisan make:controller ApiController

You will find a new file named ApiController.php in the app\http\controllers directory. Next, we can add the following methods:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class ApiController extends Controller
{
    public function sendResponse($result, $message)
  {
    $response = [
          'success' => true,
          'data'    => $result,
          'message' => $message,
      ];
   return response()->json($response, 200);
  }

  /**
     * return error response.
     *
     * @return \Illuminate\Http\Response
     */
    public function sendError($error, $errorMessages = [], $code = 404)
    {
    	$response = [
            'success' => false,
            'message' => $error,
        ];


        if(!empty($errorMessages)){
            $response['data'] = $errorMessages;
        }


        return response()->json($response, $code);
    }


//
    public function getList() {

      /*  $test = Test::get()->toJson(JSON_PRETTY_PRINT);
        return response($tests, 200);*/

      /*  return response()->json([
            "message" => "student record created"
        ], 201);*/

$data= array();     
          $data = DB::connection('default')->table('users')->where('id',$id)->get();
        return $this->sendResponse($data, 'Successfully');
        
      }
}

Proceed to the routes directory and open the api.php file and create the endpoints that will reference the methods created earlier in the ApiController

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

<!-- Route stored in routes/api.php -->

Route::get('getList', 'App\Http\Controllers\ApiController@getList');

or

Route::get('getList', 'ApiController@getList');

Test Api using Postman

Useful command for Laravel

composer dumpautoload

php artisan cache:clear

php artisan config:clear

php artisan view:clear

command php artisan list

 make:channel         Create a new channel class
  make:command         Create a new Artisan command
  make:controller      Create a new controller class
  make:event           Create a new event class
  make:exception       Create a new custom exception class
  make:factory         Create a new model factory
  make:job             Create a new job class
  make:listener        Create a new event listener class
  make:mail            Create a new email class
  make:middleware      Create a new middleware class
  make:migration       Create a new migration file
  make:model           Create a new Eloquent model class
  make:notification    Create a new notification class
  make:observer        Create a new observer class
  make:policy          Create a new policy class
  make:provider        Create a new service provider class
  make:request         Create a new form request class
  make:resource        Create a new resource
  make:rule            Create a new validation rule
  make:seeder          Create a new seeder class
  make:test            Create a new test class

how to install ftp server in ubuntu 20.04

Here we will install and configure vsftpd (Very Secure File Transfer Protocol Daemon) on Ubuntu.

Install vsftpd

Update the package list and dependencies for vsftpd. Then second command download and Install vsftpd.

$ sudo apt update && sudo apt install vsftpd

Check the status of vsftpd

$ sudo service vsftpd status
● vsftpd.service – vsftpd FTP server Loaded: loaded (/lib/systemd/system/vsftpd.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2020-04-27 19:35:30 IST; 13s ago Main PID: 54532 (vsftpd) Tasks: 1 (limit: 1137) Memory: 652.0K CGroup: /system.slice/vsftpd.service └─54532 /usr/sbin/vsftpd /etc/vsftpd.conf Apr 27 19:35:30 ubuntu systemd[1]: Starting vsftpd FTP server… Apr 27 19:35:30 ubuntu systemd[1]: Started vsftpd FTP server.

Configure Firewall

$ sudo ufw allow OpenSSH
$ sudo ufw allow 20/tcp
$ sudo ufw allow 21/tcp
$ sudo ufw allow 40000:50000/tcp
$ sudo ufw allow 990/tcp
$ sudo ufw enable
$ sudo ufw status
Status: active To Action From — —— —- OpenSSH ALLOW Anywhere Apache Full ALLOW Anywhere 3306 ALLOW Anywhere 20/tcp ALLOW Anywhere 21/tcp ALLOW Anywhere 40000:50000/tcp ALLOW Anywhere 990/tcp ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6) Apache Full (v6) ALLOW Anywhere (v6) 3306 (v6) ALLOW Anywhere (v6) 20/tcp (v6) ALLOW Anywhere (v6) 21/tcp (v6) ALLOW Anywhere (v6) 40000:50000/tcp (v6) ALLOW Anywhere (v6) 990/tcp (v6) ALLOW Anywhere (v6)

Create FTP User

$ sudo adduser ftpuser
$ sudo nano /etc/ssh/sshd_config
DenyUsers ftpuser
$ sudo service sshd restart

Directory Permissions

Upload to a Web Server

$ sudo usermod -d /var/www ftpuser
$ sudo chown ftpuser:ftpuser /var/www/html

 Upload to a Home Folder

$ sudo mkdir /home/ftpuser/ftp
$ sudo chown nobody:nogroup /home/ftpuser/ftp
$ sudo chmod a-w /home/ftpuser/ftp
$ sudo mkdir /home/ftpuser/ftp/files
$ sudo chown ftpuser:ftpuser /home/ftpuser/ftp/files

Configure vsftpd

$ sudo mv /etc/vsftpd.conf /etc/vsftpd.conf.bak
$ sudo nano /etc/vsftpd.conf
listen=NO
listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
force_dot_files=YES
pasv_min_port=40000
pasv_max_port=50000
user_sub_token=$USER
local_root=/home/$USER/ftp

We are done with vsftpd.conf

$ sudo systemctl restart vsftpd

Secure FTP with TLS (Recommended)

$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem
$ sudo nano /etc/vsftpd.conf
ssl_enable=YES
rsa_cert_file=/etc/ssl/private/vsftpd.pem
rsa_private_key_file=/etc/ssl/private/vsftpd.pem
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
require_ssl_reuse=NO
ssl_ciphers=HIGH
$ sudo systemctl restart vsftpd

Testing TLS with FileZilla

How to create static html page from dynamic php page

  • Opportunity to working on live project
  • Learn Advance topic in low cost
  • Get experience certificate
  • Learn Advance topic in limited time period
  • Get job opportunity
  • Topic cover on fast track
<?php
include ("include/conn.php");
error_reporting(E_ALL);
ini_set('display_errors', '1');
$cmdm="select * from satta_cms";
 $resultm=mysqli_query($link,$cmdm); 
 if($rowm=mysqli_fetch_array($resultm)){ 
	 $srno=$rowm['srno']; 
	 $message1=nl2br($rowm['message1']); 
	 $message2=nl2br($rowm['message2']); 
	 $message3=nl2br($rowm['message3']); } 
date_default_timezone_set('Asia/Kolkata');
$cmd1="select * from record"; $result1=mysqli_query($link,$cmd1);
 while($row1=mysqli_fetch_array($result1)){
	  $recno=$row1['recno'];
	 $tablename=$row1['tablename'];
			
 $cmd="select * from $tablename";
$result=mysqli_query($link,$cmd);
while($row=mysqli_fetch_array($result)){
	$recname=$row['recname'];
	$recdate=$row['recdate'];
	$rec=$row['new'];
	$recdispdate=date('d-M-Y',strtotime($recdate)); 
	ob_start();
?>
 
<!DOCTYPE html>
<html lang="en">
<head>
  <?php include('common/head.php'); ?>
 <style>
 h1.text-center {
    background-color: #000000;
    color: white !important;
    padding: 15px;
    text-align: center;
}
 </style>
  </head>
  <body>
<?php include('common/nav.php'); ?>


<div class="container">
<div class="row">
<?php include('common/advertise1.php'); ?>
<div class="col-lg-12"><h1 class="text-center"><?php echo date('d-M-Y',strtotime($recdate)); ?></h1></div>
<div class="live text-center">
    <h1><img src="satta-king.gif" width="70px"></h1>
 <div id="recbadge"> <h4 id="rectime"><?php echo $rec;?></h4><h2 id="recname" class="text-uppercase"><?php echo $recname;?></div>
 </div>

</div>
<hr>

</div>


<div class="container">
<div class="row">
<div class="col-lg-12">
<?php include('common/advertise0.php'); ?>
<?php include('common/message1.php'); ?>
<?php include('common/message2.php'); ?>
<?php include('common/message3.php'); ?>
    <?php include('common/advertise.php'); ?>
<?php //$cmd="select * from record order by rectime"; include('common/record-display.php');
?>
</div>
</div>
</div>
<?php
include('common/script.php');
 ?>

  </body>
</html>
<?php


$MainDir="satta-king-result";
 if(!is_dir($MainDir))
{
	mkdir($MainDir,0777);
}
$fileName=str_ireplace(' ','-',$recname).'-'.$recdispdate;

//
//$fp=fopen($MainDir.$QuestionId.".html","w");
$fp=fopen($MainDir."/".$fileName.".html","w");
$html = ob_get_contents();
fputs($fp,$html);


  } } ?>

how to change limit value 15 25 in opencart of category page

Change default 15 products per page on Category view

Goto Extensions in Extensions in opencart, Choose the extension type Theme

Click on edit button and change below listed value

For views change value from category.php from controller directory

	$data['limits'] = array();

			$limits = array_unique(array($this->config->get('theme_' . $this->config->get('config_theme') . '_product_limit'), 25, 50, 75, 100));

			sort($limits);

BMW R 1250 GS bike

BMW R 1250 GS bike launched at Rs. 20.45 lakh

08 Jul 2021: BMW R 1250 GS bike launched at Rs. 20.45 lakh

BMW Motorrad India has launched the all-new R 1250 GS motorbike in India. It has been priced starting at Rs. 20.45 lakh and is offered in two variants of R 1250 GS Pro and R 1250 GS Adventure Pro. The duo arrives via the Completely Built Up (CBU) route and runs on a BS6-compliant 1,254cc engine linked to a 6-speed gearbox. Here’s our roundup.

Design: The bikes house an all-LED lighting setup

The BMW R 1250 GS Pro and Adventure Pro feature an aggressive design with a sloping fuel tank, an upswept exhaust, and an adjustable transparent windscreen. They also sport a full-LED lighting setup, a TFT color display with support for Bluetooth connectivity, and ride on 19-inch front and 17-inch rear wheels. The vehicles are available in Style Triple Black and Style Rallye color options.

Fact: A 134hp, 1,254cc engine fuels the motorcycles

The BMW R 1250 GS Pro and Adventure Pro draw power from a 1,254cc, air/liquid-cooled, flat-twin engine that is tuned to make 134hp of power at 7,750rpm and 143Nm of peak torque at 6,250rpm. Transmission duties are handled by a 6-speed gearbox.

Safety: Disc brakes are offered for the rider’s safety

The BMW R 1250 GS Pro and Adventure Pro are equipped with disc brakes on both the wheels, along with ABS Pro, traction control and hill start control. They also offer three riding modes: Eco, Road, and Rain. Suspension duties are taken care of by a central spring strut on the front and a single-sided swing arm with BMW Paralever on the rear end.

Fact: BMW R 1250 GS Pro, Adventure Pro: Pricing and availability

The BMW R 1250 GS motorbike carries a price-tag of Rs. 20.45 lakh for the GS Pro model and Rs. 22.40 lakh for the GS Adventure Pro variant (both prices, ex-showroom). A limited-run ’40 Years GS’ edition is also expected to arrive in India.

IPHONE 13, 13 PRO, 13 PRO MAX

IPHONE 13, 13 PRO, 13 PRO MAX, AND 13 MINI WILL BE THE 2021 IPHONE, SAY APPLE SUPPLIERS

In not so surprising news, the 2021 iPhone models will be called the iPhone 13, iPhone 13 Pro, iPhone 13 Pro Max, and iPhone 13 mini. According to Economic Daily News, Apple is going to follow last year’s naming convention to name this year’s iPhone model. This may not seem like a big thing, but it paints a picture of what Apple has planned for this year’s iPhone. iPhone 13 means Apple is not going to stray away from the increasing order of numbers for the iPhone anytime soon.

Economic Daily News has cited supply chains to report that the 2021 iPhone would be called the iPhone 13. The iPhone 13 will succeed over the iPhone 12, the iPhone 13 Pro will take things forward from the iPhone 12 Pro, the iPhone 12 Pro Max will have the iPhone 13 Pro Max as the successor, and the iPhone 13 mini will be the successor to the iPhone 12 mini. The “mini” model is specifically interesting because Apple is moving ahead with it this year despite not having good luck with the sales of the cheapest and smallest iPhone model from last year’s series.

Foxconn (Hon Hai) is going to be a major manufacturer of the iPhone 13 series. In addition to manufacturing the iPhone 13 mini, Foxconn is in the process of fulfilling orders for the iPhone 13, the iPhone 13 Pro, and the iPhone 13 Pro Max. Apple has other manufacturers, as well, for the iPhone 13 series. Pegatron, the Taiwanese manufacturer of the iPhone, is back to business after being put on probation last year for violating Apple’s code of conduct for suppliers by asking students to work overtime and night shifts.

The reason why the name iPhone 13 is a bigger deal than you think is the belief of people in triskaidekaphobia, which is the fear of the number 13. According to Macrumors, a recent survey showed one out of five iPhone and iPad users are not in favour of the iPhone 13 as the name for the next iPhone model. At the same time, 38 per cent of the participants recommended Apple should drop these numbers altogether and go for names that have the corresponding year of launch in them. For example, iPhone 2021 should be the name for this year’s iPhone. It makes sense to go with the easy nomenclature here, but Apple is unlikely to heed this.

Besides iPhone 13, this year’s iPhone may also be known as iPhone 12S, according to previous rumours. That belief stems from the fact that Apple has launched “S” models previously, but that is only to denote smaller upgrades in the iPhone over its previous generation. Notably, Apple did not launch iPhone 11S because last year’s iPhone brought a radical design change. Since this year’s iPhone is likely to undergo incremental upgrades over the iPhone 12, some rumours suggested it will end up being launched as the iPhone 12S. The iPhone this year is likely to have a bigger camera, a 120Hz ProMotion AMOLED display, and a better processor.

[Read More…]

Developer Setup: High Availability & Multiconnect

Developer Setup: High Availability & Multiconnect

This document shows you how to set up a High Availability cluster on a developer machine. It also provides guidance on how to enable Multiconnect on top of that as well as the changes required for a highly available Multiconnect cluster. For a production setup, follow the relevant instructions listed in Production Setups.

Before you start any of these set ups, check our list of requirements.

To set up a High Availability cluster follow these steps:

  1. Create a biz Directory for the setup scripts
  2. Get the WhatsApp Business API Client configuration files
  3. Set the WA_API_VERSION environment variable
  4. Start the WhatsApp Business API Client with High Availability
  5. Verify containers are running
  6. Perform a health check
  7. Register the WhatsApp Business API Client
  8. Perform a second health check

To set up a Multiconnect cluster follow these steps:

  1. Set up two shards
  2. Perform a health check
  3. Start a third coreapp to maintain High Availability
  4. Perform a second health check