Posts

Job/Schedule Command in Laravel

1. app/console/kerne.php     protected $commands = [         SalesClaimConfirmation::class,     ];     protected function schedule(Schedule $schedule)     {         // One way         $schedule->command('job:sales-claim-confirmation')->everyMinute();                  // Another way         $schedule->call('App\Console\Commands\SalesClaimConfirmation@handle')->everyMinute();     } 2. app/console/commands/SalesClaimConfirmation.php       // The name and signature of the console command.      protected $signature = 'job:sales-claim-confirmation';       // The console command description.      protected $description = 'Agent sales claim confirmation';     // Execute the console command.       publ...

Export MySQL database from terminal

1. Export Database mysqldump -u root -p database_name > /home/ubuntu/database_name.sql 2. Download Database scp ubuntu@192.168.0.01:/home/ubuntu/database_name.sql /home/shahlal/Desktop

Virtual host setup in XAMPP for Laravel Project

1. C:\xampp\apache\conf\https.conf # Virtual hosts Include conf/extra/httpd-vhosts.conf 2. C:\Windows\System32\drivers\etc\hosts 127.0.0.1       localhost 127.0.0.1       helpdesk.local 127.0.0.1       teledaktar.local 3. C:\xampp\apache\conf\extra\httpd-vhosts.conf <VirtualHost *:80>     DocumentRoot "C:/xampp/htdocs/helpdesk/public"     ServerName helpdesk.local </VirtualHost> <VirtualHost *:80>     DocumentRoot "C:/xampp/htdocs/teledaktar/public"     ServerName teledaktar.local </VirtualHost> Now,  URL 1 :   http://helpdesk.local URL 2 :   http://teledaktar.local

API - Few types of API

Web Service APIs SOAP (Simple Object Access Protocol) XML-RPC (Extensible Markup Language - Remote Procedure Call) JSON-RPC (JavaScript Object Notation -  Remote Procedure Call ) REST (REpresentational State Transfer) OS Functional APIs Access to file system Access to User Interface Hardware APIs Video Acceleration Hard disk drivers PCI Busses (Peripheral Component Interconnect Busses)

Password set for root user in MySQL

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');

Laravel Event Listener for keeping history

App\Providers\EventServiceProvider.php protected $listen = [     'App\Events\ResolveHistoryEvent'=>[         'App\Listeners\ResolveHistoryEventListener'     ] ]; php artisan event:generate App\Modules\Tickets\Controllers\TicketsController.php public function reopenTicket($ticketId){     $ticket = Tickets::find($ticketId);     $ticket->resolve_status = 2;     $ticket->reopen_time = Carbon::now();     $ticket->save();     event(new ResolveHistoryEvent($ticket));     return redirect('tickets/active-list')->with('flash_success','Ticket reopen successfully!'); } App\Events\ResolveHistoryEvent.php public $resolveHistory; public function __construct($ticket) {     $this->resolveHistory = $ticket; } App\Listeners\ResolveHistoryEventListener.php public function recordTicketResolveHistory($ticket){     $resolveHi...

WP register_post_type() with custom CMB2 meta box

functions.php register_post_type('portfolio',[ 'labels'=>[ 'name'=> 'Portfolio', 'add_new_item'=>'Add new portfolio', 'view_item'=>'View portfolio', ], 'public'=>true, 'menu_icon'=>'dashicons-edit', 'menu_position'=>1, 'supports'=> ['title','editor','thumbnail'] ]); custom.php add_action('cmb2_admin_init','custom_metaboxes'); function custom_metaboxes(){ $portfolioMetaBox = new_cmb2_box([ 'object_types'=>['portfolio'], 'id'=>'portfolio-additional-fields', 'title'=>'Portfolio Additional Fields' ]); $portfolioMetaBox->add_field([ 'id'=>'portfolio_designation', 'name'=>'Portfoilo Designation', 'type'=>'text' ]); $portfolioMetaBox->add_field([ ...