max value validation in laravel / php

       $request->validate([
          'amount' => 'required|numeric|max:9999999999',  
          'date' => 'required',  
          'description' => 'required|max:200',        
      ]); 

migrate specific folder Laravel

php artisan migrate --path=/database/migrations/employee
php artisan migrate --path=/database/migrations/student

when is php 7.4 end of life

PHP 7.4 goes end of life (EOL) on the 28 November 2022 meaning known security flaws will no longer be fixed and sites are exposed to significant security vulnerabilities. It is important to update them to a newer version.

PHP 7.4, the next PHP 7 minor release, has been released for General Availability as of November 28th, 2019.

get auth details in laravel

use App\Models\User;
use Auth;

if (Auth::check()) {
$user = Auth::user();
$user_id = $user->id;
}

create stdclass object laravel

use \stdClass;

$data = array();   
$object = new stdClass();
$object->business_id= '';
$object->phone_number_id= '';
$object->recipient_phone_number= '';
$object->user_access_token= '';
$object->waba_id= '';
$object->version= '';
$data[0] = $object;

create two unique columns in laravel

The second param is to manually set the name of the unique index. Use an array as the first param to create a unique key across multiple columns.

$table->unique(array('mytext', 'user_id'));
$table->unique(['mytext', 'user_id']);
   Schema::create('cal_like', function (Blueprint $table) {
            $table->id();          
            $table->string('module',250)->nullable();
            $table->bigInteger('module_id')->nullable();
            $table->bigInteger('user_id')->nullable();
            $table->unique(array('module_id', 'user_id'));
            $table->timestamps();
        });

PHP Deprecated: urldecode(): Passing null to parameter #1 in laravel server.php

Existing Code

<?php

/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell <taylor@laravel.com>
 */
$uri = urldecode(
    parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);

// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
    return false;
}

require_once __DIR__.'/public/index.php';

Existing Code Replace with

<?php

/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell <taylor@laravel.com>
 */
if(isset($_SERVER['REQUEST_URI'])){$uri = urldecode(
    parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);}


// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
    return false;
}

require_once __DIR__.'/public/index.php';

decimal to integer group by query in laravel

 $chapter= array();
  $chapter = DB::table('Table_Name')->select( DB::raw('format(number,0) as chapter'), DB::raw('count(*) as total'))->groupBy(\DB::raw('format(number,0)'))->get();