1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-23 16:24:29 +00:00
pixelfed/app/Console/Commands/UserShow.php

59 lines
1.3 KiB
PHP
Raw Normal View History

2019-03-01 19:16:15 +00:00
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\User;
class UserShow extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'user:show {id}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Show user info';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$id = $this->argument('id');
if(ctype_digit($id) == true) {
$user = User::find($id);
} else {
$user = User::whereUsername($id)->first();
}
2019-03-01 19:16:15 +00:00
if(!$user) {
$this->error('Could not find any user with that username or id.');
exit;
}
$this->info('User ID: ' . $user->id);
$this->info('Username: ' . $user->username);
$this->info('Email: ' . $user->email);
$this->info('Joined: ' . $user->created_at->diffForHumans());
$this->info('Status Count: ' . $user->statuses()->count());
}
}