for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Djunehor\EventRevert;
use Illuminate\Console\Command;
class RevertModelEvent extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'model:revert {--i|id=}';
* The console command description.
protected $description = 'Revert specific Model Event by specifying the Log ID';
* Create a new command instance.
* @return void
@return
Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.
Please refer to the PHP core documentation on constructors.
public function __construct()
parent::__construct();
}
* Execute the console command.
public function handle()
$id = $this->option('id');
$log = ModelLog::find($id);
if (! $id) {
$this->error('Log not found!');
return;
$revert = model_event_revert($log);
if (! $revert['status']) {
$this->error($revert['message']);
$this->info("Model Event #$log->id has been reverted successfully");
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.