Last active
April 18, 2020 12:33
-
-
Save acro5piano/443802a58653617d73250e313a363bbb to your computer and use it in GitHub Desktop.
Laravel 5.4 と Vue.js 2.2 と JWTAuth で、ログインできる SPA アプリケーションのチュートリアル 1/4 ref: https://qiita.com/acro5piano/items/908cd751b2ea97e19be1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="{{ config('app.locale') }}"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Vue TODO</title> | |
<link rel="stylesheet" href="css/app.css"> | |
<script> | |
window.Laravel = {}; | |
window.Laravel.csrfToken = "{{ csrf_token() }}"; | |
</script> | |
</head> | |
<body> | |
<div id="app"> | |
<example></example> | |
</div> | |
</body> | |
<script src="js/app.js"></script> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('./bootstrap'); | |
Vue.component('example', require('./components/Example.vue')); | |
const app = new Vue({ | |
el: '#app' | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<h1>Hello, {{ name }}</h1> | |
</template> | |
<script> | |
export default { | |
data () { | |
return { | |
name: 'Kazuya' | |
} | |
}, | |
} | |
</script> | |
<style> | |
.h1 { | |
border-bottom: 1px; | |
} | |
</style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Hello, Kazuya</h1> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yarn run dev | |
php artisan serve |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yarn run dev | |
php artisan serve |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
composer create-project --prefer-dist laravel/laravel spa-todo 5.4 | |
cd spa-todo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
perl -i -pe 's/DB_.+\n//g' .env | |
echo 'DB_CONNECTION=sqlite' >> .env | |
touch database/database.sqlite | |
# DBのマイグレーションして動くことを確認 | |
php artisan migrate | |
# => Migrated: 2014_10_12_000000_create_users_table | |
# => Migrated: 2014_10_12_100000_create_password_resets_table |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# お好みでyarn使おう | |
npm install -g yarn | |
# vue-router 追加 | |
# npm install --save-dev vue-router でも一緒 | |
yarn add vue-router vue-spinner --dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yarn add cross-env --dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
|-- package.json | |
|-- resources | |
| |-- views | |
| | `-- app.blade.php | |
| `-- assets | |
| `-- js | |
| `-- app.js | |
`-- routes | |
`-- web.php |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
..., | |
"scripts": { | |
"dev": "cross-env.js ...", | |
"watch": "cross-env.js ...", | |
"hot": "cross-env.js ...", | |
"production": "cross-env.js ...", | |
}, | |
... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Route::get('/{any}', function () { | |
return view('app'); | |
})->where('any', '.*'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment