Page MenuHomePhorge

UserRestore.php
No OneTemporary

Authored By
Unknown
Size
916 B
Referenced Files
None
Subscribers
None

UserRestore.php

<?php
namespace App\Console\Commands;
use App\Console\Command;
use Illuminate\Support\Facades\DB;
class UserRestore extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'user:restore {user}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Restore (undelete) a user';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$user = $this->getUser($this->argument('user'), true);
if (!$user) {
$this->error('User not found.');
return 1;
}
if (!$user->trashed()) {
$this->error('The user is not yet deleted.');
return 1;
}
DB::beginTransaction();
$user->restore();
DB::commit();
}
}

File Metadata

Mime Type
text/x-php
Expires
Fri, Apr 24, 1:56 PM (6 d, 5 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18792723
Default Alt Text
UserRestore.php (916 B)

Event Timeline