@@ -4,37 +4,37 @@ |
||
4 | 4 | |
5 | 5 | class OauthClientRepository extends AbstractRepository |
6 | 6 | { |
7 | - /** |
|
8 | - * Return the model full namespace. |
|
9 | - * |
|
10 | - * @return string |
|
11 | - */ |
|
12 | - protected function getModel() |
|
13 | - { |
|
14 | - return 'App\Modules\V1\Acl\OauthClient'; |
|
15 | - } |
|
7 | + /** |
|
8 | + * Return the model full namespace. |
|
9 | + * |
|
10 | + * @return string |
|
11 | + */ |
|
12 | + protected function getModel() |
|
13 | + { |
|
14 | + return 'App\Modules\V1\Acl\OauthClient'; |
|
15 | + } |
|
16 | 16 | |
17 | - /** |
|
18 | - * Revoke the given client. |
|
19 | - * |
|
20 | - * @param integer $clientId |
|
21 | - * @return void |
|
22 | - */ |
|
23 | - public function revoke($clientId) |
|
24 | - { |
|
25 | - $client = $this->find($clientId); |
|
26 | - $client->tokens()->update(['revoked' => true]); |
|
27 | - $this->save(['id'=> $clientId, 'revoked' => true]); |
|
28 | - } |
|
17 | + /** |
|
18 | + * Revoke the given client. |
|
19 | + * |
|
20 | + * @param integer $clientId |
|
21 | + * @return void |
|
22 | + */ |
|
23 | + public function revoke($clientId) |
|
24 | + { |
|
25 | + $client = $this->find($clientId); |
|
26 | + $client->tokens()->update(['revoked' => true]); |
|
27 | + $this->save(['id'=> $clientId, 'revoked' => true]); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Un revoke the given client. |
|
32 | - * |
|
33 | - * @param integer $clientId |
|
34 | - * @return void |
|
35 | - */ |
|
36 | - public function unRevoke($clientId) |
|
37 | - { |
|
38 | - $this->save(['id'=> $clientId, 'revoked' => false]); |
|
39 | - } |
|
30 | + /** |
|
31 | + * Un revoke the given client. |
|
32 | + * |
|
33 | + * @param integer $clientId |
|
34 | + * @return void |
|
35 | + */ |
|
36 | + public function unRevoke($clientId) |
|
37 | + { |
|
38 | + $this->save(['id'=> $clientId, 'revoked' => false]); |
|
39 | + } |
|
40 | 40 | } |
@@ -8,44 +8,44 @@ |
||
8 | 8 | |
9 | 9 | class OauthClientsController extends BaseApiController |
10 | 10 | { |
11 | - /** |
|
12 | - * The name of the model that is used by the base api controller |
|
13 | - * to preform actions like (add, edit ... etc). |
|
14 | - * @var string |
|
15 | - */ |
|
16 | - protected $model = 'oauthClients'; |
|
11 | + /** |
|
12 | + * The name of the model that is used by the base api controller |
|
13 | + * to preform actions like (add, edit ... etc). |
|
14 | + * @var string |
|
15 | + */ |
|
16 | + protected $model = 'oauthClients'; |
|
17 | 17 | |
18 | - /** |
|
19 | - * The validations rules used by the base api controller |
|
20 | - * to check before add. |
|
21 | - * @var array |
|
22 | - */ |
|
23 | - protected $validationRules = [ |
|
24 | - 'name' => 'required|max:255', |
|
25 | - 'redirect' => 'required|url', |
|
26 | - 'user_id' => 'required|exists:users,id', |
|
27 | - 'revoked' => 'boolean' |
|
28 | - ]; |
|
18 | + /** |
|
19 | + * The validations rules used by the base api controller |
|
20 | + * to check before add. |
|
21 | + * @var array |
|
22 | + */ |
|
23 | + protected $validationRules = [ |
|
24 | + 'name' => 'required|max:255', |
|
25 | + 'redirect' => 'required|url', |
|
26 | + 'user_id' => 'required|exists:users,id', |
|
27 | + 'revoked' => 'boolean' |
|
28 | + ]; |
|
29 | 29 | |
30 | - /** |
|
31 | - * Revoke the given client. |
|
32 | - * |
|
33 | - * @param integer $clientId Id of the client |
|
34 | - * @return \Illuminate\Http\Response |
|
35 | - */ |
|
36 | - public function revoke($clientId) |
|
37 | - { |
|
38 | - return \Response::json($this->repo->revoke($clientId), 200); |
|
39 | - } |
|
30 | + /** |
|
31 | + * Revoke the given client. |
|
32 | + * |
|
33 | + * @param integer $clientId Id of the client |
|
34 | + * @return \Illuminate\Http\Response |
|
35 | + */ |
|
36 | + public function revoke($clientId) |
|
37 | + { |
|
38 | + return \Response::json($this->repo->revoke($clientId), 200); |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * Un revoke the given client. |
|
43 | - * |
|
44 | - * @param integer $clientId Id of the client |
|
45 | - * @return \Illuminate\Http\Response |
|
46 | - */ |
|
47 | - public function unRevoke($clientId) |
|
48 | - { |
|
49 | - return \Response::json($this->repo->unRevoke($clientId), 200); |
|
50 | - } |
|
41 | + /** |
|
42 | + * Un revoke the given client. |
|
43 | + * |
|
44 | + * @param integer $clientId Id of the client |
|
45 | + * @return \Illuminate\Http\Response |
|
46 | + */ |
|
47 | + public function unRevoke($clientId) |
|
48 | + { |
|
49 | + return \Response::json($this->repo->unRevoke($clientId), 200); |
|
50 | + } |
|
51 | 51 | } |
@@ -13,14 +13,14 @@ |
||
13 | 13 | * to preform actions like (add, edit ... etc). |
14 | 14 | * @var string |
15 | 15 | */ |
16 | - protected $model = 'oauthClients'; |
|
16 | + protected $model = 'oauthClients'; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * The validations rules used by the base api controller |
20 | 20 | * to check before add. |
21 | 21 | * @var array |
22 | 22 | */ |
23 | - protected $validationRules = [ |
|
23 | + protected $validationRules = [ |
|
24 | 24 | 'name' => 'required|max:255', |
25 | 25 | 'redirect' => 'required|url', |
26 | 26 | 'user_id' => 'required|exists:users,id', |
@@ -5,105 +5,105 @@ |
||
5 | 5 | |
6 | 6 | class LoginProxy |
7 | 7 | { |
8 | - private $apiConsumer; |
|
9 | - |
|
10 | - private $auth; |
|
11 | - |
|
12 | - private $db; |
|
13 | - |
|
14 | - private $request; |
|
15 | - |
|
16 | - private $userRepository; |
|
17 | - |
|
18 | - public function __construct(Application $app) |
|
19 | - { |
|
20 | - |
|
21 | - $this->userRepository = $app->make('App\Modules\V1\Acl\Repositories\UserRepository'); |
|
22 | - $this->apiConsumer = $app->make('apiconsumer'); |
|
23 | - $this->auth = $app->make('auth'); |
|
24 | - $this->db = $app->make('db'); |
|
25 | - $this->request = $app->make('request'); |
|
26 | - } |
|
27 | - |
|
28 | - /** |
|
29 | - * Attempt to create an access token using user credentials. |
|
30 | - * |
|
31 | - * @param array $credentials |
|
32 | - * @param boolean $adminLogin |
|
33 | - * @return array |
|
34 | - */ |
|
35 | - public function login($credentials, $adminLogin = false) |
|
36 | - { |
|
37 | - $this->userRepository->login($credentials, $adminLogin); |
|
38 | - |
|
39 | - return $this->proxy('password', [ |
|
40 | - 'username' => $credentials['email'], |
|
41 | - 'password' => $credentials['password'] |
|
42 | - ]); |
|
43 | - } |
|
44 | - |
|
45 | - /** |
|
46 | - * Attempt to refresh the access token useing the given refresh token. |
|
47 | - * |
|
48 | - * @param string $refreshToken |
|
49 | - * @return array |
|
50 | - */ |
|
51 | - public function refreshtoken($refreshToken) |
|
52 | - { |
|
53 | - return $this->proxy('refresh_token', [ |
|
54 | - 'refresh_token' => $refreshToken |
|
55 | - ]); |
|
56 | - } |
|
57 | - |
|
58 | - /** |
|
59 | - * Proxy a request to the OAuth server. |
|
60 | - * |
|
61 | - * @param string $grantType what type of grant type should be proxied |
|
62 | - * @param array |
|
63 | - */ |
|
64 | - public function proxy($grantType, array $data = []) |
|
65 | - { |
|
66 | - $data = array_merge($data, [ |
|
67 | - 'client_id' => env('PASSWORD_CLIENT_ID'), |
|
68 | - 'client_secret' => env('PASSWORD_CLIENT_SECRET'), |
|
69 | - 'grant_type' => $grantType |
|
70 | - ]); |
|
71 | - |
|
72 | - $response = $this->apiConsumer->post('/oauth/token', $data); |
|
73 | - |
|
74 | - if ( ! $response->isSuccessful()) |
|
75 | - { |
|
76 | - if ($grantType == 'refresh_token') |
|
77 | - { |
|
78 | - \ErrorHandler::invalidRefreshToken(); |
|
79 | - } |
|
80 | - |
|
81 | - \ErrorHandler::loginFailed(); |
|
82 | - } |
|
83 | - |
|
84 | - $data = json_decode($response->getContent()); |
|
85 | - |
|
86 | - return [ |
|
87 | - 'access_token' => $data->access_token, |
|
88 | - 'refresh_token' => $data->refresh_token, |
|
89 | - 'expires_in' => $data->expires_in |
|
90 | - ]; |
|
91 | - } |
|
92 | - |
|
93 | - /** |
|
94 | - * Logs out the user. We revoke access token and refresh token. |
|
95 | - */ |
|
96 | - public function logout() |
|
97 | - { |
|
98 | - $accessToken = $this->auth->user()->token(); |
|
99 | - |
|
100 | - $this->db |
|
101 | - ->table('oauth_refresh_tokens') |
|
102 | - ->where('access_token_id', $accessToken->id) |
|
103 | - ->update([ |
|
104 | - 'revoked' => true |
|
105 | - ]); |
|
106 | - |
|
107 | - $accessToken->revoke(); |
|
108 | - } |
|
8 | + private $apiConsumer; |
|
9 | + |
|
10 | + private $auth; |
|
11 | + |
|
12 | + private $db; |
|
13 | + |
|
14 | + private $request; |
|
15 | + |
|
16 | + private $userRepository; |
|
17 | + |
|
18 | + public function __construct(Application $app) |
|
19 | + { |
|
20 | + |
|
21 | + $this->userRepository = $app->make('App\Modules\V1\Acl\Repositories\UserRepository'); |
|
22 | + $this->apiConsumer = $app->make('apiconsumer'); |
|
23 | + $this->auth = $app->make('auth'); |
|
24 | + $this->db = $app->make('db'); |
|
25 | + $this->request = $app->make('request'); |
|
26 | + } |
|
27 | + |
|
28 | + /** |
|
29 | + * Attempt to create an access token using user credentials. |
|
30 | + * |
|
31 | + * @param array $credentials |
|
32 | + * @param boolean $adminLogin |
|
33 | + * @return array |
|
34 | + */ |
|
35 | + public function login($credentials, $adminLogin = false) |
|
36 | + { |
|
37 | + $this->userRepository->login($credentials, $adminLogin); |
|
38 | + |
|
39 | + return $this->proxy('password', [ |
|
40 | + 'username' => $credentials['email'], |
|
41 | + 'password' => $credentials['password'] |
|
42 | + ]); |
|
43 | + } |
|
44 | + |
|
45 | + /** |
|
46 | + * Attempt to refresh the access token useing the given refresh token. |
|
47 | + * |
|
48 | + * @param string $refreshToken |
|
49 | + * @return array |
|
50 | + */ |
|
51 | + public function refreshtoken($refreshToken) |
|
52 | + { |
|
53 | + return $this->proxy('refresh_token', [ |
|
54 | + 'refresh_token' => $refreshToken |
|
55 | + ]); |
|
56 | + } |
|
57 | + |
|
58 | + /** |
|
59 | + * Proxy a request to the OAuth server. |
|
60 | + * |
|
61 | + * @param string $grantType what type of grant type should be proxied |
|
62 | + * @param array |
|
63 | + */ |
|
64 | + public function proxy($grantType, array $data = []) |
|
65 | + { |
|
66 | + $data = array_merge($data, [ |
|
67 | + 'client_id' => env('PASSWORD_CLIENT_ID'), |
|
68 | + 'client_secret' => env('PASSWORD_CLIENT_SECRET'), |
|
69 | + 'grant_type' => $grantType |
|
70 | + ]); |
|
71 | + |
|
72 | + $response = $this->apiConsumer->post('/oauth/token', $data); |
|
73 | + |
|
74 | + if ( ! $response->isSuccessful()) |
|
75 | + { |
|
76 | + if ($grantType == 'refresh_token') |
|
77 | + { |
|
78 | + \ErrorHandler::invalidRefreshToken(); |
|
79 | + } |
|
80 | + |
|
81 | + \ErrorHandler::loginFailed(); |
|
82 | + } |
|
83 | + |
|
84 | + $data = json_decode($response->getContent()); |
|
85 | + |
|
86 | + return [ |
|
87 | + 'access_token' => $data->access_token, |
|
88 | + 'refresh_token' => $data->refresh_token, |
|
89 | + 'expires_in' => $data->expires_in |
|
90 | + ]; |
|
91 | + } |
|
92 | + |
|
93 | + /** |
|
94 | + * Logs out the user. We revoke access token and refresh token. |
|
95 | + */ |
|
96 | + public function logout() |
|
97 | + { |
|
98 | + $accessToken = $this->auth->user()->token(); |
|
99 | + |
|
100 | + $this->db |
|
101 | + ->table('oauth_refresh_tokens') |
|
102 | + ->where('access_token_id', $accessToken->id) |
|
103 | + ->update([ |
|
104 | + 'revoked' => true |
|
105 | + ]); |
|
106 | + |
|
107 | + $accessToken->revoke(); |
|
108 | + } |
|
109 | 109 | } |
110 | 110 | \ No newline at end of file |
@@ -4,67 +4,67 @@ |
||
4 | 4 | |
5 | 5 | class ReportRepository extends AbstractRepository |
6 | 6 | { |
7 | - /** |
|
8 | - * Return the model full namespace. |
|
9 | - * |
|
10 | - * @return string |
|
11 | - */ |
|
12 | - protected function getModel() |
|
13 | - { |
|
14 | - return 'App\Modules\V1\Reporting\Report'; |
|
15 | - } |
|
7 | + /** |
|
8 | + * Return the model full namespace. |
|
9 | + * |
|
10 | + * @return string |
|
11 | + */ |
|
12 | + protected function getModel() |
|
13 | + { |
|
14 | + return 'App\Modules\V1\Reporting\Report'; |
|
15 | + } |
|
16 | 16 | |
17 | - /** |
|
18 | - * Render the given report db view based on the given |
|
19 | - * condition. |
|
20 | - * |
|
21 | - * @param string $reportName |
|
22 | - * @param array $conditions array of conditions |
|
23 | - * @param integer $perPage |
|
24 | - * @param array $relations |
|
25 | - * @param boolean $skipPermission |
|
26 | - * @return object |
|
27 | - */ |
|
28 | - public function getReport($reportName, $conditions = false, $perPage = 0, $relations = [], $skipPermission = false) |
|
29 | - { |
|
30 | - /** |
|
31 | - * Fetch the report from db. |
|
32 | - */ |
|
33 | - $reportConditions = $this->constructConditions(['report_name' => $reportName], $this->model); |
|
34 | - $report = call_user_func_array("{$this->getModel()}::with", array($relations))->whereRaw($reportConditions['conditionString'], $reportConditions['conditionValues'])->first(); |
|
17 | + /** |
|
18 | + * Render the given report db view based on the given |
|
19 | + * condition. |
|
20 | + * |
|
21 | + * @param string $reportName |
|
22 | + * @param array $conditions array of conditions |
|
23 | + * @param integer $perPage |
|
24 | + * @param array $relations |
|
25 | + * @param boolean $skipPermission |
|
26 | + * @return object |
|
27 | + */ |
|
28 | + public function getReport($reportName, $conditions = false, $perPage = 0, $relations = [], $skipPermission = false) |
|
29 | + { |
|
30 | + /** |
|
31 | + * Fetch the report from db. |
|
32 | + */ |
|
33 | + $reportConditions = $this->constructConditions(['report_name' => $reportName], $this->model); |
|
34 | + $report = call_user_func_array("{$this->getModel()}::with", array($relations))->whereRaw($reportConditions['conditionString'], $reportConditions['conditionValues'])->first(); |
|
35 | 35 | |
36 | - /** |
|
37 | - * Check report existance and permission. |
|
38 | - */ |
|
39 | - if ( ! $report) |
|
40 | - { |
|
41 | - \ErrorHandler::notFound('report'); |
|
42 | - } |
|
43 | - else if (! $skipPermission && ! \Core::users()->can($report->view_name, 'reports')) |
|
44 | - { |
|
45 | - \ErrorHandler::noPermissions(); |
|
46 | - } |
|
36 | + /** |
|
37 | + * Check report existance and permission. |
|
38 | + */ |
|
39 | + if ( ! $report) |
|
40 | + { |
|
41 | + \ErrorHandler::notFound('report'); |
|
42 | + } |
|
43 | + else if (! $skipPermission && ! \Core::users()->can($report->view_name, 'reports')) |
|
44 | + { |
|
45 | + \ErrorHandler::noPermissions(); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * Fetch data from the report based on the given conditions. |
|
50 | - */ |
|
51 | - $report = \DB::table($report->view_name); |
|
52 | - unset($conditions['page']); |
|
53 | - if (count($conditions)) |
|
54 | - { |
|
55 | - $conditions = $this->constructConditions($conditions, $this->model); |
|
56 | - $report->whereRaw($conditions['conditionString'], $conditions['conditionValues']); |
|
57 | - } |
|
58 | - /** |
|
59 | - * Paginate or all data. |
|
60 | - */ |
|
61 | - if ($perPage) |
|
62 | - { |
|
63 | - return $report->paginate($perPage); |
|
64 | - } |
|
65 | - else |
|
66 | - { |
|
67 | - return $report->get(); |
|
68 | - } |
|
69 | - } |
|
48 | + /** |
|
49 | + * Fetch data from the report based on the given conditions. |
|
50 | + */ |
|
51 | + $report = \DB::table($report->view_name); |
|
52 | + unset($conditions['page']); |
|
53 | + if (count($conditions)) |
|
54 | + { |
|
55 | + $conditions = $this->constructConditions($conditions, $this->model); |
|
56 | + $report->whereRaw($conditions['conditionString'], $conditions['conditionValues']); |
|
57 | + } |
|
58 | + /** |
|
59 | + * Paginate or all data. |
|
60 | + */ |
|
61 | + if ($perPage) |
|
62 | + { |
|
63 | + return $report->paginate($perPage); |
|
64 | + } |
|
65 | + else |
|
66 | + { |
|
67 | + return $report->get(); |
|
68 | + } |
|
69 | + } |
|
70 | 70 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | { |
41 | 41 | \ErrorHandler::notFound('report'); |
42 | 42 | } |
43 | - else if (! $skipPermission && ! \Core::users()->can($report->view_name, 'reports')) |
|
43 | + else if ( ! $skipPermission && ! \Core::users()->can($report->view_name, 'reports')) |
|
44 | 44 | { |
45 | 45 | \ErrorHandler::noPermissions(); |
46 | 46 | } |
@@ -39,8 +39,7 @@ discard block |
||
39 | 39 | if ( ! $report) |
40 | 40 | { |
41 | 41 | \ErrorHandler::notFound('report'); |
42 | - } |
|
43 | - else if (! $skipPermission && ! \Core::users()->can($report->view_name, 'reports')) |
|
42 | + } else if (! $skipPermission && ! \Core::users()->can($report->view_name, 'reports')) |
|
44 | 43 | { |
45 | 44 | \ErrorHandler::noPermissions(); |
46 | 45 | } |
@@ -61,8 +60,7 @@ discard block |
||
61 | 60 | if ($perPage) |
62 | 61 | { |
63 | 62 | return $report->paginate($perPage); |
64 | - } |
|
65 | - else |
|
63 | + } else |
|
66 | 64 | { |
67 | 65 | return $report->get(); |
68 | 66 | } |
@@ -3,7 +3,7 @@ |
||
3 | 3 | use Illuminate\Notifications\DatabaseNotification; |
4 | 4 | use Illuminate\Database\Eloquent\SoftDeletes; |
5 | 5 | |
6 | -class Notification extends DatabaseNotification{ |
|
6 | +class Notification extends DatabaseNotification { |
|
7 | 7 | |
8 | 8 | public function getCreatedAtAttribute($value) |
9 | 9 | { |
@@ -5,23 +5,23 @@ |
||
5 | 5 | |
6 | 6 | class Notification extends DatabaseNotification{ |
7 | 7 | |
8 | - public function getCreatedAtAttribute($value) |
|
9 | - { |
|
10 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
11 | - } |
|
8 | + public function getCreatedAtAttribute($value) |
|
9 | + { |
|
10 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
11 | + } |
|
12 | 12 | |
13 | - public function getUpdatedAtAttribute($value) |
|
14 | - { |
|
15 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
16 | - } |
|
13 | + public function getUpdatedAtAttribute($value) |
|
14 | + { |
|
15 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
16 | + } |
|
17 | 17 | |
18 | - public function getDeletedAtAttribute($value) |
|
19 | - { |
|
20 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
21 | - } |
|
18 | + public function getDeletedAtAttribute($value) |
|
19 | + { |
|
20 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
21 | + } |
|
22 | 22 | |
23 | - public function getReadAtAttribute($value) |
|
24 | - { |
|
25 | - return ! $value ? false : \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
26 | - } |
|
23 | + public function getReadAtAttribute($value) |
|
24 | + { |
|
25 | + return ! $value ? false : \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
26 | + } |
|
27 | 27 | } |
@@ -5,56 +5,56 @@ |
||
5 | 5 | */ |
6 | 6 | class AclUserObserver { |
7 | 7 | |
8 | - public function saving($model) |
|
9 | - { |
|
10 | - // |
|
11 | - } |
|
12 | - |
|
13 | - public function saved($model) |
|
14 | - { |
|
15 | - // |
|
16 | - } |
|
17 | - |
|
18 | - public function creating($model) |
|
19 | - { |
|
20 | - // |
|
21 | - } |
|
22 | - |
|
23 | - public function created($model) |
|
24 | - { |
|
25 | - // |
|
26 | - } |
|
27 | - |
|
28 | - public function updating($model) |
|
29 | - { |
|
30 | - // |
|
31 | - } |
|
32 | - |
|
33 | - public function updated($model) |
|
34 | - { |
|
35 | - // |
|
36 | - } |
|
37 | - |
|
38 | - public function deleting($model) |
|
39 | - { |
|
40 | - if ($model->getOriginal('id') == \Auth::id()) |
|
41 | - { |
|
42 | - \ErrorHandler::noPermissions(); |
|
43 | - } |
|
44 | - } |
|
45 | - |
|
46 | - public function deleted($model) |
|
47 | - { |
|
48 | - // |
|
49 | - } |
|
50 | - |
|
51 | - public function restoring($model) |
|
52 | - { |
|
53 | - // |
|
54 | - } |
|
55 | - |
|
56 | - public function restored($model) |
|
57 | - { |
|
58 | - // |
|
59 | - } |
|
8 | + public function saving($model) |
|
9 | + { |
|
10 | + // |
|
11 | + } |
|
12 | + |
|
13 | + public function saved($model) |
|
14 | + { |
|
15 | + // |
|
16 | + } |
|
17 | + |
|
18 | + public function creating($model) |
|
19 | + { |
|
20 | + // |
|
21 | + } |
|
22 | + |
|
23 | + public function created($model) |
|
24 | + { |
|
25 | + // |
|
26 | + } |
|
27 | + |
|
28 | + public function updating($model) |
|
29 | + { |
|
30 | + // |
|
31 | + } |
|
32 | + |
|
33 | + public function updated($model) |
|
34 | + { |
|
35 | + // |
|
36 | + } |
|
37 | + |
|
38 | + public function deleting($model) |
|
39 | + { |
|
40 | + if ($model->getOriginal('id') == \Auth::id()) |
|
41 | + { |
|
42 | + \ErrorHandler::noPermissions(); |
|
43 | + } |
|
44 | + } |
|
45 | + |
|
46 | + public function deleted($model) |
|
47 | + { |
|
48 | + // |
|
49 | + } |
|
50 | + |
|
51 | + public function restoring($model) |
|
52 | + { |
|
53 | + // |
|
54 | + } |
|
55 | + |
|
56 | + public function restored($model) |
|
57 | + { |
|
58 | + // |
|
59 | + } |
|
60 | 60 | } |
61 | 61 | \ No newline at end of file |
@@ -28,7 +28,7 @@ |
||
28 | 28 | * Get the notification's delivery channels. |
29 | 29 | * |
30 | 30 | * @param mixed $notifiable |
31 | - * @return array |
|
31 | + * @return string[] |
|
32 | 32 | */ |
33 | 33 | public function via($notifiable) |
34 | 34 | { |
@@ -6,7 +6,6 @@ |
||
6 | 6 | use Illuminate\Notifications\Notification; |
7 | 7 | use Illuminate\Contracts\Queue\ShouldQueue; |
8 | 8 | use Illuminate\Notifications\Messages\MailMessage; |
9 | -use Illuminate\Notifications\Messages\BroadcastMessage; |
|
10 | 9 | |
11 | 10 | class ResetPassword extends Notification implements ShouldQueue |
12 | 11 | { |
@@ -47,6 +47,6 @@ |
||
47 | 47 | ->subject('Reset passowrd') |
48 | 48 | ->line('Reset passowrd') |
49 | 49 | ->line('To reset your password click on the button below') |
50 | - ->action('Reset password', env('RESET_PASSWORD_URL') . '/' . $this->token); |
|
50 | + ->action('Reset password', env('RESET_PASSWORD_URL').'/'.$this->token); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | \ No newline at end of file |
@@ -10,43 +10,43 @@ |
||
10 | 10 | |
11 | 11 | class ResetPassword extends Notification implements ShouldQueue |
12 | 12 | { |
13 | - use Queueable; |
|
13 | + use Queueable; |
|
14 | 14 | |
15 | - protected $token; |
|
15 | + protected $token; |
|
16 | 16 | |
17 | - /** |
|
18 | - * Create a new notification instance. |
|
19 | - * |
|
20 | - * @return void |
|
21 | - */ |
|
22 | - public function __construct($token) |
|
23 | - { |
|
24 | - $this->token = $token; |
|
25 | - } |
|
17 | + /** |
|
18 | + * Create a new notification instance. |
|
19 | + * |
|
20 | + * @return void |
|
21 | + */ |
|
22 | + public function __construct($token) |
|
23 | + { |
|
24 | + $this->token = $token; |
|
25 | + } |
|
26 | 26 | |
27 | - /** |
|
28 | - * Get the notification's delivery channels. |
|
29 | - * |
|
30 | - * @param mixed $notifiable |
|
31 | - * @return array |
|
32 | - */ |
|
33 | - public function via($notifiable) |
|
34 | - { |
|
35 | - return ['mail']; |
|
36 | - } |
|
27 | + /** |
|
28 | + * Get the notification's delivery channels. |
|
29 | + * |
|
30 | + * @param mixed $notifiable |
|
31 | + * @return array |
|
32 | + */ |
|
33 | + public function via($notifiable) |
|
34 | + { |
|
35 | + return ['mail']; |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * Get the mail representation of the notification. |
|
40 | - * |
|
41 | - * @param mixed $notifiable |
|
42 | - * @return \Illuminate\Notifications\Messages\MailMessage |
|
43 | - */ |
|
44 | - public function toMail($notifiable) |
|
45 | - { |
|
46 | - return (new MailMessage) |
|
47 | - ->subject('Reset passowrd') |
|
48 | - ->line('Reset passowrd') |
|
49 | - ->line('To reset your password click on the button below') |
|
50 | - ->action('Reset password', env('RESET_PASSWORD_URL') . '/' . $this->token); |
|
51 | - } |
|
38 | + /** |
|
39 | + * Get the mail representation of the notification. |
|
40 | + * |
|
41 | + * @param mixed $notifiable |
|
42 | + * @return \Illuminate\Notifications\Messages\MailMessage |
|
43 | + */ |
|
44 | + public function toMail($notifiable) |
|
45 | + { |
|
46 | + return (new MailMessage) |
|
47 | + ->subject('Reset passowrd') |
|
48 | + ->line('Reset passowrd') |
|
49 | + ->line('To reset your password click on the button below') |
|
50 | + ->action('Reset password', env('RESET_PASSWORD_URL') . '/' . $this->token); |
|
51 | + } |
|
52 | 52 | } |
53 | 53 | \ No newline at end of file |
@@ -2,27 +2,27 @@ |
||
2 | 2 | |
3 | 3 | return [ |
4 | 4 | |
5 | - /** |
|
6 | - * List of error messages used in core module. |
|
7 | - */ |
|
8 | - 'unAuthorized' => 'من فضلك قم بتسجيل الدخول', |
|
9 | - 'invalidRefreshToken' => 'رمز التحديث غير صالح', |
|
10 | - 'noPermissions' => 'لا توجد صلاحية', |
|
11 | - 'loginFailed' => 'خطأ في البريد لاكتروني او كلمة المرور', |
|
12 | - 'noSocialEmail' => 'لا يمكن الحصول علي تابريد الاكتروني', |
|
13 | - 'userAlreadyRegistered' => 'المستخد مسجل بالفعل.سجل الدخول بالبريد الاكتروني و كلمة السر', |
|
14 | - 'connectionError' => 'خطأ في الاتصال', |
|
15 | - 'redisNotRunning' => 'سيرفير الاشعارات لايعمل', |
|
16 | - 'dbQueryError' => 'خطا في البيانات', |
|
17 | - 'cannotCreateSetting' => 'لا يمكن اضافة اعدادات', |
|
18 | - 'cannotUpdateSettingKey' => 'لا يمكن تعديل اعدادات', |
|
19 | - 'userIsBlocked' => 'لقد تم حظرك', |
|
20 | - 'invalidResetToken' => 'رمز تعديل كلمة المرور خطا', |
|
21 | - 'invalidResetPassword' => 'خطا في نعديل كلمة المرور', |
|
22 | - 'invalidOldPassword' => 'كلمة السر القديمه خطا', |
|
23 | - 'notFound' => 'ال :replace المطلوب غير موجود', |
|
24 | - 'generalError' => 'حدث خطا ما', |
|
25 | - 'emailNotConfirmed' => 'بريدك الاكتروني غير مفعل', |
|
26 | - 'emailAlreadyConfirmed' => 'البريد الاكتروني مفع بالقعل' |
|
5 | + /** |
|
6 | + * List of error messages used in core module. |
|
7 | + */ |
|
8 | + 'unAuthorized' => 'من فضلك قم بتسجيل الدخول', |
|
9 | + 'invalidRefreshToken' => 'رمز التحديث غير صالح', |
|
10 | + 'noPermissions' => 'لا توجد صلاحية', |
|
11 | + 'loginFailed' => 'خطأ في البريد لاكتروني او كلمة المرور', |
|
12 | + 'noSocialEmail' => 'لا يمكن الحصول علي تابريد الاكتروني', |
|
13 | + 'userAlreadyRegistered' => 'المستخد مسجل بالفعل.سجل الدخول بالبريد الاكتروني و كلمة السر', |
|
14 | + 'connectionError' => 'خطأ في الاتصال', |
|
15 | + 'redisNotRunning' => 'سيرفير الاشعارات لايعمل', |
|
16 | + 'dbQueryError' => 'خطا في البيانات', |
|
17 | + 'cannotCreateSetting' => 'لا يمكن اضافة اعدادات', |
|
18 | + 'cannotUpdateSettingKey' => 'لا يمكن تعديل اعدادات', |
|
19 | + 'userIsBlocked' => 'لقد تم حظرك', |
|
20 | + 'invalidResetToken' => 'رمز تعديل كلمة المرور خطا', |
|
21 | + 'invalidResetPassword' => 'خطا في نعديل كلمة المرور', |
|
22 | + 'invalidOldPassword' => 'كلمة السر القديمه خطا', |
|
23 | + 'notFound' => 'ال :replace المطلوب غير موجود', |
|
24 | + 'generalError' => 'حدث خطا ما', |
|
25 | + 'emailNotConfirmed' => 'بريدك الاكتروني غير مفعل', |
|
26 | + 'emailAlreadyConfirmed' => 'البريد الاكتروني مفع بالقعل' |
|
27 | 27 | |
28 | 28 | ]; |
29 | 29 | \ No newline at end of file |
@@ -2,27 +2,27 @@ |
||
2 | 2 | |
3 | 3 | return [ |
4 | 4 | |
5 | - /** |
|
6 | - * List of error messages used in core module. |
|
7 | - */ |
|
8 | - 'unAuthorized' => 'Please login before any action', |
|
9 | - 'invalidRefreshToken' => 'Invalid refresh token', |
|
10 | - 'noPermissions' => 'No permissions', |
|
11 | - 'loginFailed' => 'Wrong mail or password', |
|
12 | - 'noSocialEmail' => 'Couldn\'t retrieve email', |
|
13 | - 'userAlreadyRegistered' => 'User already registered. Please login using email and password', |
|
14 | - 'connectionError' => 'Connection error', |
|
15 | - 'redisNotRunning' => 'Your redis notification server is\'t running', |
|
16 | - 'dbQueryError' => 'Please check the given inputes', |
|
17 | - 'cannotCreateSetting' => 'Can\'t create setting', |
|
18 | - 'cannotUpdateSettingKey' => 'Can\'t update setting key', |
|
19 | - 'userIsBlocked' => 'You have been blocked', |
|
20 | - 'invalidResetToken' => 'Reset password token is invalid', |
|
21 | - 'invalidResetPassword' => 'Reset password is invalid', |
|
22 | - 'invalidOldPassword' => 'Old password is invalid', |
|
23 | - 'notFound' => 'The requested :replace not found', |
|
24 | - 'generalError' => 'Something went wrong', |
|
25 | - 'emailNotConfirmed' => 'Your email isn\'t confirmed', |
|
26 | - 'emailAlreadyConfirmed' => 'Your email is already confirmed' |
|
5 | + /** |
|
6 | + * List of error messages used in core module. |
|
7 | + */ |
|
8 | + 'unAuthorized' => 'Please login before any action', |
|
9 | + 'invalidRefreshToken' => 'Invalid refresh token', |
|
10 | + 'noPermissions' => 'No permissions', |
|
11 | + 'loginFailed' => 'Wrong mail or password', |
|
12 | + 'noSocialEmail' => 'Couldn\'t retrieve email', |
|
13 | + 'userAlreadyRegistered' => 'User already registered. Please login using email and password', |
|
14 | + 'connectionError' => 'Connection error', |
|
15 | + 'redisNotRunning' => 'Your redis notification server is\'t running', |
|
16 | + 'dbQueryError' => 'Please check the given inputes', |
|
17 | + 'cannotCreateSetting' => 'Can\'t create setting', |
|
18 | + 'cannotUpdateSettingKey' => 'Can\'t update setting key', |
|
19 | + 'userIsBlocked' => 'You have been blocked', |
|
20 | + 'invalidResetToken' => 'Reset password token is invalid', |
|
21 | + 'invalidResetPassword' => 'Reset password is invalid', |
|
22 | + 'invalidOldPassword' => 'Old password is invalid', |
|
23 | + 'notFound' => 'The requested :replace not found', |
|
24 | + 'generalError' => 'Something went wrong', |
|
25 | + 'emailNotConfirmed' => 'Your email isn\'t confirmed', |
|
26 | + 'emailAlreadyConfirmed' => 'Your email is already confirmed' |
|
27 | 27 | |
28 | 28 | ]; |
29 | 29 | \ No newline at end of file |