Categories
Laravel

Upgrade from Laravel 6 to Laravel 8 ?

#1 – Make sure the composer.json looks like this

"require": {
   "php": "^7.2",
   "fideloper/proxy": "^4.0",
   "laravel/framework": "^8.0",
   "laravel/passport": "^10.0",
   "laravel/socialite": "^5.0",
   "laravel/tinker": "^2.0",
   "laravel/ui": "^3.0",
   "predis/predis": "^1.1"
},
"require-dev": {
   "facade/ignition": "^2.3.6",
   "mockery/mockery": "^1.0",
   "nunomaduro/collision": "^5.0",
   "phpunit/phpunit": "^9"
}

#2 – if you see following issue

laravel/framework replaces illuminate/support and thus cannot coexist with it.

Remove remove illuminate/support

composer remove illuminate/support

#3 – The report, render, shouldReport, and renderForConsole methods of your application’s App\Exceptions\Handler class should accept instances of the Throwable interface instead of Exception instances: Change app/Exceptions/Handler.php as follow

<?php

namespace App\Exceptions;

use Throwable;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler
{
   /**
    * A list of the exception types that are not reported.
    *
    * @var array
    */
   protected $dontReport = [
       //
   ];

   /**
    * A list of the inputs that are never flashed for validation exceptions.
    *
    * @var array
    */
   protected $dontFlash = [
       'password',
       'password_confirmation',
   ];

   /**
    * Report or log an exception.
    *
    * @param  \Throwable  $exception
    * @return void
    */
   public function report(Throwable $exception)
   {
       parent::report($exception);
   }

   /**
    * Render an exception into an HTTP response.
    *
    * @param  \Illuminate\Http\Request  $request
    * @param  \Throwable  $exception
    * @return \Illuminate\Http\Response
    */
   public function render($request, Throwable $exception)
   {
       return parent::render($request, $exception);
   }
}

Helper additional issue

php artisan config:clear
php artisan key:generate
php artisan config:clear
Categories
API Web API

RESTFUL API – HTTP CODE 422 – Unprocessable Entity

The HyperText Transfer Protocol (HTTP) 422 Unprocessable Entity response status code indicates that the server understands the content type of the request entity, and the syntax of the request entity is correct, but it was unable to process the contained instructions.

Categories
General

Error: Cannot find module ‘read-pkg-up’

All issues such as

Error: Cannot find module 'interpret'
Error: Cannot find module 'read-pkg-up'
Error: Cannot find module 'lru-cache'

Solution

delete package-lock.json
npm upgrade

Categories
General Satori Architect

How to fix Satori 80004005 error ?

MRE1=92 -2147467259 SaveReport failed to save the file "0429C038" for report 364. (error 80004005)

Make Sure All parameters are passed

satoriTemplateClass  standard-letter
records_count        287 
permit_number        892 
piece_height         8.5 
piece_weight          0
piece_width           0 
piece_thickness       0.0294 
post_office_drop_date  2021-03-24 
presort_class          standard 
post_office_drop_date. 2021-03-24 

postage category

- letter
- flat
- postcard
  

presort class

firstClass 
standard 
nonprofit 
Categories
General

How to Install Serverless on a Mac ?

Install Node server

brew install node

Install serverless

npm install -g serverless

Configure Serverless

serverless config credentials --provider aws -o --key XXXXXXXXXXXXXXXXX --secret XXXXXXXXXXXXXXXXXX

Serverless Login

serverless login

Serverless Deploy

serverless deploy


Categories
Technical

brew Error: Directory not empty @ dir_s_rmdir – /private/tmp/d20210315-27447-1b2auy5

chown davidr:wheel /private/tmp/

fixed my issue

Categories
BEST PHP CODE

Force PHP ERRORS

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
Categories
General

Install Node NPM on mac

brew install node

Categories
General

REDIS LARAVEL ConnectionException Error while reading line from the server.

Redis connection issue laravel Fix due to SSL read error on connection

Database config: config/database.php

'redis' => [
        'client' => 'predis',
        'cluster' => false,

        'default' => [
            'scheme'   => env('REDIS_SCHEME', 'tls'),
            'host'     => env('REDIS_HOST', 'localhost'),
            'password' => env('REDIS_PASSWORD', null),
            'port'     => env('REDIS_PORT', 6379),
            'database' => 0,
        ],
        'cache' => [
            'scheme'   => env('REDIS_SCHEME', 'tls'),
            'host'     => env('REDIS_HOST', 'localhost'),
            'password' => env('REDIS_PASSWORD', null),
            'port'     => env('REDIS_PORT', 6379),
            'database' => 1,
        ],
        'queue' => [
            'scheme'   => env('REDIS_SCHEME', 'tls'),
            'host'     => env('REDIS_HOST', 'localhost'),
            'password' => env('REDIS_PASSWORD', null),
            'port'     => env('REDIS_PORT', 6379),
            'database' => 2,
        ],
        'options' => [
            'parameters' => [
                'password' => env('REDIS_PASSWORD', null),
            ],
        ],
    ]
Categories
REDIS

Redis MAC

brew update
brew install redis

To Start

brew services start redis

to stop 

brew services stop redis

Or, if you don’t want/need a background service you can just run:

redis-server /usr/local/etc/redis.conf

Test if Redis server is running.

redis-cli ping

If it replies “PONG”, then it’s good to go!

Location of Redis configuration file.

/usr/local/etc/redis.conf

Uninstall Redis and its files.

brew uninstall redis
rm ~/Library/LaunchAgents/homebrew.mxcl.redis.plist