Forum

Ask, reply and learn. Join the community of Akaunting.

New Discussion

I want to create custom controller and view, and its shows

Muhammad Kashif   ( User )

Commented 3 years ago

403 Forbidden When i create my custom controller and view?

Madushan Perera   ( User )

Commented 3 years ago

Same problem for me too. Once a custom module created, unable to access the views through the Main controller methods. But the below approach will only work.

Route::group([
'middleware' => 'admin',
'namespace' => 'Modules\YourModule\Http\Controllers'
], function () {
Route::prefix('your_module')->group(function () {
// Route::get('data', 'Main@index'); -> does not work, User does not have any of the necessary access rights
Route::get('data', function () {
return view('module::index'); // this will work without 403 error
});
});
});

Any suggestions would be appreciable.

Madushan Perera   ( User )

Commented 3 years ago

I think I did find a solution. Create a read permission in your auth permission section and put it as a middleware permission in the controller constructor like below.

public function __construct()
{
$this->middleware('permission:read-your-module-permission')->only(['index', 'show']);
}

Muhammad Kashif   ( User )

Commented 3 years ago

Thanks for your reply! But how to define this module into the main admin route? simply how will access Index Page? because I'm facing 403 issues while creating direct Controller+Model into a project root.

Denis Dulici   ( Admin )

Commented 3 years ago

It works fine for me: https://prnt.sc/tqzqkz

Make sure you've run the install command after make:

php artisan module:install my-blog 1

https://akaunting.com/docs/developer-manual/modules

Hasan   ( User )

Commented 2 years ago

Hi Denis,

It works fine just routing the web. But when you put your controller details to your route description it gives 403 Error. I'm new to Laravel and PHP. I think there is something missing with LiveWire. And Documentations are too general for newbies.

Best Regards
Hasan

Veev   ( User )

Commented 1 year ago

hi Your problem solved ?
can you please guide me?

Please login or register to leave a response.

Showing 1 to 7 of 7 discussions