Neewd

Experience

170

0 Best Reply Awards

  • Member Since 1 Month Ago
  • 1 Lesson Completed
  • 0 Favorites

15th June, 2018

Neewd left a reply on Laravel + Vue : Routes On Web.php / Api.php • 1 week ago

If I want to use the CreateFreshApiToken, it comes from Passport, how I can use this without Passport ? :o

I have another question about the consumption of my API through my javascript framework. I put my API routes in my 'api.php', and my web routes - and Auth::routes in my web.php. The CreateFreshApiToken middleware will be add to the web groups middleware, so when I'll make a login, the reply will contains a token, and when I will make an axios call to my API, I have to send the X-CSRF-TOKEN and the width in the headers, and all gonna be right, right ?

Neewd left a reply on Laravel + Vue : Routes On Web.php / Api.php • 1 week ago

Hello,

Thanks you both for your answers. My need is to call my API in the front-end via Vue.js, if I put my ::resource routes on the api.php, and if I use the CreateFreshApiToken for my API auth, that fills my need no ? https://laravel.com/docs/5.6/passport#consuming-your-api-with-javascript

14th June, 2018

Neewd started a new conversation Laravel + Vue : Routes On Web.php / Api.php • 1 week ago

Hello guys,

I am quite a new guy on Laravel and I have started working on a project, and I would like get some advice about the good architecture to pick.

I decided to manage my front with Vue and my backend with Laravel.

What I have started to do is to capture the routes through Laravel and sent it to my Vue routes to determines which components to load etc. And I was thinking to make "api" calls though axios into my Vue.components to retrieve the data from my controller in order to display them into my view.

That's still a "web" logic.

But I am also thinking to the future API I will provide.

So what is the best option to take ?

Put some Route::resource('model', 'Controller') into the web.php file, then call those routes in my Vue.components, and put the Route::resource('model','Controller') into my api.php file ?

Thank you for your answer I don't know if I am going the right way or not.

Clément.

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.