1
|
|
|
<?php namespace Arcanesoft\Auth\Http\Controllers\Foundation; |
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\Foundation |
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', 'auth::foundation.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
|
|
|
$title = 'List of password resets'; |
49
|
|
|
$this->setTitle($title); |
50
|
|
|
$this->addBreadcrumb($title); |
51
|
|
|
|
52
|
|
|
return $this->view('foundation.password-resets.list', compact('resets')); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
public function delete() |
56
|
|
|
{ |
57
|
|
|
parent::onlyAjax(); |
|
|
|
|
58
|
|
|
|
59
|
|
|
$this->authorize(PasswordResetsPolicy::PERMISSION_DELETE); |
60
|
|
|
|
61
|
|
|
return response()->json([]); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function clear() |
65
|
|
|
{ |
66
|
|
|
parent::onlyAjax(); |
|
|
|
|
67
|
|
|
|
68
|
|
|
$this->authorize(PasswordResetsPolicy::PERMISSION_DELETE); |
69
|
|
|
|
70
|
|
|
PasswordReset::getTokenRepository()->deleteExpired(); |
71
|
|
|
|
72
|
|
|
return response()->json(['status' => 'success']); |
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
|
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.