@@ -10,40 +10,40 @@ |
||
10 | 10 | |
11 | 11 | class RoleController extends BaseApiController |
12 | 12 | { |
13 | - /** |
|
14 | - * Path of the sotre form request. |
|
15 | - * |
|
16 | - * @var string |
|
17 | - */ |
|
18 | - protected $storeFormRequest = 'App\Modules\Roles\Http\Requests\StoreRole'; |
|
13 | + /** |
|
14 | + * Path of the sotre form request. |
|
15 | + * |
|
16 | + * @var string |
|
17 | + */ |
|
18 | + protected $storeFormRequest = 'App\Modules\Roles\Http\Requests\StoreRole'; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Path of the model resource |
|
22 | - * |
|
23 | - * @var string |
|
24 | - */ |
|
25 | - protected $modelResource = 'App\Modules\Roles\Http\Resources\Role'; |
|
20 | + /** |
|
21 | + * Path of the model resource |
|
22 | + * |
|
23 | + * @var string |
|
24 | + */ |
|
25 | + protected $modelResource = 'App\Modules\Roles\Http\Resources\Role'; |
|
26 | 26 | |
27 | - /** |
|
28 | - * Init new object. |
|
29 | - * |
|
30 | - * @param RoleService $service |
|
31 | - * @return void |
|
32 | - */ |
|
33 | - public function __construct(RoleService $service) |
|
34 | - { |
|
35 | - parent::__construct($service); |
|
36 | - } |
|
27 | + /** |
|
28 | + * Init new object. |
|
29 | + * |
|
30 | + * @param RoleService $service |
|
31 | + * @return void |
|
32 | + */ |
|
33 | + public function __construct(RoleService $service) |
|
34 | + { |
|
35 | + parent::__construct($service); |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * Handle an assign permissions to role request. |
|
40 | - * |
|
41 | - * @param AssignPermissions $request |
|
42 | - * @param integer $id |
|
43 | - * @return \Illuminate\Http\Response |
|
44 | - */ |
|
45 | - public function assignPermissions(AssignPermissions $request, $id) |
|
46 | - { |
|
47 | - return new $this->modelResource($this->service->assignPermissions($id, $request->get('permission_ids'))); |
|
48 | - } |
|
38 | + /** |
|
39 | + * Handle an assign permissions to role request. |
|
40 | + * |
|
41 | + * @param AssignPermissions $request |
|
42 | + * @param integer $id |
|
43 | + * @return \Illuminate\Http\Response |
|
44 | + */ |
|
45 | + public function assignPermissions(AssignPermissions $request, $id) |
|
46 | + { |
|
47 | + return new $this->modelResource($this->service->assignPermissions($id, $request->get('permission_ids'))); |
|
48 | + } |
|
49 | 49 | } |
@@ -11,39 +11,39 @@ |
||
11 | 11 | |
12 | 12 | class Kernel extends ConsoleKernel |
13 | 13 | { |
14 | - /** |
|
15 | - * The Artisan commands provided by your application. |
|
16 | - * |
|
17 | - * @var array |
|
18 | - */ |
|
19 | - protected $commands = [ |
|
20 | - GenerateDocCommand::class, |
|
21 | - PassportInstallCommand::class, |
|
22 | - MakeNotificationsCommand::class, |
|
23 | - MakeModuleCommand::class |
|
24 | - ]; |
|
14 | + /** |
|
15 | + * The Artisan commands provided by your application. |
|
16 | + * |
|
17 | + * @var array |
|
18 | + */ |
|
19 | + protected $commands = [ |
|
20 | + GenerateDocCommand::class, |
|
21 | + PassportInstallCommand::class, |
|
22 | + MakeNotificationsCommand::class, |
|
23 | + MakeModuleCommand::class |
|
24 | + ]; |
|
25 | 25 | |
26 | - /** |
|
27 | - * Define the application's command schedule. |
|
28 | - * |
|
29 | - * @param \Illuminate\Console\Scheduling\Schedule $schedule |
|
30 | - * @return void |
|
31 | - */ |
|
32 | - protected function schedule(Schedule $schedule) |
|
33 | - { |
|
34 | - // $schedule->command('inspire') |
|
35 | - // ->hourly(); |
|
36 | - } |
|
26 | + /** |
|
27 | + * Define the application's command schedule. |
|
28 | + * |
|
29 | + * @param \Illuminate\Console\Scheduling\Schedule $schedule |
|
30 | + * @return void |
|
31 | + */ |
|
32 | + protected function schedule(Schedule $schedule) |
|
33 | + { |
|
34 | + // $schedule->command('inspire') |
|
35 | + // ->hourly(); |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * Register the commands for the application. |
|
40 | - * |
|
41 | - * @return void |
|
42 | - */ |
|
43 | - protected function commands() |
|
44 | - { |
|
45 | - $this->load(__DIR__.'/Commands'); |
|
38 | + /** |
|
39 | + * Register the commands for the application. |
|
40 | + * |
|
41 | + * @return void |
|
42 | + */ |
|
43 | + protected function commands() |
|
44 | + { |
|
45 | + $this->load(__DIR__.'/Commands'); |
|
46 | 46 | |
47 | - require base_path('routes/console.php'); |
|
48 | - } |
|
47 | + require base_path('routes/console.php'); |
|
48 | + } |
|
49 | 49 | } |
@@ -9,32 +9,32 @@ |
||
9 | 9 | |
10 | 10 | class AclUser extends JsonResource |
11 | 11 | { |
12 | - /** |
|
13 | - * Transform the resource into an array. |
|
14 | - * |
|
15 | - * @param Request $request |
|
16 | - * @return array |
|
17 | - */ |
|
18 | - public function toArray($request) |
|
19 | - { |
|
20 | - if (! $this->resource) { |
|
21 | - return []; |
|
22 | - } |
|
12 | + /** |
|
13 | + * Transform the resource into an array. |
|
14 | + * |
|
15 | + * @param Request $request |
|
16 | + * @return array |
|
17 | + */ |
|
18 | + public function toArray($request) |
|
19 | + { |
|
20 | + if (! $this->resource) { |
|
21 | + return []; |
|
22 | + } |
|
23 | 23 | |
24 | - return [ |
|
25 | - 'id' => $this->id, |
|
26 | - 'name' => $this->name, |
|
27 | - 'email' => $this->email, |
|
28 | - 'profilePicture' => $this->profile_picture ? url(\Storage::url($this->profile_picture)) : null, |
|
29 | - 'notifications' => NotificationResource::collection($this->whenLoaded('notifications')), |
|
30 | - 'readNotifications' => NotificationResource::collection($this->whenLoaded('readNotifications')), |
|
31 | - 'unreadNotifications' => NotificationResource::collection($this->whenLoaded('unreadNotifications')), |
|
32 | - 'roles' => RoleResource::collection($this->whenLoaded('roles')), |
|
33 | - 'oauthClients' => OauthClientResource::collection($this->whenLoaded('oauthClients')), |
|
34 | - 'locale' => $this->locale, |
|
35 | - 'timezone' => $this->timezone, |
|
36 | - 'created_at' => $this->created_at, |
|
37 | - 'updated_at' => $this->updated_at, |
|
38 | - ]; |
|
39 | - } |
|
24 | + return [ |
|
25 | + 'id' => $this->id, |
|
26 | + 'name' => $this->name, |
|
27 | + 'email' => $this->email, |
|
28 | + 'profilePicture' => $this->profile_picture ? url(\Storage::url($this->profile_picture)) : null, |
|
29 | + 'notifications' => NotificationResource::collection($this->whenLoaded('notifications')), |
|
30 | + 'readNotifications' => NotificationResource::collection($this->whenLoaded('readNotifications')), |
|
31 | + 'unreadNotifications' => NotificationResource::collection($this->whenLoaded('unreadNotifications')), |
|
32 | + 'roles' => RoleResource::collection($this->whenLoaded('roles')), |
|
33 | + 'oauthClients' => OauthClientResource::collection($this->whenLoaded('oauthClients')), |
|
34 | + 'locale' => $this->locale, |
|
35 | + 'timezone' => $this->timezone, |
|
36 | + 'created_at' => $this->created_at, |
|
37 | + 'updated_at' => $this->updated_at, |
|
38 | + ]; |
|
39 | + } |
|
40 | 40 | } |
@@ -5,41 +5,41 @@ |
||
5 | 5 | |
6 | 6 | class Permissions extends Migration |
7 | 7 | { |
8 | - /** |
|
9 | - * Run the migrations. |
|
10 | - * |
|
11 | - * @return void |
|
12 | - */ |
|
13 | - public function up() |
|
14 | - { |
|
15 | - Schema::create('permissions', function (Blueprint $table) { |
|
16 | - $table->increments('id'); |
|
17 | - $table->string('name', 100); |
|
18 | - $table->string('model', 100); |
|
19 | - $table->softDeletes(); |
|
20 | - $table->timestamps(); |
|
21 | - $table->unique(array('name', 'model')); |
|
22 | - }); |
|
23 | - Schema::create('permission_role', function (Blueprint $table) { |
|
24 | - $table->increments('id'); |
|
25 | - $table->unsignedInteger('role_id'); |
|
26 | - $table->unsignedInteger('permission_id'); |
|
27 | - $table->softDeletes(); |
|
28 | - $table->timestamps(); |
|
8 | + /** |
|
9 | + * Run the migrations. |
|
10 | + * |
|
11 | + * @return void |
|
12 | + */ |
|
13 | + public function up() |
|
14 | + { |
|
15 | + Schema::create('permissions', function (Blueprint $table) { |
|
16 | + $table->increments('id'); |
|
17 | + $table->string('name', 100); |
|
18 | + $table->string('model', 100); |
|
19 | + $table->softDeletes(); |
|
20 | + $table->timestamps(); |
|
21 | + $table->unique(array('name', 'model')); |
|
22 | + }); |
|
23 | + Schema::create('permission_role', function (Blueprint $table) { |
|
24 | + $table->increments('id'); |
|
25 | + $table->unsignedInteger('role_id'); |
|
26 | + $table->unsignedInteger('permission_id'); |
|
27 | + $table->softDeletes(); |
|
28 | + $table->timestamps(); |
|
29 | 29 | |
30 | - $table->foreign('role_id')->references('id')->on('roles'); |
|
31 | - $table->foreign('permission_id')->references('id')->on('permissions'); |
|
32 | - }); |
|
33 | - } |
|
30 | + $table->foreign('role_id')->references('id')->on('roles'); |
|
31 | + $table->foreign('permission_id')->references('id')->on('permissions'); |
|
32 | + }); |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * Reverse the migrations. |
|
37 | - * |
|
38 | - * @return void |
|
39 | - */ |
|
40 | - public function down() |
|
41 | - { |
|
42 | - Schema::dropIfExists('permission_role'); |
|
43 | - Schema::dropIfExists('permissions'); |
|
44 | - } |
|
35 | + /** |
|
36 | + * Reverse the migrations. |
|
37 | + * |
|
38 | + * @return void |
|
39 | + */ |
|
40 | + public function down() |
|
41 | + { |
|
42 | + Schema::dropIfExists('permission_role'); |
|
43 | + Schema::dropIfExists('permissions'); |
|
44 | + } |
|
45 | 45 | } |
@@ -5,40 +5,40 @@ |
||
5 | 5 | |
6 | 6 | class Roles extends Migration |
7 | 7 | { |
8 | - /** |
|
9 | - * Run the migrations. |
|
10 | - * |
|
11 | - * @return void |
|
12 | - */ |
|
13 | - public function up() |
|
14 | - { |
|
15 | - Schema::create('roles', function (Blueprint $table) { |
|
16 | - $table->increments('id'); |
|
17 | - $table->string('name', 100)->unique(); |
|
18 | - $table->softDeletes(); |
|
19 | - $table->timestamps(); |
|
20 | - }); |
|
8 | + /** |
|
9 | + * Run the migrations. |
|
10 | + * |
|
11 | + * @return void |
|
12 | + */ |
|
13 | + public function up() |
|
14 | + { |
|
15 | + Schema::create('roles', function (Blueprint $table) { |
|
16 | + $table->increments('id'); |
|
17 | + $table->string('name', 100)->unique(); |
|
18 | + $table->softDeletes(); |
|
19 | + $table->timestamps(); |
|
20 | + }); |
|
21 | 21 | |
22 | - Schema::create('role_user', function (Blueprint $table) { |
|
23 | - $table->increments('id'); |
|
24 | - $table->unsignedInteger('user_id'); |
|
25 | - $table->unsignedInteger('role_id'); |
|
26 | - $table->softDeletes(); |
|
27 | - $table->timestamps(); |
|
22 | + Schema::create('role_user', function (Blueprint $table) { |
|
23 | + $table->increments('id'); |
|
24 | + $table->unsignedInteger('user_id'); |
|
25 | + $table->unsignedInteger('role_id'); |
|
26 | + $table->softDeletes(); |
|
27 | + $table->timestamps(); |
|
28 | 28 | |
29 | - $table->foreign('user_id')->references('id')->on('users'); |
|
30 | - $table->foreign('role_id')->references('id')->on('roles'); |
|
31 | - }); |
|
32 | - } |
|
29 | + $table->foreign('user_id')->references('id')->on('users'); |
|
30 | + $table->foreign('role_id')->references('id')->on('roles'); |
|
31 | + }); |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * Reverse the migrations. |
|
36 | - * |
|
37 | - * @return void |
|
38 | - */ |
|
39 | - public function down() |
|
40 | - { |
|
41 | - Schema::dropIfExists('role_user'); |
|
42 | - Schema::dropIfExists('roles'); |
|
43 | - } |
|
34 | + /** |
|
35 | + * Reverse the migrations. |
|
36 | + * |
|
37 | + * @return void |
|
38 | + */ |
|
39 | + public function down() |
|
40 | + { |
|
41 | + Schema::dropIfExists('role_user'); |
|
42 | + Schema::dropIfExists('roles'); |
|
43 | + } |
|
44 | 44 | } |
@@ -7,64 +7,64 @@ |
||
7 | 7 | |
8 | 8 | class LoginProxy |
9 | 9 | { |
10 | - /** |
|
11 | - * Attempt to create an access token using user credentials. |
|
12 | - * |
|
13 | - * @param string $email |
|
14 | - * @param string $password |
|
15 | - * @return array |
|
16 | - */ |
|
17 | - public function login($email, $password) |
|
18 | - { |
|
19 | - return $this->proxy('password', [ |
|
20 | - 'username' => $email, |
|
21 | - 'password' => $password |
|
22 | - ]); |
|
23 | - } |
|
10 | + /** |
|
11 | + * Attempt to create an access token using user credentials. |
|
12 | + * |
|
13 | + * @param string $email |
|
14 | + * @param string $password |
|
15 | + * @return array |
|
16 | + */ |
|
17 | + public function login($email, $password) |
|
18 | + { |
|
19 | + return $this->proxy('password', [ |
|
20 | + 'username' => $email, |
|
21 | + 'password' => $password |
|
22 | + ]); |
|
23 | + } |
|
24 | 24 | |
25 | - /** |
|
26 | - * Attempt to refresh the access token using the given refresh token. |
|
27 | - * |
|
28 | - * @param string $refreshToken |
|
29 | - * @return array |
|
30 | - */ |
|
31 | - public function refreshToken($refreshToken) |
|
32 | - { |
|
33 | - return $this->proxy('refresh_token', [ |
|
34 | - 'refresh_token' => $refreshToken |
|
35 | - ]); |
|
36 | - } |
|
25 | + /** |
|
26 | + * Attempt to refresh the access token using the given refresh token. |
|
27 | + * |
|
28 | + * @param string $refreshToken |
|
29 | + * @return array |
|
30 | + */ |
|
31 | + public function refreshToken($refreshToken) |
|
32 | + { |
|
33 | + return $this->proxy('refresh_token', [ |
|
34 | + 'refresh_token' => $refreshToken |
|
35 | + ]); |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * Proxy a request to the OAuth server. |
|
40 | - * |
|
41 | - * @param string $grantType what type of grant type should be proxied |
|
42 | - * @param array |
|
43 | - */ |
|
44 | - public function proxy($grantType, array $data = []) |
|
45 | - { |
|
46 | - $data = array_merge($data, [ |
|
47 | - 'client_id' => config('user.passport_client_id'), |
|
48 | - 'client_secret' => config('user.passport_client_secret'), |
|
49 | - 'grant_type' => $grantType |
|
50 | - ]); |
|
38 | + /** |
|
39 | + * Proxy a request to the OAuth server. |
|
40 | + * |
|
41 | + * @param string $grantType what type of grant type should be proxied |
|
42 | + * @param array |
|
43 | + */ |
|
44 | + public function proxy($grantType, array $data = []) |
|
45 | + { |
|
46 | + $data = array_merge($data, [ |
|
47 | + 'client_id' => config('user.passport_client_id'), |
|
48 | + 'client_secret' => config('user.passport_client_secret'), |
|
49 | + 'grant_type' => $grantType |
|
50 | + ]); |
|
51 | 51 | |
52 | - $response = \ApiConsumer::post('/oauth/token', $data); |
|
52 | + $response = \ApiConsumer::post('/oauth/token', $data); |
|
53 | 53 | |
54 | - if (! $response->isSuccessful()) { |
|
55 | - if ($grantType == 'refresh_token') { |
|
56 | - \Errors::invalidRefreshToken(); |
|
57 | - } |
|
54 | + if (! $response->isSuccessful()) { |
|
55 | + if ($grantType == 'refresh_token') { |
|
56 | + \Errors::invalidRefreshToken(); |
|
57 | + } |
|
58 | 58 | |
59 | - \Errors::loginFailed(); |
|
60 | - } |
|
59 | + \Errors::loginFailed(); |
|
60 | + } |
|
61 | 61 | |
62 | - $data = json_decode($response->getContent()); |
|
62 | + $data = json_decode($response->getContent()); |
|
63 | 63 | |
64 | - return [ |
|
65 | - 'access_token' => $data->access_token, |
|
66 | - 'refresh_token' => $data->refresh_token, |
|
67 | - 'expires_in' => $data->expires_in |
|
68 | - ]; |
|
69 | - } |
|
64 | + return [ |
|
65 | + 'access_token' => $data->access_token, |
|
66 | + 'refresh_token' => $data->refresh_token, |
|
67 | + 'expires_in' => $data->expires_in |
|
68 | + ]; |
|
69 | + } |
|
70 | 70 | } |
@@ -9,43 +9,43 @@ |
||
9 | 9 | |
10 | 10 | class ResetPassword extends Notification implements ShouldQueue |
11 | 11 | { |
12 | - use Queueable; |
|
12 | + use Queueable; |
|
13 | 13 | |
14 | - protected $token; |
|
14 | + protected $token; |
|
15 | 15 | |
16 | - /** |
|
17 | - * Init new object. |
|
18 | - * |
|
19 | - * @return void |
|
20 | - */ |
|
21 | - public function __construct($token) |
|
22 | - { |
|
23 | - $this->token = $token; |
|
24 | - } |
|
16 | + /** |
|
17 | + * Init new object. |
|
18 | + * |
|
19 | + * @return void |
|
20 | + */ |
|
21 | + public function __construct($token) |
|
22 | + { |
|
23 | + $this->token = $token; |
|
24 | + } |
|
25 | 25 | |
26 | - /** |
|
27 | - * Get the notification's delivery channels. |
|
28 | - * |
|
29 | - * @param mixed $notifiable |
|
30 | - * @return string[] |
|
31 | - */ |
|
32 | - public function via($notifiable) |
|
33 | - { |
|
34 | - return ['mail']; |
|
35 | - } |
|
26 | + /** |
|
27 | + * Get the notification's delivery channels. |
|
28 | + * |
|
29 | + * @param mixed $notifiable |
|
30 | + * @return string[] |
|
31 | + */ |
|
32 | + public function via($notifiable) |
|
33 | + { |
|
34 | + return ['mail']; |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * Get the mail representation of the notification. |
|
39 | - * |
|
40 | - * @param mixed $notifiable |
|
41 | - * @return \Illuminate\Notifications\Messages\MailMessage |
|
42 | - */ |
|
43 | - public function toMail($notifiable) |
|
44 | - { |
|
45 | - return (new MailMessage) |
|
46 | - ->subject('Reset passowrd') |
|
47 | - ->line('Reset passowrd') |
|
48 | - ->line('To reset your password click on the button below') |
|
49 | - ->action('Reset password', config('user.reset_password_url').'/'.$this->token); |
|
50 | - } |
|
37 | + /** |
|
38 | + * Get the mail representation of the notification. |
|
39 | + * |
|
40 | + * @param mixed $notifiable |
|
41 | + * @return \Illuminate\Notifications\Messages\MailMessage |
|
42 | + */ |
|
43 | + public function toMail($notifiable) |
|
44 | + { |
|
45 | + return (new MailMessage) |
|
46 | + ->subject('Reset passowrd') |
|
47 | + ->line('Reset passowrd') |
|
48 | + ->line('To reset your password click on the button below') |
|
49 | + ->action('Reset password', config('user.reset_password_url').'/'.$this->token); |
|
50 | + } |
|
51 | 51 | } |
@@ -9,41 +9,41 @@ |
||
9 | 9 | |
10 | 10 | class ConfirmEmail extends Notification implements ShouldQueue |
11 | 11 | { |
12 | - use Queueable; |
|
12 | + use Queueable; |
|
13 | 13 | |
14 | - /** |
|
15 | - * Init new object. |
|
16 | - * |
|
17 | - * @return void |
|
18 | - */ |
|
19 | - public function __construct() |
|
20 | - { |
|
21 | - // |
|
22 | - } |
|
14 | + /** |
|
15 | + * Init new object. |
|
16 | + * |
|
17 | + * @return void |
|
18 | + */ |
|
19 | + public function __construct() |
|
20 | + { |
|
21 | + // |
|
22 | + } |
|
23 | 23 | |
24 | - /** |
|
25 | - * Get the notification's delivery channels. |
|
26 | - * |
|
27 | - * @param mixed $notifiable |
|
28 | - * @return string[] |
|
29 | - */ |
|
30 | - public function via($notifiable) |
|
31 | - { |
|
32 | - return ['mail']; |
|
33 | - } |
|
24 | + /** |
|
25 | + * Get the notification's delivery channels. |
|
26 | + * |
|
27 | + * @param mixed $notifiable |
|
28 | + * @return string[] |
|
29 | + */ |
|
30 | + public function via($notifiable) |
|
31 | + { |
|
32 | + return ['mail']; |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * Get the mail representation of the notification. |
|
37 | - * |
|
38 | - * @param mixed $notifiable |
|
39 | - * @return \Illuminate\Notifications\Messages\MailMessage |
|
40 | - */ |
|
41 | - public function toMail($notifiable) |
|
42 | - { |
|
43 | - return (new MailMessage) |
|
44 | - ->subject('Email verification') |
|
45 | - ->line('Email verification') |
|
46 | - ->line('To validate your email click on the button below') |
|
47 | - ->action('Verify your email', config('user.confrim_email_url').'/'.$notifiable->confirmation_code); |
|
48 | - } |
|
35 | + /** |
|
36 | + * Get the mail representation of the notification. |
|
37 | + * |
|
38 | + * @param mixed $notifiable |
|
39 | + * @return \Illuminate\Notifications\Messages\MailMessage |
|
40 | + */ |
|
41 | + public function toMail($notifiable) |
|
42 | + { |
|
43 | + return (new MailMessage) |
|
44 | + ->subject('Email verification') |
|
45 | + ->line('Email verification') |
|
46 | + ->line('To validate your email click on the button below') |
|
47 | + ->action('Verify your email', config('user.confrim_email_url').'/'.$notifiable->confirmation_code); |
|
48 | + } |
|
49 | 49 | } |
@@ -6,28 +6,28 @@ |
||
6 | 6 | |
7 | 7 | class Errors implements BaseFactoryInterface |
8 | 8 | { |
9 | - /** |
|
10 | - * Construct the config class name based on |
|
11 | - * the method name called, search in the |
|
12 | - * given namespaces for the class and |
|
13 | - * return an instance. |
|
14 | - * |
|
15 | - * @param string $name the called method name |
|
16 | - * @param array $arguments the method arguments |
|
17 | - * @return object |
|
18 | - */ |
|
19 | - public function __call($name, $arguments) |
|
20 | - { |
|
21 | - foreach (\Module::all() as $module) { |
|
22 | - $nameSpace = 'App\\Modules\\' . $module['basename']; |
|
23 | - $class = $nameSpace . '\\Errors\\' . $module['basename'] . 'Errors'; |
|
9 | + /** |
|
10 | + * Construct the config class name based on |
|
11 | + * the method name called, search in the |
|
12 | + * given namespaces for the class and |
|
13 | + * return an instance. |
|
14 | + * |
|
15 | + * @param string $name the called method name |
|
16 | + * @param array $arguments the method arguments |
|
17 | + * @return object |
|
18 | + */ |
|
19 | + public function __call($name, $arguments) |
|
20 | + { |
|
21 | + foreach (\Module::all() as $module) { |
|
22 | + $nameSpace = 'App\\Modules\\' . $module['basename']; |
|
23 | + $class = $nameSpace . '\\Errors\\' . $module['basename'] . 'Errors'; |
|
24 | 24 | |
25 | - if (class_exists($class)) { |
|
26 | - $class = \App::make($class); |
|
27 | - if (method_exists($class, $name)) { |
|
28 | - return call_user_func_array([$class, $name], $arguments); |
|
29 | - } |
|
30 | - } |
|
31 | - } |
|
32 | - } |
|
25 | + if (class_exists($class)) { |
|
26 | + $class = \App::make($class); |
|
27 | + if (method_exists($class, $name)) { |
|
28 | + return call_user_func_array([$class, $name], $arguments); |
|
29 | + } |
|
30 | + } |
|
31 | + } |
|
32 | + } |
|
33 | 33 | } |