F
F
fiter2017-05-12 20:25:44
Laravel
fiter, 2017-05-12 20:25:44

How to properly build a SPA on Laravel + vue.js?

Hello!
I’m not catching up a bit on how to properly organize a multilingual SPA on Laravel and vue.js
As I understand it, for views, instead of * .blade.php, you need to use * .vue files ...
But they can’t be run through laravel in any way, how then to use them in them language strings and basically php variables?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
Timofey, 2017-05-13
@fiter

Blade templates are processed exclusively by the server, while vue files are collected by the build system and end up in js / css / ..., which are included on the page already loaded by the browser.
If you have a SPA, then there may not be blade templates at all (or there will simply be one, but without content, since all content will be created on the client using vue).
As a result, multilingualism can be implemented either by the client JavaScript code, or by loading data through the API specifying the desired language. The options, of course, are not mutually exclusive :)
Accordingly, when calling API functions, you will also need to transfer the desired language in some way. For example, in cookies, session, or in general in an additional request parameter.

G
GiperScriper, 2017-05-12
@GiperScriper

api on laravel, ui on vuejs, json communication back and forth, consider 2 different applications

S
shelomanovd, 2017-05-21
@shelomanovd

Server A is a client. Server B - back. Rest API

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question