You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think we can make a console that load wordpress if we explicit inherit the class.
The example below is perfect combined with the console stub generator by @tipytechnique on the PR with small adjustment
The parent class that load wordpress:
<?php
namespace Themosis\Core\Console;
use Illuminate\Console\Command;
class WordPress extends Command
{
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
require_once web_path('cms/wp-load.php');
}
}
And our custom command:
<?php
namespace App\Console\Commands\WordPress;
use Themosis\Core\Console\WordPress;
class PullProduct extends WordPress
{
/**
* The console command name.
*
* @var string
*/
protected $signature = 'wordpress:pull-product';
/**
* The console command description.
*
* @var string
*/
protected $description = 'pull published product from erp';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
dd(get_users());
return 0;
}
}
Hi @jlambe ,
I think we can make a console that load wordpress if we explicit inherit the class.
The example below is perfect combined with the console stub generator by @tipytechnique on the PR with small adjustment
The parent class that load wordpress:
And our custom command:
Originally posted by @oxyrealm-dev in #706 (comment)
The text was updated successfully, but these errors were encountered: