Ask, reply and learn. Join the community of Akaunting.
403 Forbidden When i create my custom controller and view?
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.
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']);
}
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.
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
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
hi Your problem solved ?
can you please guide me?
Showing 1 to 7 of 7 discussions