Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Webシステム開発事例 と GraphQL Server with Laravel
Search
@
November 30, 2019
58
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Webシステム開発事例 と GraphQL Server with Laravel
@
November 30, 2019
Featured
See All Featured
Marketing to machines
jonoalderson
1
5.9k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
630
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
940
Building Applications with DynamoDB
mza
96
7.2k
Darren the Foodie - Storyboard
khoart
PRO
4
4k
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
270
For a Future-Friendly Web
brad_frost
184
10k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
380
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3.1k
Building AI with AI
inesmontani
PRO
1
1.3k
Transcript
Webシステム開発事例 と GraphQL Server with Laravel 2019-11-30 atomita
琉球インタラクティブとは?
「日本を代表するインターネット企業になる」 を掲げ 求人マッチングサービス運営や、主に沖縄企業 を対象としたプロモーションプランニング、受 託開発などを手がけ 1つ1つの事業を成長させつつ、新しい事業にも 挑戦
Webシステム開発事例
御菓子御殿 お取り寄せショップ https://www.okashigoten.com/ 那覇空港旅客ターミナル オフィシャルサイト https://www.naha-airport.co.jp/ JOB ANTENNA https://www.jobantenna.jp/ ほかにもご興味ある方はこちら
PHP >> Node.js >> Go > Python
LaravelでGraphQL
https://github.com/search? q=laravel+graphql&type=Repositories folkloreinc/laravel-graphql nuwave/lighthouse rebing/graphql-laravel
Lighthouse-phpの良いところ
GraphQL Schema Definition Languageで schemaを定義 簡単にEloquent Model(ORM)と連携 Validationや、アクセス制限はLaravelの機能を 利用
Demo
ご静聴、ありがとうございまし た
おまけ
wget https://github.com/laradock/laradock/archive/v8.0.zip unzip v8.0.zip mv laradock-8.0 laradock cp laradock/env-example laradock/.env
sed -i -e 's/^\(APP_CODE_PATH_HOST=\).*$/\1..\/laravel/' laradock/.env sed -i -e 's/^\(DATA_PATH_HOST=\).*$/\1..\/data/' laradock/.env sed -i -e 's/^\(COMPOSE_PROJECT_NAME=\).*$/\1laradock_techplay20191130/' laradock/.env sed -i -e 's/^\(MYSQL_VERSION=\).*$/\15.7/' laradock/.env wget https://github.com/laravel/laravel/archive/v6.5.2.zip unzip v6.5.2.zip mv laravel-6.5.2 laravel cp laravel/.env.example laravel/.env sed -i -e 's/^\(DB_HOST=\).*$/\1mysql/' laravel/.env sed -i -e 's/^\(DB_DATABASE=\).*$/\1default/' laravel/.env sed -i -e 's/^\(DB_USERNAME=\).*$/\1default/' laravel/.env sed -i -e 's/^\(DB_PASSWORD=\).*$/\1secret/' laravel/.env (cd laradock; docker-compose up nginx mysql workspace) & (cd laradock; docker-compose exec --user=laradock workspace bash)
composer install php artisan key:generate composer require laravel/ui --dev php
artisan ui -n vue --auth php artisan migrate npm install && npm run dev
composer require nuwave/lighthouse php artisan vendor:publish --provider="Nuwave\Lighthouse\LighthouseServiceProvider" --tag=schema php artisan
vendor:publish --provider="Nuwave\Lighthouse\LighthouseServiceProvider" --tag=config sed -i -e 's/\('\''middleware'\''.*\)/\1\n \\Illuminate\\Session\\Middleware\\StartSession::class,/' config/lighthouse.php sed -i -e 's/\('\''middleware'\''.*\)/\1\n \\Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse::class,/' config/lighthouse.php sed -i -e 's/\('\''middleware'\''.*\)/\1\n \\App\\Http\\Middleware\\EncryptCookies::class,/' config/lighthouse.php composer require mll-lab/laravel-graphql-playground
cat << 'EOF' > database/migrations/2019_11_30_000000_create_posts_table.php <?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; class CreatePostsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('posts', function (Blueprint $table) { $table->bigIncrements('id'); $table->text('title'); $table->text('contents'); $table->unsignedBigInteger('user_id')->nullable(); $table->timestamps(); $table->foreign('user_id')->references('id')->on('users')->onDelete('set null'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('posts'); } } EOF
cat << 'EOF' > app/Post.php <?php namespace App; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; class Post extends Model { protected $fillable = ['title', 'contents', 'user_id']; public function user(): BelongsTo { return $this->belongsTo(User::class); } } EOF
cat << 'EOF' >> graphql/schema.graphql type Mutation extend type Query
{ posts: [Post!]! @paginate(defaultCount: 10) post(id: ID @eq): Post @find } type Post { id: ID! title: String! contents: String! created_at: DateTime! updated_at: DateTime! user: User @belongsTo } extend type Mutation { createPost( title: String! contents: String! ): Post @create @inject(context: "user.id", name: "user_id") } EOF
php artisan migrate
open http://localhost/graphql-playground # setting # "request.credentials": "same-origin" # mutation {
createPost(title: "bar" contents: "baz") { id } } # query { posts { data { id title contents created_at updated_at user { id name } } } }