for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Spatie\ServerMonitor\Commands;
class DeleteHost extends BaseCommand
{
protected $signature = 'server-monitor:delete-host
{name : The name of the host to be deleted}';
protected $description = 'Delete a host';
public function handle()
$name = $this->argument('name');
$host = $this->determineHostModelClass()::where('name', $name)->first();
where
$this->determineHostModelClass()
string
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.
if (! $host) {
return $this->error("Host with name `{$name}` not found.");
}
if (! $this->confirm("Are you sure you wish to delete `{$name}`?")) {
return;
$host->delete();
$this->info("Host `{$name}` was deleted!");
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.