GithubHelp home page GithubHelp logo

Add Laravel to Nuxt about nuxt-laravel HOT 2 OPEN

m2sd avatar m2sd commented on July 18, 2024
Add Laravel to Nuxt

from nuxt-laravel.

Comments (2)

mentAl-maZe avatar mentAl-maZe commented on July 18, 2024 1

Hi @bitfactory-sarah-tammenga,

Let's clarify some things in advance:

PHP is a server side scripting language and, in production, will need to be set up properly through a web server and a process manager (e.g. nginx + php-fpm)
Consequently this module does not provide any means to serve a production ready PHP server. Please plan accordingly


The module disables Laravel support if it is unable to find the artisan PHP executable, which is located at the root of a Laravel project folder.
If you do not already have one please follow the following steps to create one (see https://laravel.com/docs/7.x/installation#installing-laravel):

  1. setup PHP and composer on your system (depending on which operating system you use this step may vary)
    Here are some resources to get you started:
  2. Globally install the laravel installer: composer require global laravel/installer
  3. Create a new laravel project: laravel new projectName
    Note: this will create a folder named projectName, containing a full laravel installation, under the current working directory (i.e. the folder form which the command was executed)

Once you have a laravel project setup you can direct this module to it's directory as follows:

In nuxt.config.js:

export default {
  // ...
  modules: [
    'nuxt-laravel'
    // ...
  ],
  // ...
  laravel: {
    // A relative path will be resolved relative to the current working directory (i.e. the directory you execute 'yarn dev' from
    root: 'relative/path/to/laravel/project/directory'
    // An absolute path (note the leading '/') will be used as is
   root: '/absolute/path/to/laravel/project/directory'
  }
}

After the root is set the module should work correctly.

from nuxt-laravel.

mentAl-maZe avatar mentAl-maZe commented on July 18, 2024

Also:
Laravel will not support this module natively, in order for Laravel to proxy calls to NuxtJS's internal router you need to configure a route (see: https://github.com/m2sd/nuxt-laravel#forwarding-all-undefined-routes-to-nuxt and mind the router.base setting in your nuxt.config.js, as this must be the prefix for any route which proxies to nuxt)

Alternatively (if you want to start fresh):
You can use the m2s/larave-nuxt plugin as descibed here: https://github.com/m2sd/nuxt-laravel#the-easy-way

from nuxt-laravel.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.