Ask, reply and learn. Join the community of Akaunting.
I am a newbie to Laravel (started learning few days ago) and trying to create a `Module/Package` with it.
I have created a `Resource` Route with `Main` Controller through Admin route as
Route::admin('bank-statement', function () {
Route::resource('statement', 'Main')->except(['index', 'create', 'show', 'store', 'destroy']);
Route::get('statement/print/{account}', 'Main@printStatement');
});
When I try to access above route
example.com/3/bank-statement/statement/2/edit \\3 is company id and 2 is account id
it throws `403 Access Forbidden Error`. Whilst, if I try to access
example.com/3/bank-statement/statement/print/2
it works good.
My `Main` controller is as follow
namespace Modules\BankStatement\Http\Controllers;
use App\Abstracts\Http\Controller;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class Main extends Controller
{
public function edit($id)
{
echo 'I am about return a View';
}
public function printStatement($id)
{
echo 'I am about to Print';
}
}
What is wrong here? Why it throws 403 Error when accessed through a Resource while working good with simple get? Yes, I am accessing after Logging-in.
I found a similar question here https://laracasts.com/discuss/channels/requests/403-when-using-resource-controller but it doesn't solve the issue
I just found that all of default methods like edit/update/create/store etc created by artisan command are throwing 403 error while any custom method like printStatement created in Main controller works good
Showing 1 to 2 of 2 discussions