Git Product home page Git Product logo

laravel-vue-scaffold's Introduction

Larvel VueJS~Vuetify Starter Project For Experienced Users

Laravel Vue-cli scaffolded project with Vuetify UI library. NOTE:This application scaffold inspired by darryldecode's laravel-starter-kit

application

Clone Repository

git clone https://github.com/ashkan90/Laravel-Vue-Scaffold.git 
cd Laravel-Vue-Scaffold

Install requires

composer install
cd frontend
npm install

Vue-cli used to deal with API

Most common supply from developers for using Vue with Laravel's API In this scaffold is needed to use CORS to deal with API. So you can change your local settings for CORS.

CORS Middleware

Located at: App\Http\Middleware\Cors

public function handle($request, Closure $next)
    {
        if($request->server('HTTP_ORIGIN')) {
            $origin = $request->server('HTTP_ORIGIN');
            
            $domain = Domain::where("domain", $origin)->get();
            if($domain) {
                header('Access-Control-Allow-Origin: ' . $origin);
                header('Access-Control-Allow-Headers: Origin, Content-Type');
            }
        }

        return $next($request);
    }

As you can see, we need to make sure that we've inserted our local urls to 'Domain' Model.

Domain Model

public function up()
    {
        Schema::create('domains', function (Blueprint $table) {
            $table->increments('id');
            $table->string('domain', 150)->unique();
            $table->timestamps();
        });
    }

Absolutely we've to seed our local urls before we started to develop something great!

Seed Them!

$domains = ["http://127.0.0.1:8000", "http://192.168.1.30:8080"];

foreach ($domains as $domain) {
    App\Domain::create(["domain" => $domain]);
}

Settings up

php artisan migrate
php artisan db:seed

Playground

php artisan serve
cd frontend
npm run serve

laravel-vue-scaffold's People

Contributors

ashkan90 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

laravel-vue-scaffold's Issues

Vendor DIR in .gitignore

Hello,

This repo cannot be used as directed in the instructions due to the "vendor" directory being in the .gitignore.

Easily correctable but for those who are following the instructions to a "T" it will not work and will throw errors such as: PHP Warning: require(C:\code\crm/vendor/autoload.php): failed to open stream: No such file or directory in C:\code\crm\artisan on line 18.

Cheers

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.