├── .gitignore ├── README.md ├── apis ├── movies │ ├── .env.example │ ├── .gitattributes │ ├── .gitignore │ ├── app │ │ ├── Console │ │ │ ├── Commands │ │ │ │ └── Inspire.php │ │ │ └── Kernel.php │ │ ├── Events │ │ │ └── Event.php │ │ ├── Exceptions │ │ │ └── Handler.php │ │ ├── Http │ │ │ ├── Controllers │ │ │ │ ├── Api │ │ │ │ │ └── MoviesController.php │ │ │ │ ├── Auth │ │ │ │ │ ├── AuthController.php │ │ │ │ │ └── PasswordController.php │ │ │ │ └── Controller.php │ │ │ ├── Kernel.php │ │ │ ├── Middleware │ │ │ │ ├── Authenticate.php │ │ │ │ ├── EncryptCookies.php │ │ │ │ ├── RedirectIfAuthenticated.php │ │ │ │ └── VerifyCsrfToken.php │ │ │ ├── Requests │ │ │ │ └── Request.php │ │ │ └── routes.php │ │ ├── Jobs │ │ │ └── Job.php │ │ ├── Listeners │ │ │ └── .gitkeep │ │ ├── Movie.php │ │ ├── Policies │ │ │ └── .gitkeep │ │ ├── Providers │ │ │ ├── AppServiceProvider.php │ │ │ ├── AuthServiceProvider.php │ │ │ ├── EventServiceProvider.php │ │ │ └── RouteServiceProvider.php │ │ └── User.php │ ├── artisan │ ├── bootstrap │ │ ├── app.php │ │ ├── autoload.php │ │ └── cache │ │ │ └── .gitignore │ ├── composer.json │ ├── composer.lock │ ├── config │ │ ├── app.php │ │ ├── auth.php │ │ ├── broadcasting.php │ │ ├── cache.php │ │ ├── compile.php │ │ ├── database.php │ │ ├── filesystems.php │ │ ├── mail.php │ │ ├── queue.php │ │ ├── services.php │ │ ├── session.php │ │ └── view.php │ ├── database.sqlite │ ├── database │ │ ├── .gitignore │ │ ├── factories │ │ │ └── ModelFactory.php │ │ ├── migrations │ │ │ ├── .gitkeep │ │ │ ├── 2014_10_12_000000_create_users_table.php │ │ │ ├── 2014_10_12_100000_create_password_resets_table.php │ │ │ └── 2016_03_10_045354_create_movies_table.php │ │ └── seeds │ │ │ ├── .gitkeep │ │ │ ├── DatabaseSeeder.php │ │ │ └── MovieSeeder.php │ ├── gulpfile.js │ ├── package.json │ ├── phpunit.xml │ ├── public │ │ ├── .htaccess │ │ ├── favicon.ico │ │ ├── index.php │ │ ├── js │ │ │ └── app.js │ │ ├── movies.html │ │ ├── robots.txt │ │ └── web.config │ ├── readme.md │ ├── resources │ │ ├── assets │ │ │ └── sass │ │ │ │ └── app.scss │ │ ├── lang │ │ │ └── en │ │ │ │ ├── auth.php │ │ │ │ ├── pagination.php │ │ │ │ ├── passwords.php │ │ │ │ └── validation.php │ │ └── views │ │ │ ├── errors │ │ │ └── 503.blade.php │ │ │ ├── vendor │ │ │ └── .gitkeep │ │ │ └── welcome.blade.php │ ├── server.php │ ├── setup.sh │ ├── storage │ │ ├── app │ │ │ ├── .gitignore │ │ │ └── public │ │ │ │ └── .gitignore │ │ ├── framework │ │ │ ├── .gitignore │ │ │ ├── cache │ │ │ │ └── .gitignore │ │ │ ├── sessions │ │ │ │ └── .gitignore │ │ │ └── views │ │ │ │ └── .gitignore │ │ └── logs │ │ │ └── .gitignore │ └── tests │ │ ├── ExampleTest.php │ │ └── TestCase.php ├── pagination │ └── stories │ │ ├── .env.example │ │ ├── .gitattributes │ │ ├── .gitignore │ │ ├── app │ │ ├── Console │ │ │ ├── Commands │ │ │ │ └── Inspire.php │ │ │ └── Kernel.php │ │ ├── Events │ │ │ └── Event.php │ │ ├── Exceptions │ │ │ └── Handler.php │ │ ├── Http │ │ │ ├── Controllers │ │ │ │ ├── Api │ │ │ │ │ └── StoriesController.php │ │ │ │ ├── Auth │ │ │ │ │ ├── AuthController.php │ │ │ │ │ └── PasswordController.php │ │ │ │ └── Controller.php │ │ │ ├── Kernel.php │ │ │ ├── Middleware │ │ │ │ ├── Authenticate.php │ │ │ │ ├── EncryptCookies.php │ │ │ │ ├── RedirectIfAuthenticated.php │ │ │ │ └── VerifyCsrfToken.php │ │ │ ├── Requests │ │ │ │ └── Request.php │ │ │ └── routes.php │ │ ├── Jobs │ │ │ └── Job.php │ │ ├── Listeners │ │ │ └── .gitkeep │ │ ├── Policies │ │ │ └── .gitkeep │ │ ├── Providers │ │ │ ├── AppServiceProvider.php │ │ │ ├── AuthServiceProvider.php │ │ │ ├── EventServiceProvider.php │ │ │ └── RouteServiceProvider.php │ │ ├── Story.php │ │ └── User.php │ │ ├── artisan │ │ ├── bootstrap │ │ ├── app.php │ │ ├── autoload.php │ │ └── cache │ │ │ └── .gitignore │ │ ├── composer.json │ │ ├── composer.lock │ │ ├── config │ │ ├── app.php │ │ ├── auth.php │ │ ├── broadcasting.php │ │ ├── cache.php │ │ ├── compile.php │ │ ├── database.php │ │ ├── filesystems.php │ │ ├── mail.php │ │ ├── queue.php │ │ ├── services.php │ │ ├── session.php │ │ └── view.php │ │ ├── database.sqlite │ │ ├── database │ │ ├── .gitignore │ │ ├── factories │ │ │ └── ModelFactory.php │ │ ├── migrations │ │ │ ├── .gitkeep │ │ │ ├── 2014_10_12_000000_create_users_table.php │ │ │ ├── 2014_10_12_100000_create_password_resets_table.php │ │ │ └── 2016_03_10_045354_create_stories_table.php │ │ └── seeds │ │ │ ├── .gitkeep │ │ │ ├── DatabaseSeeder.php │ │ │ └── StorySeeder.php │ │ ├── gulpfile.js │ │ ├── package.json │ │ ├── phpunit.xml │ │ ├── public │ │ ├── .htaccess │ │ ├── favicon.ico │ │ ├── index.php │ │ ├── js │ │ │ └── app.js │ │ ├── robots.txt │ │ ├── stories.html │ │ └── web.config │ │ ├── readme.md │ │ ├── resources │ │ ├── assets │ │ │ └── sass │ │ │ │ └── app.scss │ │ ├── lang │ │ │ └── en │ │ │ │ ├── auth.php │ │ │ │ ├── pagination.php │ │ │ │ ├── passwords.php │ │ │ │ └── validation.php │ │ └── views │ │ │ ├── errors │ │ │ └── 503.blade.php │ │ │ ├── vendor │ │ │ └── .gitkeep │ │ │ └── welcome.blade.php │ │ ├── server.php │ │ ├── setup.sh │ │ ├── storage │ │ ├── app │ │ │ ├── .gitignore │ │ │ └── public │ │ │ │ └── .gitignore │ │ ├── framework │ │ │ ├── .gitignore │ │ │ ├── cache │ │ │ │ └── .gitignore │ │ │ ├── sessions │ │ │ │ └── .gitignore │ │ │ └── views │ │ │ │ └── .gitignore │ │ └── logs │ │ │ └── .gitignore │ │ └── tests │ │ ├── ExampleTest.php │ │ └── TestCase.php └── stories │ ├── .env.example │ ├── .gitattributes │ ├── .gitignore │ ├── app │ ├── Console │ │ ├── Commands │ │ │ └── Inspire.php │ │ └── Kernel.php │ ├── Events │ │ └── Event.php │ ├── Exceptions │ │ └── Handler.php │ ├── Http │ │ ├── Controllers │ │ │ ├── Api │ │ │ │ └── StoriesController.php │ │ │ ├── Auth │ │ │ │ ├── AuthController.php │ │ │ │ └── PasswordController.php │ │ │ └── Controller.php │ │ ├── Kernel.php │ │ ├── Middleware │ │ │ ├── Authenticate.php │ │ │ ├── EncryptCookies.php │ │ │ ├── RedirectIfAuthenticated.php │ │ │ └── VerifyCsrfToken.php │ │ ├── Requests │ │ │ └── Request.php │ │ └── routes.php │ ├── Jobs │ │ └── Job.php │ ├── Listeners │ │ └── .gitkeep │ ├── Policies │ │ └── .gitkeep │ ├── Providers │ │ ├── AppServiceProvider.php │ │ ├── AuthServiceProvider.php │ │ ├── EventServiceProvider.php │ │ └── RouteServiceProvider.php │ ├── Story.php │ └── User.php │ ├── artisan │ ├── bootstrap │ ├── app.php │ ├── autoload.php │ └── cache │ │ └── .gitignore │ ├── composer.json │ ├── composer.lock │ ├── config │ ├── app.php │ ├── auth.php │ ├── broadcasting.php │ ├── cache.php │ ├── compile.php │ ├── database.php │ ├── filesystems.php │ ├── mail.php │ ├── queue.php │ ├── services.php │ ├── session.php │ └── view.php │ ├── database.sqlite │ ├── database │ ├── .gitignore │ ├── factories │ │ └── ModelFactory.php │ ├── migrations │ │ ├── .gitkeep │ │ ├── 2014_10_12_000000_create_users_table.php │ │ ├── 2014_10_12_100000_create_password_resets_table.php │ │ └── 2016_03_10_045354_create_stories_table.php │ └── seeds │ │ ├── .gitkeep │ │ ├── DatabaseSeeder.php │ │ └── StorySeeder.php │ ├── gulpfile.js │ ├── package.json │ ├── phpunit.xml │ ├── public │ ├── .htaccess │ ├── favicon.ico │ ├── index.php │ ├── js │ │ └── app.js │ ├── robots.txt │ ├── stories.html │ └── web.config │ ├── readme.md │ ├── resources │ ├── assets │ │ └── sass │ │ │ └── app.scss │ ├── lang │ │ └── en │ │ │ ├── auth.php │ │ │ ├── pagination.php │ │ │ ├── passwords.php │ │ │ └── validation.php │ └── views │ │ ├── errors │ │ └── 503.blade.php │ │ ├── vendor │ │ └── .gitkeep │ │ └── welcome.blade.php │ ├── server.php │ ├── setup.sh │ ├── storage │ ├── app │ │ ├── .gitignore │ │ └── public │ │ │ └── .gitignore │ ├── framework │ │ ├── .gitignore │ │ ├── cache │ │ │ └── .gitignore │ │ ├── sessions │ │ │ └── .gitignore │ │ └── views │ │ │ └── .gitignore │ └── logs │ │ └── .gitignore │ └── tests │ ├── ExampleTest.php │ └── TestCase.php ├── examples ├── 10. Integrating vue-resource │ ├── app.js │ └── stories.html ├── 11. Pagination │ ├── app.js │ └── stories.html ├── 14. Mastering Single File Components │ ├── 14.3 forming vue files │ │ ├── .babelrc │ │ ├── .editorconfig │ │ ├── .eslintignore │ │ ├── .eslintrc.js │ │ ├── .gitignore │ │ ├── README.md │ │ ├── build │ │ │ ├── build.js │ │ │ ├── dev-client.js │ │ │ ├── dev-server.js │ │ │ ├── utils.js │ │ │ ├── webpack.base.conf.js │ │ │ ├── webpack.dev.conf.js │ │ │ └── webpack.prod.conf.js │ │ ├── config │ │ │ ├── dev.env.js │ │ │ ├── index.js │ │ │ ├── prod.env.js │ │ │ └── test.env.js │ │ ├── index.html │ │ ├── package.json │ │ ├── src │ │ │ ├── App.vue │ │ │ ├── assets │ │ │ │ └── logo.png │ │ │ ├── components │ │ │ │ ├── Famous.vue │ │ │ │ ├── Hello.vue │ │ │ │ ├── Login.vue │ │ │ │ ├── Register.vue │ │ │ │ └── Stories.vue │ │ │ └── main.js │ │ └── static │ │ │ └── .gitkeep │ ├── 14.4 Eliminating Duplicate State │ │ └── src │ │ │ ├── App.vue │ │ │ ├── assets │ │ │ └── logo.png │ │ │ ├── components │ │ │ ├── Famous.vue │ │ │ ├── Hello.vue │ │ │ ├── Login.vue │ │ │ ├── Register.vue │ │ │ └── Stories.vue │ │ │ └── main.js │ └── 14.4.2 Global Store │ │ └── src │ │ ├── App.vue │ │ ├── assets │ │ └── logo.png │ │ ├── components │ │ ├── Famous.vue │ │ ├── Hello.vue │ │ ├── Login.vue │ │ ├── Register.vue │ │ └── Stories.vue │ │ ├── main.js │ │ └── store.js ├── 15. Swapping Components │ └── App.vue ├── 16. Vue router │ ├── 16.2 Usage │ │ ├── App.vue │ │ └── main.js │ ├── 16.3 Nested Router │ │ ├── App.vue │ │ ├── Stories.vue │ │ └── main.js │ └── 16.4 Route Matching │ │ ├── 16.4.1 Named Routes │ │ ├── App.vue │ │ └── main.js │ │ ├── 16.4.2 Route Object │ │ ├── App.vue │ │ ├── Edit.vue │ │ ├── Stories.vue │ │ └── main.js │ │ ├── 16.4.4 Route Alias │ │ └── main.js │ │ ├── 16.4.5 Route Go │ │ └── Edit.vue │ │ └── 16.4.6 Filtering Transitions │ │ └── main.js ├── 2. Getting started │ └── 2.2-two-way-binding.html ├── 3. A Flavor Of Directives │ ├── 3.1-v-show.html │ ├── 3.2-template-v-if.html │ └── 3.3-v-if-v-else.html ├── 4. List Rendering │ ├── 4.2.1-range-v-for.html │ ├── 4.3.1-loop-through-array.html │ ├── 4.4-object-v-for.html │ ├── 4.5-filter-by.html │ ├── 4.6-ordered-results.html │ ├── 4.7-custom-filter.html │ └── query-search.html ├── 5. Interactivity │ ├── 5.1.2-methodHandler-v-on.html │ ├── 5.2-calculatorpreventDefault.html │ ├── 5.4-calculator-computed-properties.html │ └── 5.4.1-Computed-Properties-Filter-Array.html ├── 6. Components │ ├── 6.2-single-component.html │ ├── 6.4-component-properties.html │ ├── 6.6-end-result.html │ └── 6.6-stories-component.html └── 7. Class and Style Bindings │ ├── 7.1.1-flip-color.html │ ├── 7.2.1-style-binding-object.html │ ├── 7.2.2-style-binding-array.html │ └── 7.3-bindings-in-action.html └── homework ├── chapter10 ├── js │ └── app.js └── movies.html ├── chapter13 ├── chapter13.1 │ ├── .babelrc │ ├── .gitignore │ ├── assets │ │ └── js │ │ │ └── ninja.js │ ├── index.html │ ├── package.json │ ├── readme.md │ └── src │ │ └── ninja.js └── chapter13.2 │ ├── .babelrc │ ├── .gitignore │ ├── assets │ └── js │ │ └── ninja.js │ ├── gulpfile.js │ ├── index.html │ ├── package.json │ ├── readme.md │ └── src │ └── ninja.js ├── chapter16 ├── .babelrc ├── .editorconfig ├── .eslintignore ├── .gitignore ├── README.md ├── build │ ├── build.js │ ├── dev-client.js │ ├── dev-server.js │ ├── utils.js │ ├── webpack.base.conf.js │ ├── webpack.dev.conf.js │ └── webpack.prod.conf.js ├── config │ ├── dev.env.js │ ├── index.js │ ├── prod.env.js │ └── test.env.js ├── index.html ├── package.json ├── src │ ├── App.vue │ ├── components │ │ ├── Category.vue │ │ ├── Create.vue │ │ └── Home.vue │ ├── main.js │ └── pokedex.js └── static │ └── .gitkeep ├── chapter2.html ├── chapter3.html ├── chapter4.html ├── chapter5.html ├── chapter6.html └── chapter7.html /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # The Majesty of Vuejs 2 | 3 | [![Book Cover](https://s3.amazonaws.com/titlepages.leanpub.com/vuejs/large?1458613635)](https://leanpub.com/vuejs) 4 | 5 | This repo is for educational use. 6 | 7 | It contains demo apis, homework solutions and the code examples of my book, [The Majesty of Vue.js](https://leanpub.com/vuejs). 8 | -------------------------------------------------------------------------------- /apis/movies/.env.example: -------------------------------------------------------------------------------- 1 | APP_ENV=local 2 | APP_DEBUG=true 3 | APP_KEY=SomeRandomString 4 | APP_URL=http://localhost 5 | 6 | DB_HOST=127.0.0.1 7 | DB_PORT=3306 8 | DB_DATABASE=homestead 9 | DB_USERNAME=homestead 10 | DB_PASSWORD=secret 11 | 12 | CACHE_DRIVER=file 13 | SESSION_DRIVER=file 14 | QUEUE_DRIVER=sync 15 | 16 | REDIS_HOST=127.0.0.1 17 | REDIS_PASSWORD=null 18 | REDIS_PORT=6379 19 | 20 | MAIL_DRIVER=smtp 21 | MAIL_HOST=mailtrap.io 22 | MAIL_PORT=2525 23 | MAIL_USERNAME=null 24 | MAIL_PASSWORD=null 25 | MAIL_ENCRYPTION=null 26 | -------------------------------------------------------------------------------- /apis/movies/.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.css linguist-vendored 3 | *.less linguist-vendored 4 | -------------------------------------------------------------------------------- /apis/movies/.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | /node_modules 3 | /public/storage 4 | Homestead.yaml 5 | Homestead.json 6 | .env 7 | -------------------------------------------------------------------------------- /apis/movies/app/Console/Commands/Inspire.php: -------------------------------------------------------------------------------- 1 | comment(PHP_EOL.Inspiring::quote().PHP_EOL); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /apis/movies/app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire') 28 | // ->hourly(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /apis/movies/app/Events/Event.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /apis/movies/app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | guest()) { 21 | if ($request->ajax() || $request->wantsJson()) { 22 | return response('Unauthorized.', 401); 23 | } else { 24 | return redirect()->guest('login'); 25 | } 26 | } 27 | 28 | return $next($request); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /apis/movies/app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | check()) { 21 | return redirect('/'); 22 | } 23 | 24 | return $next($request); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /apis/movies/app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | 'api'], function () { 30 | Route::resource('movies', 'Api\MoviesController'); 31 | }); 32 | -------------------------------------------------------------------------------- /apis/movies/app/Jobs/Job.php: -------------------------------------------------------------------------------- 1 | [ 15 | 'code' => 'ERR-NOTFOUND', 16 | 'http_code' => '404', 17 | 'message' => 'Requested movie cannot be found in the database.', 18 | ] 19 | ]; 20 | return \Response::json($error, 404); 21 | } 22 | return $story; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /apis/movies/app/Policies/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /apis/movies/app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | 'App\Policies\ModelPolicy', 17 | ]; 18 | 19 | /** 20 | * Register any application authentication / authorization services. 21 | * 22 | * @param \Illuminate\Contracts\Auth\Access\Gate $gate 23 | * @return void 24 | */ 25 | public function boot(GateContract $gate) 26 | { 27 | $this->registerPolicies($gate); 28 | 29 | // 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /apis/movies/app/Providers/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'App\Listeners\EventListener', 18 | ], 19 | ]; 20 | 21 | /** 22 | * Register any other events for your application. 23 | * 24 | * @param \Illuminate\Contracts\Events\Dispatcher $events 25 | * @return void 26 | */ 27 | public function boot(DispatcherContract $events) 28 | { 29 | parent::boot($events); 30 | 31 | // 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /apis/movies/app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | group(['namespace' => $this->namespace], function ($router) { 41 | require app_path('Http/routes.php'); 42 | }); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /apis/movies/app/User.php: -------------------------------------------------------------------------------- 1 | =5.5.9", 9 | "laravel/framework": "5.2.*" 10 | }, 11 | "require-dev": { 12 | "fzaninotto/faker": "~1.4", 13 | "mockery/mockery": "0.9.*", 14 | "phpunit/phpunit": "~4.0", 15 | "symfony/css-selector": "2.8.*|3.0.*", 16 | "symfony/dom-crawler": "2.8.*|3.0.*" 17 | }, 18 | "autoload": { 19 | "classmap": [ 20 | "database" 21 | ], 22 | "psr-4": { 23 | "App\\": "app/" 24 | } 25 | }, 26 | "autoload-dev": { 27 | "classmap": [ 28 | "tests/TestCase.php" 29 | ] 30 | }, 31 | "scripts": { 32 | "post-root-package-install": [ 33 | "php -r \"copy('.env.example', '.env');\"" 34 | ], 35 | "post-create-project-cmd": [ 36 | "php artisan key:generate" 37 | ], 38 | "post-install-cmd": [ 39 | "php artisan clear-compiled", 40 | "php artisan optimize" 41 | ], 42 | "pre-update-cmd": [ 43 | "php artisan clear-compiled" 44 | ], 45 | "post-update-cmd": [ 46 | "php artisan optimize" 47 | ] 48 | }, 49 | "config": { 50 | "preferred-install": "dist" 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /apis/movies/config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'pusher'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Broadcast Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may define all of the broadcast connections that will be used 24 | | to broadcast events to other systems or over websockets. Samples of 25 | | each available type of connection are provided inside this array. 26 | | 27 | */ 28 | 29 | 'connections' => [ 30 | 31 | 'pusher' => [ 32 | 'driver' => 'pusher', 33 | 'key' => env('PUSHER_KEY'), 34 | 'secret' => env('PUSHER_SECRET'), 35 | 'app_id' => env('PUSHER_APP_ID'), 36 | 'options' => [ 37 | // 38 | ], 39 | ], 40 | 41 | 'redis' => [ 42 | 'driver' => 'redis', 43 | 'connection' => 'default', 44 | ], 45 | 46 | 'log' => [ 47 | 'driver' => 'log', 48 | ], 49 | 50 | ], 51 | 52 | ]; 53 | -------------------------------------------------------------------------------- /apis/movies/config/compile.php: -------------------------------------------------------------------------------- 1 | [ 17 | // 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled File Providers 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may list service providers which define a "compiles" function 26 | | that returns additional files that should be compiled, providing an 27 | | easy way to get common files from any packages you are utilizing. 28 | | 29 | */ 30 | 31 | 'providers' => [ 32 | // 33 | ], 34 | 35 | ]; 36 | -------------------------------------------------------------------------------- /apis/movies/config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | ], 21 | 22 | 'ses' => [ 23 | 'key' => env('SES_KEY'), 24 | 'secret' => env('SES_SECRET'), 25 | 'region' => 'us-east-1', 26 | ], 27 | 28 | 'sparkpost' => [ 29 | 'secret' => env('SPARKPOST_SECRET'), 30 | ], 31 | 32 | 'stripe' => [ 33 | 'model' => App\User::class, 34 | 'key' => env('STRIPE_KEY'), 35 | 'secret' => env('STRIPE_SECRET'), 36 | ], 37 | 38 | ]; 39 | -------------------------------------------------------------------------------- /apis/movies/config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | realpath(base_path('resources/views')), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => realpath(storage_path('framework/views')), 32 | 33 | ]; 34 | -------------------------------------------------------------------------------- /apis/movies/database.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hootlex/the-majesty-of-vuejs/30bd16d6ccd51c26f2e120ac099469844a14bdb4/apis/movies/database.sqlite -------------------------------------------------------------------------------- /apis/movies/database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite 2 | -------------------------------------------------------------------------------- /apis/movies/database/migrations/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /apis/movies/database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->string('name'); 18 | $table->string('email')->unique(); 19 | $table->string('password'); 20 | $table->rememberToken(); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::drop('users'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /apis/movies/database/migrations/2014_10_12_100000_create_password_resets_table.php: -------------------------------------------------------------------------------- 1 | string('email')->index(); 17 | $table->string('token')->index(); 18 | $table->timestamp('created_at'); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | * 25 | * @return void 26 | */ 27 | public function down() 28 | { 29 | Schema::drop('password_resets'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /apis/movies/database/migrations/2016_03_10_045354_create_movies_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->string('title'); 18 | $table->string('director'); 19 | $table->timestamps(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::table('movies', function (Blueprint $table) { 31 | Schema::drop('movies'); 32 | }); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /apis/movies/database/seeds/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /apis/movies/database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call(MovieSeeder::class); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /apis/movies/database/seeds/MovieSeeder.php: -------------------------------------------------------------------------------- 1 | truncate(); 15 | factory(App\Movie::class, 20)->create(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /apis/movies/gulpfile.js: -------------------------------------------------------------------------------- 1 | var elixir = require('laravel-elixir'); 2 | 3 | /* 4 | |-------------------------------------------------------------------------- 5 | | Elixir Asset Management 6 | |-------------------------------------------------------------------------- 7 | | 8 | | Elixir provides a clean, fluent API for defining some basic Gulp tasks 9 | | for your Laravel application. By default, we are compiling the Sass 10 | | file for our application, as well as publishing vendor resources. 11 | | 12 | */ 13 | 14 | elixir(function(mix) { 15 | mix.sass('app.scss'); 16 | }); 17 | -------------------------------------------------------------------------------- /apis/movies/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "devDependencies": { 4 | "gulp": "^3.8.8" 5 | }, 6 | "dependencies": { 7 | "laravel-elixir": "^4.0.0", 8 | "bootstrap-sass": "^3.0.0" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /apis/movies/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | ./tests/ 14 | 15 | 16 | 17 | 18 | app/ 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /apis/movies/public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Redirect Trailing Slashes If Not A Folder... 9 | RewriteCond %{REQUEST_FILENAME} !-d 10 | RewriteRule ^(.*)/$ /$1 [L,R=301] 11 | 12 | # Handle Front Controller... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_FILENAME} !-f 15 | RewriteRule ^ index.php [L] 16 | 17 | # Handle Authorization Header 18 | RewriteCond %{HTTP:Authorization} . 19 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 20 | 21 | -------------------------------------------------------------------------------- /apis/movies/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hootlex/the-majesty-of-vuejs/30bd16d6ccd51c26f2e120ac099469844a14bdb4/apis/movies/public/favicon.ico -------------------------------------------------------------------------------- /apis/movies/public/js/app.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hootlex/the-majesty-of-vuejs/30bd16d6ccd51c26f2e120ac099469844a14bdb4/apis/movies/public/js/app.js -------------------------------------------------------------------------------- /apis/movies/public/movies.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hootlex/the-majesty-of-vuejs/30bd16d6ccd51c26f2e120ac099469844a14bdb4/apis/movies/public/movies.html -------------------------------------------------------------------------------- /apis/movies/public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /apis/movies/public/web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /apis/movies/readme.md: -------------------------------------------------------------------------------- 1 | This is the API used in the "Consuming an API" part of the book, in its homework section and it is intended for educational use. 2 | 3 | By running the following command you will get a database filled with dummy data and a fully functional API. 4 | 5 | ```bash 6 | sh setup.sh 7 | ``` 8 | 9 | Then you will be able to access the site on `http://localhost:3000`. 10 | 11 | This API is built with [Laravel](http://laravel.com) 12 | -------------------------------------------------------------------------------- /apis/movies/resources/assets/sass/app.scss: -------------------------------------------------------------------------------- 1 | // @import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap"; 2 | 3 | -------------------------------------------------------------------------------- /apis/movies/resources/lang/en/auth.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /apis/movies/resources/lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /apis/movies/resources/lang/en/passwords.php: -------------------------------------------------------------------------------- 1 | 'Passwords must be at least six characters and match the confirmation.', 17 | 'reset' => 'Your password has been reset!', 18 | 'sent' => 'We have e-mailed your password reset link!', 19 | 'token' => 'This password reset token is invalid.', 20 | 'user' => "We can't find a user with that e-mail address.", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /apis/movies/resources/views/errors/503.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Be right back. 5 | 6 | 7 | 8 | 39 | 40 | 41 |
42 |
43 |
Be right back.
44 |
45 |
46 | 47 | 48 | -------------------------------------------------------------------------------- /apis/movies/resources/views/vendor/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /apis/movies/resources/views/welcome.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Laravel 5 | 6 | 7 | 8 | 37 | 38 | 39 |
40 |
41 |
Laravel 5
42 |
43 |
44 | 45 | 46 | -------------------------------------------------------------------------------- /apis/movies/server.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | $uri = urldecode( 11 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) 12 | ); 13 | 14 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the 15 | // built-in PHP web server. This provides a convenient way to test a Laravel 16 | // application without having installed a "real" web server software here. 17 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { 18 | return false; 19 | } 20 | 21 | require_once __DIR__.'/public/index.php'; 22 | -------------------------------------------------------------------------------- /apis/movies/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash; 2 | echo "Begin Setup"; 3 | 4 | echo "Install project dependencies..."; 5 | composer install || { 6 | echo "Composer not found. Installing Composer..."; 7 | php -r "readfile('https://getcomposer.org/installer');" | php; 8 | #mv composer.phar /usr/local/bin/composer -n; 9 | php composer.phar install; 10 | } 11 | echo "Create database"; 12 | touch database/database.sqlite; 13 | 14 | echo "Migrate & Seed"; 15 | php artisan migrate; 16 | php artisan db:seed; 17 | php artisan serve --port=3000 --host localhost; -------------------------------------------------------------------------------- /apis/movies/storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /apis/movies/storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /apis/movies/storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | config.php 2 | routes.php 3 | compiled.php 4 | services.json 5 | events.scanned.php 6 | routes.scanned.php 7 | down 8 | -------------------------------------------------------------------------------- /apis/movies/storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /apis/movies/storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /apis/movies/storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /apis/movies/storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /apis/movies/tests/ExampleTest.php: -------------------------------------------------------------------------------- 1 | visit('/') 17 | ->see('Laravel 5'); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /apis/movies/tests/TestCase.php: -------------------------------------------------------------------------------- 1 | make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); 22 | 23 | return $app; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /apis/pagination/stories/.env.example: -------------------------------------------------------------------------------- 1 | APP_ENV=local 2 | APP_DEBUG=true 3 | APP_KEY=SomeRandomString 4 | APP_URL=http://localhost 5 | 6 | DB_HOST=127.0.0.1 7 | DB_PORT=3306 8 | DB_DATABASE=homestead 9 | DB_USERNAME=homestead 10 | DB_PASSWORD=secret 11 | 12 | CACHE_DRIVER=file 13 | SESSION_DRIVER=file 14 | QUEUE_DRIVER=sync 15 | 16 | REDIS_HOST=127.0.0.1 17 | REDIS_PASSWORD=null 18 | REDIS_PORT=6379 19 | 20 | MAIL_DRIVER=smtp 21 | MAIL_HOST=mailtrap.io 22 | MAIL_PORT=2525 23 | MAIL_USERNAME=null 24 | MAIL_PASSWORD=null 25 | MAIL_ENCRYPTION=null 26 | -------------------------------------------------------------------------------- /apis/pagination/stories/.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.css linguist-vendored 3 | *.less linguist-vendored 4 | -------------------------------------------------------------------------------- /apis/pagination/stories/.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | /node_modules 3 | /public/storage 4 | Homestead.yaml 5 | Homestead.json 6 | .env 7 | -------------------------------------------------------------------------------- /apis/pagination/stories/app/Console/Commands/Inspire.php: -------------------------------------------------------------------------------- 1 | comment(PHP_EOL.Inspiring::quote().PHP_EOL); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /apis/pagination/stories/app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire') 28 | // ->hourly(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /apis/pagination/stories/app/Events/Event.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /apis/pagination/stories/app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | guest()) { 21 | if ($request->ajax() || $request->wantsJson()) { 22 | return response('Unauthorized.', 401); 23 | } else { 24 | return redirect()->guest('login'); 25 | } 26 | } 27 | 28 | return $next($request); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /apis/pagination/stories/app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | check()) { 21 | return redirect('/'); 22 | } 23 | 24 | return $next($request); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /apis/pagination/stories/app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | 'api'], function () { 30 | Route::resource('stories', 'Api\StoriesController'); 31 | }); 32 | -------------------------------------------------------------------------------- /apis/pagination/stories/app/Jobs/Job.php: -------------------------------------------------------------------------------- 1 | 'App\Policies\ModelPolicy', 17 | ]; 18 | 19 | /** 20 | * Register any application authentication / authorization services. 21 | * 22 | * @param \Illuminate\Contracts\Auth\Access\Gate $gate 23 | * @return void 24 | */ 25 | public function boot(GateContract $gate) 26 | { 27 | $this->registerPolicies($gate); 28 | 29 | // 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /apis/pagination/stories/app/Providers/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'App\Listeners\EventListener', 18 | ], 19 | ]; 20 | 21 | /** 22 | * Register any other events for your application. 23 | * 24 | * @param \Illuminate\Contracts\Events\Dispatcher $events 25 | * @return void 26 | */ 27 | public function boot(DispatcherContract $events) 28 | { 29 | parent::boot($events); 30 | 31 | // 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /apis/pagination/stories/app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | group(['namespace' => $this->namespace], function ($router) { 41 | require app_path('Http/routes.php'); 42 | }); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /apis/pagination/stories/app/Story.php: -------------------------------------------------------------------------------- 1 | [ 15 | 'code' => 'ERR-NOTFOUND', 16 | 'http_code' => '404', 17 | 'message' => 'Requested story cannot be found in the database.', 18 | ] 19 | ]; 20 | return \Response::json($error, 404); 21 | } 22 | return $story; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /apis/pagination/stories/app/User.php: -------------------------------------------------------------------------------- 1 | =5.5.9", 9 | "laravel/framework": "5.2.*" 10 | }, 11 | "require-dev": { 12 | "fzaninotto/faker": "~1.4", 13 | "mockery/mockery": "0.9.*", 14 | "phpunit/phpunit": "~4.0", 15 | "symfony/css-selector": "2.8.*|3.0.*", 16 | "symfony/dom-crawler": "2.8.*|3.0.*" 17 | }, 18 | "autoload": { 19 | "classmap": [ 20 | "database" 21 | ], 22 | "psr-4": { 23 | "App\\": "app/" 24 | } 25 | }, 26 | "autoload-dev": { 27 | "classmap": [ 28 | "tests/TestCase.php" 29 | ] 30 | }, 31 | "scripts": { 32 | "post-root-package-install": [ 33 | "php -r \"copy('.env.example', '.env');\"" 34 | ], 35 | "post-create-project-cmd": [ 36 | "php artisan key:generate" 37 | ], 38 | "post-install-cmd": [ 39 | "php artisan clear-compiled", 40 | "php artisan optimize" 41 | ], 42 | "pre-update-cmd": [ 43 | "php artisan clear-compiled" 44 | ], 45 | "post-update-cmd": [ 46 | "php artisan optimize" 47 | ] 48 | }, 49 | "config": { 50 | "preferred-install": "dist" 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /apis/pagination/stories/config/compile.php: -------------------------------------------------------------------------------- 1 | [ 17 | // 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled File Providers 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may list service providers which define a "compiles" function 26 | | that returns additional files that should be compiled, providing an 27 | | easy way to get common files from any packages you are utilizing. 28 | | 29 | */ 30 | 31 | 'providers' => [ 32 | // 33 | ], 34 | 35 | ]; 36 | -------------------------------------------------------------------------------- /apis/pagination/stories/config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | ], 21 | 22 | 'ses' => [ 23 | 'key' => env('SES_KEY'), 24 | 'secret' => env('SES_SECRET'), 25 | 'region' => 'us-east-1', 26 | ], 27 | 28 | 'sparkpost' => [ 29 | 'secret' => env('SPARKPOST_SECRET'), 30 | ], 31 | 32 | 'stripe' => [ 33 | 'model' => App\User::class, 34 | 'key' => env('STRIPE_KEY'), 35 | 'secret' => env('STRIPE_SECRET'), 36 | ], 37 | 38 | ]; 39 | -------------------------------------------------------------------------------- /apis/pagination/stories/config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | realpath(base_path('resources/views')), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => realpath(storage_path('framework/views')), 32 | 33 | ]; 34 | -------------------------------------------------------------------------------- /apis/pagination/stories/database.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hootlex/the-majesty-of-vuejs/30bd16d6ccd51c26f2e120ac099469844a14bdb4/apis/pagination/stories/database.sqlite -------------------------------------------------------------------------------- /apis/pagination/stories/database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite 2 | -------------------------------------------------------------------------------- /apis/pagination/stories/database/migrations/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /apis/pagination/stories/database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->string('name'); 18 | $table->string('email')->unique(); 19 | $table->string('password'); 20 | $table->rememberToken(); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::drop('users'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /apis/pagination/stories/database/migrations/2014_10_12_100000_create_password_resets_table.php: -------------------------------------------------------------------------------- 1 | string('email')->index(); 17 | $table->string('token')->index(); 18 | $table->timestamp('created_at'); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | * 25 | * @return void 26 | */ 27 | public function down() 28 | { 29 | Schema::drop('password_resets'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /apis/pagination/stories/database/migrations/2016_03_10_045354_create_stories_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->string('plot'); 18 | $table->integer('upvotes')->unsigned(); 19 | $table->string('writer'); 20 | $table->timestamps(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::table('stories', function (Blueprint $table) { 32 | Schema::drop('stories'); 33 | }); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /apis/pagination/stories/database/seeds/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /apis/pagination/stories/database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call(StorySeeder::class); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /apis/pagination/stories/database/seeds/StorySeeder.php: -------------------------------------------------------------------------------- 1 | truncate(); 15 | factory(App\Story::class, 200)->create(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /apis/pagination/stories/gulpfile.js: -------------------------------------------------------------------------------- 1 | var elixir = require('laravel-elixir'); 2 | 3 | /* 4 | |-------------------------------------------------------------------------- 5 | | Elixir Asset Management 6 | |-------------------------------------------------------------------------- 7 | | 8 | | Elixir provides a clean, fluent API for defining some basic Gulp tasks 9 | | for your Laravel application. By default, we are compiling the Sass 10 | | file for our application, as well as publishing vendor resources. 11 | | 12 | */ 13 | 14 | elixir(function(mix) { 15 | mix.sass('app.scss'); 16 | }); 17 | -------------------------------------------------------------------------------- /apis/pagination/stories/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "devDependencies": { 4 | "gulp": "^3.8.8" 5 | }, 6 | "dependencies": { 7 | "laravel-elixir": "^4.0.0", 8 | "bootstrap-sass": "^3.0.0" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /apis/pagination/stories/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | ./tests/ 14 | 15 | 16 | 17 | 18 | app/ 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /apis/pagination/stories/public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Redirect Trailing Slashes If Not A Folder... 9 | RewriteCond %{REQUEST_FILENAME} !-d 10 | RewriteRule ^(.*)/$ /$1 [L,R=301] 11 | 12 | # Handle Front Controller... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_FILENAME} !-f 15 | RewriteRule ^ index.php [L] 16 | 17 | # Handle Authorization Header 18 | RewriteCond %{HTTP:Authorization} . 19 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 20 | 21 | -------------------------------------------------------------------------------- /apis/pagination/stories/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hootlex/the-majesty-of-vuejs/30bd16d6ccd51c26f2e120ac099469844a14bdb4/apis/pagination/stories/public/favicon.ico -------------------------------------------------------------------------------- /apis/pagination/stories/public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /apis/pagination/stories/public/web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /apis/pagination/stories/resources/assets/sass/app.scss: -------------------------------------------------------------------------------- 1 | // @import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap"; 2 | 3 | -------------------------------------------------------------------------------- /apis/pagination/stories/resources/lang/en/auth.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /apis/pagination/stories/resources/lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /apis/pagination/stories/resources/lang/en/passwords.php: -------------------------------------------------------------------------------- 1 | 'Passwords must be at least six characters and match the confirmation.', 17 | 'reset' => 'Your password has been reset!', 18 | 'sent' => 'We have e-mailed your password reset link!', 19 | 'token' => 'This password reset token is invalid.', 20 | 'user' => "We can't find a user with that e-mail address.", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /apis/pagination/stories/resources/views/errors/503.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Be right back. 5 | 6 | 7 | 8 | 39 | 40 | 41 |
42 |
43 |
Be right back.
44 |
45 |
46 | 47 | 48 | -------------------------------------------------------------------------------- /apis/pagination/stories/resources/views/vendor/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /apis/pagination/stories/resources/views/welcome.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Laravel 5 | 6 | 7 | 8 | 37 | 38 | 39 |
40 |
41 |
Laravel 5
42 |
43 |
44 | 45 | 46 | -------------------------------------------------------------------------------- /apis/pagination/stories/server.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | $uri = urldecode( 11 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) 12 | ); 13 | 14 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the 15 | // built-in PHP web server. This provides a convenient way to test a Laravel 16 | // application without having installed a "real" web server software here. 17 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { 18 | return false; 19 | } 20 | 21 | require_once __DIR__.'/public/index.php'; 22 | -------------------------------------------------------------------------------- /apis/pagination/stories/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash; 2 | echo "Begin Setup"; 3 | 4 | echo "Install project dependencies..."; 5 | composer install || { 6 | echo "Composer not found. Installing Composer..."; 7 | php -r "readfile('https://getcomposer.org/installer');" | php; 8 | #mv composer.phar /usr/local/bin/composer -n; 9 | php composer.phar install; 10 | } 11 | echo "Create database"; 12 | touch database/database.sqlite; 13 | 14 | echo "Migrate & Seed"; 15 | php artisan migrate; 16 | php artisan db:seed; 17 | php artisan serve --port=3000 --host localhost; -------------------------------------------------------------------------------- /apis/pagination/stories/storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /apis/pagination/stories/storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /apis/pagination/stories/storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | config.php 2 | routes.php 3 | compiled.php 4 | services.json 5 | events.scanned.php 6 | routes.scanned.php 7 | down 8 | -------------------------------------------------------------------------------- /apis/pagination/stories/storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /apis/pagination/stories/storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /apis/pagination/stories/storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /apis/pagination/stories/storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /apis/pagination/stories/tests/ExampleTest.php: -------------------------------------------------------------------------------- 1 | visit('/') 17 | ->see('Laravel 5'); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /apis/pagination/stories/tests/TestCase.php: -------------------------------------------------------------------------------- 1 | make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); 22 | 23 | return $app; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /apis/stories/.env.example: -------------------------------------------------------------------------------- 1 | APP_ENV=local 2 | APP_DEBUG=true 3 | APP_KEY=SomeRandomString 4 | APP_URL=http://localhost 5 | 6 | DB_HOST=127.0.0.1 7 | DB_PORT=3306 8 | DB_DATABASE=homestead 9 | DB_USERNAME=homestead 10 | DB_PASSWORD=secret 11 | 12 | CACHE_DRIVER=file 13 | SESSION_DRIVER=file 14 | QUEUE_DRIVER=sync 15 | 16 | REDIS_HOST=127.0.0.1 17 | REDIS_PASSWORD=null 18 | REDIS_PORT=6379 19 | 20 | MAIL_DRIVER=smtp 21 | MAIL_HOST=mailtrap.io 22 | MAIL_PORT=2525 23 | MAIL_USERNAME=null 24 | MAIL_PASSWORD=null 25 | MAIL_ENCRYPTION=null 26 | -------------------------------------------------------------------------------- /apis/stories/.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.css linguist-vendored 3 | *.less linguist-vendored 4 | -------------------------------------------------------------------------------- /apis/stories/.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | /node_modules 3 | /public/storage 4 | Homestead.yaml 5 | Homestead.json 6 | .env 7 | -------------------------------------------------------------------------------- /apis/stories/app/Console/Commands/Inspire.php: -------------------------------------------------------------------------------- 1 | comment(PHP_EOL.Inspiring::quote().PHP_EOL); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /apis/stories/app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire') 28 | // ->hourly(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /apis/stories/app/Events/Event.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /apis/stories/app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | guest()) { 21 | if ($request->ajax() || $request->wantsJson()) { 22 | return response('Unauthorized.', 401); 23 | } else { 24 | return redirect()->guest('login'); 25 | } 26 | } 27 | 28 | return $next($request); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /apis/stories/app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | check()) { 21 | return redirect('/'); 22 | } 23 | 24 | return $next($request); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /apis/stories/app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | 'api'], function () { 30 | Route::resource('stories', 'Api\StoriesController'); 31 | }); 32 | -------------------------------------------------------------------------------- /apis/stories/app/Jobs/Job.php: -------------------------------------------------------------------------------- 1 | 'App\Policies\ModelPolicy', 17 | ]; 18 | 19 | /** 20 | * Register any application authentication / authorization services. 21 | * 22 | * @param \Illuminate\Contracts\Auth\Access\Gate $gate 23 | * @return void 24 | */ 25 | public function boot(GateContract $gate) 26 | { 27 | $this->registerPolicies($gate); 28 | 29 | // 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /apis/stories/app/Providers/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'App\Listeners\EventListener', 18 | ], 19 | ]; 20 | 21 | /** 22 | * Register any other events for your application. 23 | * 24 | * @param \Illuminate\Contracts\Events\Dispatcher $events 25 | * @return void 26 | */ 27 | public function boot(DispatcherContract $events) 28 | { 29 | parent::boot($events); 30 | 31 | // 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /apis/stories/app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | group(['namespace' => $this->namespace], function ($router) { 41 | require app_path('Http/routes.php'); 42 | }); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /apis/stories/app/Story.php: -------------------------------------------------------------------------------- 1 | [ 15 | 'code' => 'ERR-NOTFOUND', 16 | 'http_code' => '404', 17 | 'message' => 'Requested story cannot be found in the database.', 18 | ] 19 | ]; 20 | return \Response::json($error, 404); 21 | } 22 | return $story; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /apis/stories/app/User.php: -------------------------------------------------------------------------------- 1 | =5.5.9", 9 | "laravel/framework": "5.2.*" 10 | }, 11 | "require-dev": { 12 | "fzaninotto/faker": "~1.4", 13 | "mockery/mockery": "0.9.*", 14 | "phpunit/phpunit": "~4.0", 15 | "symfony/css-selector": "2.8.*|3.0.*", 16 | "symfony/dom-crawler": "2.8.*|3.0.*" 17 | }, 18 | "autoload": { 19 | "classmap": [ 20 | "database" 21 | ], 22 | "psr-4": { 23 | "App\\": "app/" 24 | } 25 | }, 26 | "autoload-dev": { 27 | "classmap": [ 28 | "tests/TestCase.php" 29 | ] 30 | }, 31 | "scripts": { 32 | "post-root-package-install": [ 33 | "php -r \"copy('.env.example', '.env');\"" 34 | ], 35 | "post-create-project-cmd": [ 36 | "php artisan key:generate" 37 | ], 38 | "post-install-cmd": [ 39 | "php artisan clear-compiled", 40 | "php artisan optimize" 41 | ], 42 | "pre-update-cmd": [ 43 | "php artisan clear-compiled" 44 | ], 45 | "post-update-cmd": [ 46 | "php artisan optimize" 47 | ] 48 | }, 49 | "config": { 50 | "preferred-install": "dist" 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /apis/stories/config/compile.php: -------------------------------------------------------------------------------- 1 | [ 17 | // 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled File Providers 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may list service providers which define a "compiles" function 26 | | that returns additional files that should be compiled, providing an 27 | | easy way to get common files from any packages you are utilizing. 28 | | 29 | */ 30 | 31 | 'providers' => [ 32 | // 33 | ], 34 | 35 | ]; 36 | -------------------------------------------------------------------------------- /apis/stories/config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | ], 21 | 22 | 'ses' => [ 23 | 'key' => env('SES_KEY'), 24 | 'secret' => env('SES_SECRET'), 25 | 'region' => 'us-east-1', 26 | ], 27 | 28 | 'sparkpost' => [ 29 | 'secret' => env('SPARKPOST_SECRET'), 30 | ], 31 | 32 | 'stripe' => [ 33 | 'model' => App\User::class, 34 | 'key' => env('STRIPE_KEY'), 35 | 'secret' => env('STRIPE_SECRET'), 36 | ], 37 | 38 | ]; 39 | -------------------------------------------------------------------------------- /apis/stories/config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | realpath(base_path('resources/views')), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => realpath(storage_path('framework/views')), 32 | 33 | ]; 34 | -------------------------------------------------------------------------------- /apis/stories/database.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hootlex/the-majesty-of-vuejs/30bd16d6ccd51c26f2e120ac099469844a14bdb4/apis/stories/database.sqlite -------------------------------------------------------------------------------- /apis/stories/database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite 2 | -------------------------------------------------------------------------------- /apis/stories/database/migrations/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /apis/stories/database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->string('name'); 18 | $table->string('email')->unique(); 19 | $table->string('password'); 20 | $table->rememberToken(); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::drop('users'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /apis/stories/database/migrations/2014_10_12_100000_create_password_resets_table.php: -------------------------------------------------------------------------------- 1 | string('email')->index(); 17 | $table->string('token')->index(); 18 | $table->timestamp('created_at'); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | * 25 | * @return void 26 | */ 27 | public function down() 28 | { 29 | Schema::drop('password_resets'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /apis/stories/database/migrations/2016_03_10_045354_create_stories_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->string('plot'); 18 | $table->integer('upvotes')->unsigned(); 19 | $table->string('writer'); 20 | $table->timestamps(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::table('stories', function (Blueprint $table) { 32 | Schema::drop('stories'); 33 | }); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /apis/stories/database/seeds/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /apis/stories/database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call(StorySeeder::class); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /apis/stories/database/seeds/StorySeeder.php: -------------------------------------------------------------------------------- 1 | truncate(); 15 | factory(App\Story::class, 20)->create(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /apis/stories/gulpfile.js: -------------------------------------------------------------------------------- 1 | var elixir = require('laravel-elixir'); 2 | 3 | /* 4 | |-------------------------------------------------------------------------- 5 | | Elixir Asset Management 6 | |-------------------------------------------------------------------------- 7 | | 8 | | Elixir provides a clean, fluent API for defining some basic Gulp tasks 9 | | for your Laravel application. By default, we are compiling the Sass 10 | | file for our application, as well as publishing vendor resources. 11 | | 12 | */ 13 | 14 | elixir(function(mix) { 15 | mix.sass('app.scss'); 16 | }); 17 | -------------------------------------------------------------------------------- /apis/stories/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "devDependencies": { 4 | "gulp": "^3.8.8" 5 | }, 6 | "dependencies": { 7 | "laravel-elixir": "^4.0.0", 8 | "bootstrap-sass": "^3.0.0" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /apis/stories/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | ./tests/ 14 | 15 | 16 | 17 | 18 | app/ 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /apis/stories/public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Redirect Trailing Slashes If Not A Folder... 9 | RewriteCond %{REQUEST_FILENAME} !-d 10 | RewriteRule ^(.*)/$ /$1 [L,R=301] 11 | 12 | # Handle Front Controller... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_FILENAME} !-f 15 | RewriteRule ^ index.php [L] 16 | 17 | # Handle Authorization Header 18 | RewriteCond %{HTTP:Authorization} . 19 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 20 | 21 | -------------------------------------------------------------------------------- /apis/stories/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hootlex/the-majesty-of-vuejs/30bd16d6ccd51c26f2e120ac099469844a14bdb4/apis/stories/public/favicon.ico -------------------------------------------------------------------------------- /apis/stories/public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /apis/stories/public/web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /apis/stories/readme.md: -------------------------------------------------------------------------------- 1 | This is the API used in the "Consuming an API" part of the book and it is intended for educational use only. 2 | 3 | Contains everything you need to use this API and an installation script for faster implementation. 4 | 5 | This API is built with [Laravel](http://laravel.com) 6 | -------------------------------------------------------------------------------- /apis/stories/resources/assets/sass/app.scss: -------------------------------------------------------------------------------- 1 | // @import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap"; 2 | 3 | -------------------------------------------------------------------------------- /apis/stories/resources/lang/en/auth.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /apis/stories/resources/lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /apis/stories/resources/lang/en/passwords.php: -------------------------------------------------------------------------------- 1 | 'Passwords must be at least six characters and match the confirmation.', 17 | 'reset' => 'Your password has been reset!', 18 | 'sent' => 'We have e-mailed your password reset link!', 19 | 'token' => 'This password reset token is invalid.', 20 | 'user' => "We can't find a user with that e-mail address.", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /apis/stories/resources/views/errors/503.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Be right back. 5 | 6 | 7 | 8 | 39 | 40 | 41 |
42 |
43 |
Be right back.
44 |
45 |
46 | 47 | 48 | -------------------------------------------------------------------------------- /apis/stories/resources/views/vendor/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /apis/stories/resources/views/welcome.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Laravel 5 | 6 | 7 | 8 | 37 | 38 | 39 |
40 |
41 |
Laravel 5
42 |
43 |
44 | 45 | 46 | -------------------------------------------------------------------------------- /apis/stories/server.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | $uri = urldecode( 11 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) 12 | ); 13 | 14 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the 15 | // built-in PHP web server. This provides a convenient way to test a Laravel 16 | // application without having installed a "real" web server software here. 17 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { 18 | return false; 19 | } 20 | 21 | require_once __DIR__.'/public/index.php'; 22 | -------------------------------------------------------------------------------- /apis/stories/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash; 2 | echo "Begin Setup"; 3 | 4 | echo "Install project dependencies..."; 5 | composer install || { 6 | echo "Composer not found. Installing Composer..."; 7 | php -r "readfile('https://getcomposer.org/installer');" | php; 8 | #mv composer.phar /usr/local/bin/composer -n; 9 | php composer.phar install; 10 | } 11 | echo "Create database"; 12 | touch database/database.sqlite; 13 | 14 | echo "Migrate & Seed"; 15 | php artisan migrate; 16 | php artisan db:seed; 17 | php artisan serve --port=3000 --host localhost; -------------------------------------------------------------------------------- /apis/stories/storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /apis/stories/storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /apis/stories/storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | config.php 2 | routes.php 3 | compiled.php 4 | services.json 5 | events.scanned.php 6 | routes.scanned.php 7 | down 8 | -------------------------------------------------------------------------------- /apis/stories/storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /apis/stories/storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /apis/stories/storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /apis/stories/storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /apis/stories/tests/ExampleTest.php: -------------------------------------------------------------------------------- 1 | visit('/') 17 | ->see('Laravel 5'); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /apis/stories/tests/TestCase.php: -------------------------------------------------------------------------------- 1 | make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); 22 | 23 | return $app; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /examples/14. Mastering Single File Components/14.3 forming vue files/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015", "stage-2"], 3 | "plugins": ["transform-runtime"], 4 | "comments": false 5 | } 6 | -------------------------------------------------------------------------------- /examples/14. Mastering Single File Components/14.3 forming vue files/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /examples/14. Mastering Single File Components/14.3 forming vue files/.eslintignore: -------------------------------------------------------------------------------- 1 | build/*.js 2 | config/*.js 3 | -------------------------------------------------------------------------------- /examples/14. Mastering Single File Components/14.3 forming vue files/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parser: 'babel-eslint', 4 | parserOptions: { 5 | sourceType: 'module' 6 | }, 7 | // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style 8 | extends: 'standard', 9 | // required to lint *.vue files 10 | plugins: [ 11 | 'html' 12 | ], 13 | // add your custom rules here 14 | 'rules': { 15 | // allow paren-less arrow functions 16 | 'arrow-parens': 0, 17 | // allow async-await 18 | 'generator-star-spacing': 0, 19 | // allow debugger during development 20 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /examples/14. Mastering Single File Components/14.3 forming vue files/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | dist/ 4 | npm-debug.log 5 | selenium-debug.log 6 | test/unit/coverage 7 | test/e2e/reports 8 | -------------------------------------------------------------------------------- /examples/14. Mastering Single File Components/14.3 forming vue files/README.md: -------------------------------------------------------------------------------- 1 | # y 2 | 3 | > y 4 | 5 | ## Build Setup 6 | 7 | ``` bash 8 | # install dependencies 9 | npm install 10 | 11 | # serve with hot reload at localhost:8080 12 | npm run dev 13 | 14 | # build for production with minification 15 | npm run build 16 | 17 | # run unit tests 18 | npm run unit 19 | 20 | # run e2e tests 21 | npm run e2e 22 | 23 | # run all tests 24 | npm test 25 | ``` 26 | 27 | For detailed explanation on how things work, checkout the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). 28 | -------------------------------------------------------------------------------- /examples/14. Mastering Single File Components/14.3 forming vue files/build/build.js: -------------------------------------------------------------------------------- 1 | // https://github.com/shelljs/shelljs 2 | require('shelljs/global') 3 | env.NODE_ENV = 'production' 4 | 5 | var path = require('path') 6 | var config = require('../config') 7 | var ora = require('ora') 8 | var webpack = require('webpack') 9 | var webpackConfig = require('./webpack.prod.conf') 10 | 11 | console.log( 12 | ' Tip:\n' + 13 | ' Built files are meant to be served over an HTTP server.\n' + 14 | ' Opening index.html over file:// won\'t work.\n' 15 | ) 16 | 17 | var spinner = ora('building for production...') 18 | spinner.start() 19 | 20 | var assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory) 21 | rm('-rf', assetsPath) 22 | mkdir('-p', assetsPath) 23 | cp('-R', 'static/', assetsPath) 24 | 25 | webpack(webpackConfig, function (err, stats) { 26 | spinner.stop() 27 | if (err) throw err 28 | process.stdout.write(stats.toString({ 29 | colors: true, 30 | modules: false, 31 | children: false, 32 | chunks: false, 33 | chunkModules: false 34 | }) + '\n') 35 | }) 36 | -------------------------------------------------------------------------------- /examples/14. Mastering Single File Components/14.3 forming vue files/build/dev-client.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | require('eventsource-polyfill') 3 | var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true') 4 | 5 | hotClient.subscribe(function (event) { 6 | if (event.action === 'reload') { 7 | window.location.reload() 8 | } 9 | }) 10 | -------------------------------------------------------------------------------- /examples/14. Mastering Single File Components/14.3 forming vue files/build/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | var config = require('../config') 2 | var webpack = require('webpack') 3 | var merge = require('webpack-merge') 4 | var utils = require('./utils') 5 | var baseWebpackConfig = require('./webpack.base.conf') 6 | var HtmlWebpackPlugin = require('html-webpack-plugin') 7 | 8 | // add hot-reload related code to entry chunks 9 | Object.keys(baseWebpackConfig.entry).forEach(function (name) { 10 | baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name]) 11 | }) 12 | 13 | module.exports = merge(baseWebpackConfig, { 14 | module: { 15 | loaders: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap }) 16 | }, 17 | // eval-source-map is faster for development 18 | devtool: '#eval-source-map', 19 | plugins: [ 20 | new webpack.DefinePlugin({ 21 | 'process.env': config.dev.env 22 | }), 23 | // https://github.com/glenjamin/webpack-hot-middleware#installation--usage 24 | new webpack.optimize.OccurenceOrderPlugin(), 25 | new webpack.HotModuleReplacementPlugin(), 26 | new webpack.NoErrorsPlugin(), 27 | // https://github.com/ampedandwired/html-webpack-plugin 28 | new HtmlWebpackPlugin({ 29 | filename: 'index.html', 30 | template: 'index.html', 31 | inject: true 32 | }) 33 | ] 34 | }) 35 | -------------------------------------------------------------------------------- /examples/14. Mastering Single File Components/14.3 forming vue files/config/dev.env.js: -------------------------------------------------------------------------------- 1 | var merge = require('webpack-merge') 2 | var prodEnv = require('./prod.env') 3 | 4 | module.exports = merge(prodEnv, { 5 | NODE_ENV: '"development"' 6 | }) 7 | -------------------------------------------------------------------------------- /examples/14. Mastering Single File Components/14.3 forming vue files/config/index.js: -------------------------------------------------------------------------------- 1 | // see http://vuejs-templates.github.io/webpack for documentation. 2 | var path = require('path') 3 | 4 | module.exports = { 5 | build: { 6 | env: require('./prod.env'), 7 | index: path.resolve(__dirname, '../dist/index.html'), 8 | assetsRoot: path.resolve(__dirname, '../dist'), 9 | assetsSubDirectory: 'static', 10 | assetsPublicPath: '/', 11 | productionSourceMap: true, 12 | // Gzip off by default as many popular static hosts such as 13 | // Surge or Netlify already gzip all static assets for you. 14 | // Before setting to `true`, make sure to: 15 | // npm install --save-dev compression-webpack-plugin 16 | productionGzip: false, 17 | productionGzipExtensions: ['js', 'css'] 18 | }, 19 | dev: { 20 | env: require('./dev.env'), 21 | port: 8080, 22 | assetsSubDirectory: 'static', 23 | assetsPublicPath: '/', 24 | proxyTable: {}, 25 | // CSS Sourcemaps off by default because relative paths are "buggy" 26 | // with this option, according to the CSS-Loader README 27 | // (https://github.com/webpack/css-loader#sourcemaps) 28 | // In our experience, they generally work as expected, 29 | // just be aware of this issue when enabling this option. 30 | cssSourceMap: false 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /examples/14. Mastering Single File Components/14.3 forming vue files/config/prod.env.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | NODE_ENV: '"production"' 3 | } 4 | -------------------------------------------------------------------------------- /examples/14. Mastering Single File Components/14.3 forming vue files/config/test.env.js: -------------------------------------------------------------------------------- 1 | var merge = require('webpack-merge') 2 | var devEnv = require('./dev.env') 3 | 4 | module.exports = merge(devEnv, { 5 | NODE_ENV: '"testing"' 6 | }) 7 | -------------------------------------------------------------------------------- /examples/14. Mastering Single File Components/14.3 forming vue files/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | stories classic 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/14. Mastering Single File Components/14.3 forming vue files/src/App.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 22 | 23 | 53 | -------------------------------------------------------------------------------- /examples/14. Mastering Single File Components/14.3 forming vue files/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hootlex/the-majesty-of-vuejs/30bd16d6ccd51c26f2e120ac099469844a14bdb4/examples/14. Mastering Single File Components/14.3 forming vue files/src/assets/logo.png -------------------------------------------------------------------------------- /examples/14. Mastering Single File Components/14.3 forming vue files/src/components/Famous.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 52 | -------------------------------------------------------------------------------- /examples/14. Mastering Single File Components/14.3 forming vue files/src/components/Hello.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 20 | 21 | 22 | 27 | -------------------------------------------------------------------------------- /examples/14. Mastering Single File Components/14.3 forming vue files/src/components/Login.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 15 | -------------------------------------------------------------------------------- /examples/14. Mastering Single File Components/14.3 forming vue files/src/components/Register.vue: -------------------------------------------------------------------------------- 1 |