0

I am wanting to build a proof of concept, and I want some enlightment on the project structure, it will be a Laravel 10 project on the server, with a vue3 front-end. I am wanting to house it all within 1 Laravel application though.

/app - vue3 frontend /admin - L10 and blade backend (controlling thing like app settings, users etc) /api/ (for requests from the front end) - L10

There will obviously be authentication so the a user in the front end can speak with the api, I was thinking of using sanctum, but can I use this to also authenticate an admin user in Laravel/Blade admin area? Currently a bit confused how to drive the authentication.

1 Answer 1

0

I think it's a better idea to use Laravel's default folder structrure to make things easier for youself.

Sanctum authenticates sessions, not user permissions. So even if you make an API request as an admin from your Vuejs app, Laravel will not return any data unless you authenticate your app via Sanctum.

You should use middleware to check if user is allowed to reach any route. Basically you need both, but Blade has nothing to do with Sanctum because Blade works in server. Since it doesn't make API requests to your Backend, it doesn't require API authentication.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.