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
56
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
HDC tutorial
michielstock
2
880
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
Fireside Chat
paigeccino
43
4k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
870
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
500
Rebuilding a faster, lazier Slack
samanthasiow
85
9.6k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
260
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.2k
My Coaching Mixtape
mlcsv
0
320
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
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 } } } }