1
|
|
|
<?php namespace Arcanesoft\Auth\Http\Controllers\Admin; |
2
|
|
|
|
3
|
|
|
use Arcanesoft\Auth\Models\PasswordReset; |
4
|
|
|
use Arcanesoft\Auth\Policies\PasswordResetsPolicy; |
5
|
|
|
|
6
|
|
|
/** |
7
|
|
|
* Class PasswordResetsController |
8
|
|
|
* |
9
|
|
|
* @package Arcanesoft\Auth\Http\Controllers\Admin |
10
|
|
|
* @author ARCANEDEV <[email protected]> |
11
|
|
|
*/ |
12
|
|
|
class PasswordResetsController extends Controller |
13
|
|
|
{ |
14
|
|
|
/* ------------------------------------------------------------------------------------------------ |
15
|
|
|
| Properties |
16
|
|
|
| ------------------------------------------------------------------------------------------------ |
17
|
|
|
*/ |
18
|
|
|
/** @var int */ |
19
|
|
|
protected $perPage = 30; |
20
|
|
|
|
21
|
|
|
/* ------------------------------------------------------------------------------------------------ |
22
|
|
|
| Constructor |
23
|
|
|
| ------------------------------------------------------------------------------------------------ |
24
|
|
|
*/ |
25
|
|
|
/** |
26
|
|
|
* PasswordResetsController constructor. |
27
|
|
|
*/ |
28
|
|
|
public function __construct() |
29
|
|
|
{ |
30
|
|
|
parent::__construct(); |
31
|
|
|
|
32
|
|
|
$this->setCurrentPage('auth-password-resets'); |
33
|
|
|
$this->addBreadcrumbRoute('Password Resets', 'admin::auth.password-resets.index'); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/* ------------------------------------------------------------------------------------------------ |
37
|
|
|
| Main Functions |
38
|
|
|
| ------------------------------------------------------------------------------------------------ |
39
|
|
|
*/ |
40
|
|
|
public function index() |
41
|
|
|
{ |
42
|
|
|
$this->authorize(PasswordResetsPolicy::PERMISSION_LIST); |
43
|
|
|
|
44
|
|
|
$resets = PasswordReset::with(['user']) |
45
|
|
|
->orderBy('created_at', 'desc') |
46
|
|
|
->paginate($this->perPage); |
47
|
|
|
|
48
|
|
|
$this->setTitle($title = 'List of password resets'); |
49
|
|
|
$this->addBreadcrumb($title); |
50
|
|
|
|
51
|
|
|
return $this->view('admin.password-resets.list', compact('resets')); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function delete() |
55
|
|
|
{ |
56
|
|
|
parent::onlyAjax(); |
|
|
|
|
57
|
|
|
|
58
|
|
|
$this->authorize(PasswordResetsPolicy::PERMISSION_DELETE); |
59
|
|
|
|
60
|
|
|
return response()->json([]); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function clear() |
64
|
|
|
{ |
65
|
|
|
parent::onlyAjax(); |
|
|
|
|
66
|
|
|
|
67
|
|
|
$this->authorize(PasswordResetsPolicy::PERMISSION_DELETE); |
68
|
|
|
|
69
|
|
|
PasswordReset::getTokenRepository()->deleteExpired(); |
70
|
|
|
|
71
|
|
|
return response()->json(['status' => 'success']); |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.