├── .gitignore ├── LICENSE.txt ├── README.md ├── bootstrap.php ├── build ├── 404 │ └── index.html ├── assets │ ├── build │ │ ├── css │ │ │ ├── main.css │ │ │ └── main.css.map │ │ ├── js │ │ │ ├── main.js │ │ │ ├── main.js.LICENSE.txt │ │ │ └── main.js.map │ │ └── mix-manifest.json │ └── img │ │ ├── blueprint-logo.png │ │ ├── icon-stack.svg │ │ ├── icon-terminal.svg │ │ ├── icon-window.svg │ │ ├── laravel-blueprint-code-generator.png │ │ ├── logo-github.png │ │ ├── logo-large.svg │ │ ├── logo.png │ │ ├── logo.svg │ │ └── magnifying-glass.svg ├── docs │ ├── advanced-configuration │ │ └── index.html │ ├── available-commands │ │ └── index.html │ ├── contributing │ │ └── index.html │ ├── controller-shorthands │ │ └── index.html │ ├── controller-statements │ │ └── index.html │ ├── defining-controllers │ │ └── index.html │ ├── defining-models │ │ └── index.html │ ├── extending-blueprint │ │ └── index.html │ ├── generated-tests │ │ └── index.html │ ├── generating-components │ │ └── index.html │ ├── generating-database-seeders │ │ └── index.html │ ├── getting-started │ │ └── index.html │ ├── installation │ │ └── index.html │ ├── keys-and-indexes │ │ └── index.html │ ├── model-data-types │ │ └── index.html │ ├── model-references │ │ └── index.html │ ├── model-relationships │ │ └── index.html │ ├── model-shorthands │ │ └── index.html │ └── videos │ │ └── index.html ├── favicon.ico ├── index.html └── sitemap.xml ├── composer.json ├── composer.lock ├── config.php ├── config.production.php ├── deploy.sh ├── listeners └── GenerateSitemap.php ├── navigation.php ├── package-lock.json ├── package.json ├── source ├── 404.blade.php ├── _assets │ ├── css │ │ ├── base.css │ │ ├── documentation.css │ │ ├── main.css │ │ ├── navigation.css │ │ └── search.css │ └── js │ │ └── main.js ├── _layouts │ ├── documentation.blade.php │ └── master.blade.php ├── _nav │ ├── menu-item.blade.php │ ├── menu-toggle.blade.php │ ├── menu.blade.php │ └── search-input.blade.php ├── assets │ └── img │ │ ├── blueprint-logo.png │ │ ├── icon-stack.svg │ │ ├── icon-terminal.svg │ │ ├── icon-window.svg │ │ ├── laravel-blueprint-code-generator.png │ │ ├── logo-github.png │ │ ├── logo-large.svg │ │ ├── logo.png │ │ ├── logo.svg │ │ └── magnifying-glass.svg ├── docs │ ├── advanced-configuration.md │ ├── available-commands.md │ ├── contributing.md │ ├── controller-shorthands.md │ ├── controller-statements.md │ ├── defining-controllers.md │ ├── defining-models.md │ ├── extending-blueprint.md │ ├── generated-tests.md │ ├── generating-components.md │ ├── generating-database-seeders.md │ ├── getting-started.md │ ├── installation.md │ ├── keys-and-indexes.md │ ├── model-data-types.md │ ├── model-references.md │ ├── model-relationships.md │ ├── model-shorthands.md │ └── videos.md ├── favicon.ico └── index.blade.php ├── tailwind.config.js └── webpack.mix.js /.gitignore: -------------------------------------------------------------------------------- 1 | /build_*/ 2 | /node_modules/ 3 | /vendor/ 4 | /source/assets/build/ 5 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Blueprint Docs 2 | 3 | This project contains the [documentation](https://blueprint.laravelshift.com/) for [Blueprint](https://github.com/laravel-shift/blueprint). It's built with [Jigsaw](https://jigsaw.tighten.co/) using their [Docs Template](https://github.com/tightenco/jigsaw-docs-template). 4 | 5 | ## Contributing 6 | Contributions may be made by submitting a Pull Request against the `master` branch. 7 | 8 | You may also contribute by [opening an issue](https://github.com/laravel-shift/blueprint-docs/issues) to report a typo, ask a question, or suggest new content. 9 | -------------------------------------------------------------------------------- /bootstrap.php: -------------------------------------------------------------------------------- 1 | afterBuild(function (Jigsaw $jigsaw) { 12 | $jigsaw->getOutputPaths() 13 | ->filter(function ($path) { 14 | return Str::startsWith($path, '/docs/'); 15 | }) 16 | ->each(function ($path) use ($jigsaw) { 17 | // Jigsaw did not return relative path of the generated file 18 | // as noted in the docs. This may break in a future version. 19 | $file = $jigsaw->getDestinationPath() . $path . '/index.html'; 20 | $contents = file_get_contents($file); 21 | 22 | $contents = preg_replace_callback('/

\^{3}(.+?)\^{3}<\/p>/s', function ($matches) { 23 | return '

'; 29 | }, $contents, -1, $found); 30 | if ($found) { 31 | file_put_contents($file, $contents); 32 | } 33 | }); 34 | }); 35 | 36 | $events->afterBuild(GenerateSitemap::class); 37 | -------------------------------------------------------------------------------- /build/404/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Blueprint 23 | 24 | 25 | 26 | 27 | 28 | 29 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
46 |
47 |
48 | 57 | 58 |
59 |
60 | 66 | 67 |
68 | 69 | 79 | 80 |
81 |
82 |
83 |
84 | 85 |
86 |
87 |

404

88 | 89 |

Page not found

90 | 91 |
92 | 93 |

94 | Need to update this page? See the Jigsaw documentation. 95 |

96 |
97 |
98 | 99 | 100 | 101 | 116 | 117 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /build/assets/build/css/main.css.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"css/main.css","mappings":"AAAA,wCAAc,CAAd,uBAAc,CAAd,kBAAc,CAAd,kBAAc,CAAd,aAAc,CAAd,aAAc,CAAd,aAAc,CAAd,cAAc,CAAd,cAAc,CAAd,YAAc,CAAd,YAAc,CAAd,iBAAc,CAAd,qCAAc,CAAd,6BAAc,CAAd,4BAAc,CAAd,2BAAc,CAAd,cAAc,CAAd,mBAAc,CAAd,qBAAc,CAAd,sBAAc,CAAd,uBAAc,CAAd,iBAAc,CAAd,0BAAc,CAAd,2BAAc,CAAd,mCAAc,CAAd,iCAAc,CAAd,0BAAc,CAAd,qBAAc,CAAd,6BAAc,CAAd,WAAc,CAAd,iBAAc,CAAd,eAAc,CAAd,gBAAc,CAAd,iBAAc,CAAd,aAAc,CAAd,eAAc,CAAd,YAAc,CAAd,kBAAc,CAAd,oBAAc,CAAd,0BAAc,CAAd,wBAAc,CAAd,yBAAc,CAAd,0BAAc,CAAd,sBAAc,CAAd,uBAAc,CAAd,wBAAc,CAAd,qBAAc,CAAd,mBAAc,CAAd,qBAAc,CAAd,oBAAc,CAAd,oBAAc,CAAd,kCAAc,CAAd,uBAAc,CAAd,kBAAc,CAAd,kBAAc,CAAd,aAAc,CAAd,aAAc,CAAd,aAAc,CAAd,cAAc,CAAd,cAAc,CAAd,YAAc,CAAd,YAAc,CAAd,iBAAc,CAAd,qCAAc,CAAd,6BAAc,CAAd,4BAAc,CAAd,2BAAc,CAAd,cAAc,CAAd,mBAAc,CAAd,qBAAc,CAAd,sBAAc,CAAd,uBAAc,CAAd,iBAAc,CAAd,0BAAc,CAAd,2BAAc,CAAd,mCAAc,CAAd,iCAAc,CAAd,0BAAc,CAAd,qBAAc,CAAd,6BAAc,CAAd,WAAc,CAAd,iBAAc,CAAd,eAA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AAnB,4FAAmB,CAAnB,kGAAmB,CAAnB,yBAAmB,CAAnB,8LAAmB,CAAnB,2CAAmB,CAAnB,yFAAmB,CAAnB,kDAAmB,CAAnB,qCAAmB,CAAnB,+DAAmB,CCAnB,2CAYA,CAZA,sDAYA,CAZA,2CAYA,CAZA,wDAYA,CAZA,4CAYA,CAZA,yCAYA,CAZA,+CAYA,CAZA,8CAYA,CAZA,+CAYA,CAZA,6CAYA,CAZA,4CAYA,CAZA,+CAYA,CAZA,mDAYA,CAZA,wDAYA,CAZA,wCAYA,CAZA,wDAYA,CAZA,wDAYA,CAZA,kBAYA,CAZA,uCAYA,CAZA,yGAYA,CAZA,4FAYA,CAZA,kGAYA,EAZA,uDAYA,CAZA,wBAYA,CAZA,sBAYA,CAZA,wBAYA,CAZA,uBAYA,CAZA,4BAYA,CAZA,mCAYA,CAZA,qCAYA,CAZA,2BAYA,CAZA,kBAYA,CAZA,8BAYA,CAZA,gBAYA,CAZA,+BAYA,CAZA,kBAYA,CAZA,wBAYA,CAZA,4BAYA,CAZA,8BAYA,EAZA,mDAYA,CAZA,6BAYA,CAZA,wBAYA,CAZA,sBAYA,CAZA,wBAYA,CAZA,qBAYA,CAZA,qBAYA,CAZA,qBAYA,CAZA,gCAYA,CAZA,oCAYA,CAZA,yCAYA,CAZA,qCAYA,CAZA,qBAYA,CAZA,6BAYA,CAZA,oBAYA,CAZA,4BAYA,EAZA,+CAYA,CAZA,qBAYA,CAZA,qBAYA,CAZA,qBAYA,CAZA,4BAYA,CAZA,kBAYA,E","sources":["webpack:///./node_modules/tailwindcss/base.css","webpack:///./node_modules/tailwindcss/components.css","webpack:///./node_modules/highlight.js/styles/a11y-light.css","webpack:///./source/_assets/css/base.css","webpack:///./source/_assets/css/navigation.css","webpack:///./source/_assets/css/search.css","webpack:///./node_modules/tailwindcss/utilities.css","webpack:///./source/_assets/css/main.css"],"sourcesContent":["@tailwind base;\n","@tailwind components;\n","/* a11y-light theme */\n/* Based on the Tomorrow Night Eighties theme: https://github.com/isagalaev/highlight.js/blob/master/src/styles/tomorrow-night-eighties.css */\n/* @author: ericwbailey */\n\n/* Comment */\n.hljs-comment,\n.hljs-quote {\n color: #696969;\n}\n\n/* Red */\n.hljs-variable,\n.hljs-template-variable,\n.hljs-tag,\n.hljs-name,\n.hljs-selector-id,\n.hljs-selector-class,\n.hljs-regexp,\n.hljs-deletion {\n color: #d91e18;\n}\n\n/* Orange */\n.hljs-number,\n.hljs-built_in,\n.hljs-builtin-name,\n.hljs-literal,\n.hljs-type,\n.hljs-params,\n.hljs-meta,\n.hljs-link {\n color: #aa5d00;\n}\n\n/* Yellow */\n.hljs-attribute {\n color: #aa5d00;\n}\n\n/* Green */\n.hljs-string,\n.hljs-symbol,\n.hljs-bullet,\n.hljs-addition {\n color: #008000;\n}\n\n/* Blue */\n.hljs-title,\n.hljs-section {\n color: #007faa;\n}\n\n/* Purple */\n.hljs-keyword,\n.hljs-selector-tag {\n color: #7928a1;\n}\n\n.hljs {\n display: block;\n overflow-x: auto;\n background: #fefefe;\n color: #545454;\n padding: 0.5em;\n}\n\n.hljs-emphasis {\n font-style: italic;\n}\n\n.hljs-strong {\n font-weight: bold;\n}\n\n@media screen and (-ms-high-contrast: active) {\n .hljs-addition,\n .hljs-attribute,\n .hljs-built_in,\n .hljs-builtin-name,\n .hljs-bullet,\n .hljs-comment,\n .hljs-link,\n .hljs-literal,\n .hljs-meta,\n .hljs-number,\n .hljs-params,\n .hljs-string,\n .hljs-symbol,\n .hljs-type,\n .hljs-quote {\n color: highlight;\n }\n\n .hljs-keyword,\n .hljs-selector-tag {\n font-weight: bold;\n }\n}\n","body {\n font-size: 17px;\n}\n\na {\n @apply font-semibold;\n @apply no-underline;\n @apply text-blue-600;\n\n &:hover {\n @apply text-blue-800;\n }\n}\n\nblockquote {\n @apply border-blue-400;\n @apply border-l-4;\n @apply font-normal;\n @apply italic;\n @apply my-8;\n @apply pl-6;\n @apply text-gray-800;\n @apply text-lg;\n}\n\ncode {\n @apply bg-gray-300;\n @apply px-2;\n @apply py-px;\n @apply rounded;\n @apply text-sm;\n}\n\ncode.hljs {\n @apply bg-transparent;\n @apply p-0;\n\n .hljs-comment,\n .hljs-keyword,\n .hljs-meta {\n @apply font-normal;\n @apply not-italic;\n }\n}\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n @apply leading-tight;\n @apply mb-4;\n @apply mt-8;\n @apply text-gray-900;\n\n &:first-child {\n @apply mt-0;\n }\n}\n\nh1 {\n @apply font-extrabold;\n @apply text-5xl;\n}\n\nh2 {\n @apply font-bold;\n @apply text-4xl;\n}\n\nh3 {\n @apply font-bold;\n @apply text-3xl;\n}\n\nh4 {\n @apply font-normal;\n @apply text-2xl;\n}\n\nh5 {\n @apply font-normal;\n @apply text-xl;\n}\n\nh6 {\n @apply font-light;\n @apply text-lg;\n}\n\nhr {\n @apply border-b;\n @apply border-blue-200;\n @apply my-12;\n @apply rounded-full;\n}\n\nli {\n ul,\n ol {\n @apply my-0;\n }\n}\n\nol,\nul {\n @apply my-4;\n}\n\nol {\n @apply list-decimal;\n}\n\np {\n @apply my-3;\n\n @screen md {\n @apply my-6;\n }\n}\n\npre {\n @apply bg-gray-200;\n @apply leading-loose;\n @apply my-6;\n @apply overflow-x-auto;\n @apply p-4;\n @apply rounded;\n @apply shadow;\n @apply text-base;\n\n code {\n @apply bg-transparent;\n @apply block;\n @apply p-0;\n }\n}\n\n::selection {\n @apply bg-blue-500;\n @apply text-white;\n}\n",".nav-menu {\n @apply -mt-12;\n @apply -mx-8;\n @apply bg-gray-200;\n @apply mb-8;\n @apply pb-4;\n @apply pt-8;\n @apply px-4;\n @apply shadow;\n @apply w-auto;\n\n @screen lg {\n @apply -mx-4;\n @apply bg-transparent;\n @apply block;\n @apply border-b-0;\n @apply mt-1;\n @apply pl-0;\n @apply pr-4;\n @apply pt-0;\n @apply shadow-none;\n @apply w-1/4;\n }\n}\n\n.nav-menu__item {\n @apply block;\n @apply no-underline;\n @apply mb-3;\n @apply mt-0;\n @apply text-gray-800;\n @apply text-sm;\n}\n",".docsearch-input {\n background-image: url('/assets/img/magnifying-glass.svg');\n background-position: 0.8em;\n background-repeat: no-repeat;\n text-indent: 1.2em;\n\n @screen lg {\n &:focus {\n @apply w-2/3;\n }\n }\n\n @screen xl {\n &:focus {\n @apply w-1/2;\n }\n }\n\n\n}\n\n.docsearch-input__wrapper {\n @apply absolute;\n @apply bg-white;\n @apply mt-7;\n @apply left-0;\n @apply top-0;\n @apply px-4;\n @apply w-full;\n @apply z-10;\n\n @screen md {\n @apply mt-0;\n @apply px-0;\n @apply relative;\n }\n}\n\n.algolia-autocomplete {\n @apply text-right;\n @apply w-full;\n\n .ds-dropdown-menu {\n @apply w-full;\n\n max-width: 750px !important;\n min-width: auto !important;\n\n .algolia-docsearch-suggestion {\n .algolia-docsearch-suggestion--content {\n @apply w-full;\n\n @screen md {\n @apply w-2/3;\n }\n }\n\n .algolia-docsearch-suggestion--text {\n @apply font-normal;\n\n line-height: 1.4;\n }\n\n .algolia-docsearch-suggestion--wrapper {\n @apply py-3;\n }\n\n .algolia-docsearch-suggestion--subcategory-column {\n @apply hidden;\n\n @screen md {\n @apply w-1/3;\n @apply inline-block;\n }\n }\n }\n }\n}\n","@tailwind utilities;\n","@import 'tailwindcss/base';\n@import 'tailwindcss/components';\n\n/* Code syntax highlighting, powered by https://highlightjs.org */\n@import 'highlight.js/styles/a11y-light.css';\n\n@import 'base';\n@import 'navigation';\n@import 'documentation';\n@import 'search';\n\n@import 'tailwindcss/utilities';\n"],"names":[],"sourceRoot":""} -------------------------------------------------------------------------------- /build/assets/build/js/main.js.LICENSE.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | * @overview es6-promise - a tiny implementation of Promises/A+. 3 | * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) 4 | * @license Licensed under MIT license 5 | * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE 6 | * @version v4.2.8+1e68dce6 7 | */ 8 | -------------------------------------------------------------------------------- /build/assets/build/mix-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "/js/main.js": "/js/main.js?id=3a5947e5c536204a73d6696a440ab1d3", 3 | "/css/main.css": "/css/main.css?id=b87090b28240f77f250533a5c492cd3f" 4 | } 5 | -------------------------------------------------------------------------------- /build/assets/img/blueprint-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laravel-shift/blueprint-docs/77207907ab5695ba3b2605b5de6b2ad6e199c59e/build/assets/img/blueprint-logo.png -------------------------------------------------------------------------------- /build/assets/img/icon-stack.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Group 7 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /build/assets/img/icon-terminal.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | terminal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /build/assets/img/icon-window.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Group 6 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /build/assets/img/laravel-blueprint-code-generator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laravel-shift/blueprint-docs/77207907ab5695ba3b2605b5de6b2ad6e199c59e/build/assets/img/laravel-blueprint-code-generator.png -------------------------------------------------------------------------------- /build/assets/img/logo-github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laravel-shift/blueprint-docs/77207907ab5695ba3b2605b5de6b2ad6e199c59e/build/assets/img/logo-github.png -------------------------------------------------------------------------------- /build/assets/img/logo-large.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Group 2 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /build/assets/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laravel-shift/blueprint-docs/77207907ab5695ba3b2605b5de6b2ad6e199c59e/build/assets/img/logo.png -------------------------------------------------------------------------------- /build/assets/img/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /build/assets/img/magnifying-glass.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /build/docs/advanced-configuration/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Blueprint | Advanced Configuration 23 | 24 | 25 | 26 | 27 | 28 | 29 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
46 |
47 |
48 | 57 | 58 |
59 |
60 | 66 | 67 |
68 | 69 | 79 | 80 | 95 | 96 |
97 |
98 |
99 |
100 | 101 |
102 |
103 |
104 | 288 | 289 |
290 |

Blueprint Configuration

291 | 292 |

Blueprint aims to provide sensible defaults which align nicely with Laravel's conventions. However, you are free to configure Blueprint to follow your own custom conventions.

293 | 294 |

You may publish the configuration file when running the blueprint:new command by passing the --config (or -c) flag:

295 | 296 |
php artisan blueprint:new --config
297 | 
298 | 299 |

Alternatively, you may publish the configuration file with the following standalone command:

300 | 301 |
php artisan vendor:publish --tag=blueprint-config
302 | 
303 | 304 |

This will copy a blueprint.php file into the config folder. Similar to the default Laravel configuration files, each of the configuration options are preceded by a detailed comment.

305 | 306 |

In summary, there are options for customizing the paths and namespaces for generated components, as well as options to toggle code generation. For example, to always generate foreign key constraints or PHPDocs for model properties.

307 | 308 |

To see all the available options, browse the blueprint.php configuration file on GitHub.

309 |
310 | 311 | 320 |
321 |
322 |
323 | 324 | 325 | 326 | 337 | 352 | 353 | 356 | 357 | 358 | -------------------------------------------------------------------------------- /build/docs/contributing/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Blueprint | Contributing to Blueprint 23 | 24 | 25 | 26 | 27 | 28 | 29 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
46 |
47 |
48 | 57 | 58 |
59 |
60 | 66 | 67 |
68 | 69 | 79 | 80 | 95 | 96 |
97 |
98 |
99 |
100 | 101 |
102 |
103 |
104 | 288 | 289 |
290 |

Contributing to Blueprint

291 | 292 |

Contributions may be made by submitting a Pull Request against the master branch.

293 | 294 |

Submitted PRs should:

295 | 296 |
    297 |
  • Explain the change, ideally using before and after examples.
  • 298 |
  • Include tests which verify the change.
  • 299 |
  • Pass all build steps.
  • 300 |
301 | 302 |

You may also contribute by opening an issue to report a bug or suggest a new feature. Or submit a Pull Request to improve the Blueprint Documentation.

303 | 304 |

If you are so inclined, you may also say "thanks" or proclaim your love of Blueprint on Twitter.

305 |
306 | 307 | 316 |
317 |
318 |
319 | 320 | 321 | 322 | 333 | 348 | 349 | 352 | 353 | 354 | -------------------------------------------------------------------------------- /build/docs/generating-database-seeders/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Blueprint | Generating Database Seeders 23 | 24 | 25 | 26 | 27 | 28 | 29 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
46 |
47 |
48 | 57 | 58 |
59 |
60 | 66 | 67 |
68 | 69 | 79 | 80 | 95 | 96 |
97 |
98 |
99 |
100 | 101 |
102 |
103 |
104 | 288 | 289 |
290 |

Generating Database Seeders

291 | 292 |

Blueprint also supports defining a seeders section within a draft file to generate database seeders for a given model.

293 | 294 |

The syntax for this section is simply seeders: value, where value is a comma separated list of model references.

295 | 296 |

For example:

297 | 298 |
models:
299 |   Post:
300 |     title: string:400
301 |     content: longtext
302 |     published_at: nullable timestamp
303 | 
304 |   Comment:
305 |     post_id: id
306 |     content: longtext
307 |     user_id: id
308 | 
309 |   User:
310 |     name: string
311 | 
312 | seeders: Post, Comment
313 | 
314 | 315 |

From this definition, Blueprint will create two seeders: PostSeeder and CommentSeeder, respectively.

316 | 317 |

Notice Blueprint does not create a UserSeeder in this instance since it was not included in the list of model references.

318 | 319 |

The code within the generated seeder uses the model factories to seed the database with 5 records.

320 | 321 |

For example, within the PostSeeder, Blueprint would generate the following code:

322 | 323 |
public function run(): void
324 | {
325 |     factory(\App\Post::class, 5)->create();
326 | }
327 | 
328 |
329 | 330 | 339 |
340 |
341 |
342 | 343 | 344 | 345 | 356 | 371 | 372 | 375 | 376 | 377 | -------------------------------------------------------------------------------- /build/docs/getting-started/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Blueprint | Getting Started 23 | 24 | 25 | 26 | 27 | 28 | 29 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
46 |
47 |
48 | 57 | 58 |
59 |
60 | 66 | 67 |
68 | 69 | 79 | 80 | 95 | 96 |
97 |
98 |
99 |
100 | 101 |
102 |
103 |
104 | 288 | 289 |
290 |

Getting Started

291 | 292 |

Blueprint is an open-source tool for rapidly generating multiple Laravel components from a single, human readable definition.

293 | 294 |

Blueprint has two driving principles:

295 | 296 |
    297 |
  1. Increase development speed
  2. 298 |
  3. Promote Laravel conventions
  4. 299 |
300 | 301 |

Requirements

302 | 303 |

Blueprint requires a Laravel application running version 6.0 or higher.

304 | 305 |

While Blueprint may be more flexible in a future version, it currently assumes a standard project structure using the default App namespace.

306 |
307 | 308 | 317 |
318 |
319 |
320 | 321 | 322 | 323 | 334 | 349 | 350 | 353 | 354 | 355 | -------------------------------------------------------------------------------- /build/docs/videos/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Blueprint | Videos 23 | 24 | 25 | 26 | 27 | 28 | 29 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
46 |
47 |
48 | 57 | 58 |
59 |
60 | 66 | 67 |
68 | 69 | 79 | 80 | 95 | 96 |
97 |
98 |
99 |
100 | 101 |
102 |
103 |
104 | 288 | 289 |
290 |

Blueprint Videos

291 | 292 |

Below are a list of videos which demonstrate using Blueprint.

293 | 294 | 300 |
301 | 302 | 311 |
312 |
313 |
314 | 315 | 316 | 317 | 328 | 343 | 344 | 347 | 348 | 349 | -------------------------------------------------------------------------------- /build/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laravel-shift/blueprint-docs/77207907ab5695ba3b2605b5de6b2ad6e199c59e/build/favicon.ico -------------------------------------------------------------------------------- /build/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Blueprint 23 | 24 | 25 | 26 | 27 | 28 | 29 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
46 |
47 |
48 | 57 | 58 |
59 |
60 | 66 | 67 |
68 | 69 | 79 | 80 |
81 |
82 |
83 |
84 | 85 |
86 |
87 |
88 |
89 |

Blueprint

90 | 91 |

Code generation for Laravel developers

92 | 93 |

Rapidly develop multiple Laravel components
from a single, human readable domain language.

94 | 95 | 99 |
100 | 101 | Blueprint large logo 102 |
103 | 104 |
105 | 106 |
107 |
108 | window icon 109 |

Draft your application
with a simple syntax

110 |

Blueprint uses a simple YAML syntax to define your models and controllers offering shorthands and leveraging conventions to maximize the developer experience.

111 |
112 | 113 |
114 | terminal icon 115 |

Generate code using
artisan commands

116 |

Blueprint comes with artisan commands making it easy and familiar to build new components and reference existing within your Laravel application.

117 |
118 | 119 |
120 | stack icon 121 |

Output multiple Laravel
components at once

122 |

Blueprint not only generates models and controllers, but factories, migrations, form requests, events, jobs, and mailables. Oh, and tests too.

123 |
124 |
125 |
126 |
127 | 128 | 129 | 130 | 145 | 146 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /build/sitemap.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | https://blueprint.laravel-shift.com 5 | 2025-04-16T12:38:04-04:00 6 | daily 7 | 8 | 9 | https://blueprint.laravel-shift.com/docs/controller-statements 10 | 2025-04-16T12:38:04-04:00 11 | daily 12 | 13 | 14 | https://blueprint.laravel-shift.com/docs/available-commands 15 | 2025-04-16T12:38:04-04:00 16 | daily 17 | 18 | 19 | https://blueprint.laravel-shift.com/docs/model-data-types 20 | 2025-04-16T12:38:04-04:00 21 | daily 22 | 23 | 24 | https://blueprint.laravel-shift.com/docs/generated-tests 25 | 2025-04-16T12:38:04-04:00 26 | daily 27 | 28 | 29 | https://blueprint.laravel-shift.com/docs/advanced-configuration 30 | 2025-04-16T12:38:04-04:00 31 | daily 32 | 33 | 34 | https://blueprint.laravel-shift.com/docs/videos 35 | 2025-04-16T12:38:04-04:00 36 | daily 37 | 38 | 39 | https://blueprint.laravel-shift.com/docs/model-relationships 40 | 2025-04-16T12:38:04-04:00 41 | daily 42 | 43 | 44 | https://blueprint.laravel-shift.com/docs/getting-started 45 | 2025-04-16T12:38:04-04:00 46 | daily 47 | 48 | 49 | https://blueprint.laravel-shift.com/docs/keys-and-indexes 50 | 2025-04-16T12:38:04-04:00 51 | daily 52 | 53 | 54 | https://blueprint.laravel-shift.com/docs/contributing 55 | 2025-04-16T12:38:04-04:00 56 | daily 57 | 58 | 59 | https://blueprint.laravel-shift.com/docs/defining-controllers 60 | 2025-04-16T12:38:04-04:00 61 | daily 62 | 63 | 64 | https://blueprint.laravel-shift.com/docs/generating-database-seeders 65 | 2025-04-16T12:38:04-04:00 66 | daily 67 | 68 | 69 | https://blueprint.laravel-shift.com/docs/controller-shorthands 70 | 2025-04-16T12:38:04-04:00 71 | daily 72 | 73 | 74 | https://blueprint.laravel-shift.com/docs/model-shorthands 75 | 2025-04-16T12:38:04-04:00 76 | daily 77 | 78 | 79 | https://blueprint.laravel-shift.com/docs/defining-models 80 | 2025-04-16T12:38:04-04:00 81 | daily 82 | 83 | 84 | https://blueprint.laravel-shift.com/docs/installation 85 | 2025-04-16T12:38:04-04:00 86 | daily 87 | 88 | 89 | https://blueprint.laravel-shift.com/docs/model-references 90 | 2025-04-16T12:38:04-04:00 91 | daily 92 | 93 | 94 | https://blueprint.laravel-shift.com/docs/extending-blueprint 95 | 2025-04-16T12:38:04-04:00 96 | daily 97 | 98 | 99 | https://blueprint.laravel-shift.com/docs/generating-components 100 | 2025-04-16T12:38:04-04:00 101 | daily 102 | 103 | 104 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "tightenco/jigsaw": "^1.3", 4 | "tightenco/jigsaw-docs-template": "^1.0", 5 | "samdark/sitemap": "^2.2" 6 | }, 7 | "autoload": { 8 | "psr-4": { 9 | "App\\Listeners\\": "listeners/" 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /config.php: -------------------------------------------------------------------------------- 1 | '', 7 | 'production' => false, 8 | 'siteName' => 'Blueprint', 9 | 'siteDescription' => 'A code generation tool for Laravel developers to rapidly generate multiple Laravel components from a single, human readable file.', 10 | 11 | // Algolia DocSearch credentials 12 | 'docsearchApiKey' => '', 13 | 'docsearchIndexName' => '', 14 | 15 | // navigation menu 16 | 'navigation' => require_once('navigation.php'), 17 | 18 | // helpers 19 | 'isActive' => function ($page, $path) { 20 | return Str::endsWith(trimPath($page->getPath()), trimPath($path)); 21 | }, 22 | 'isActiveParent' => function ($page, $menuItem) { 23 | if (is_object($menuItem) && $menuItem->children) { 24 | return $menuItem->children->contains(function ($child) use ($page) { 25 | return trimPath($page->getPath()) == trimPath($child); 26 | }); 27 | } 28 | }, 29 | 'url' => function ($page, $path) { 30 | return Str::startsWith($path, 'http') ? $path : '/' . trimPath($path); 31 | }, 32 | ]; 33 | -------------------------------------------------------------------------------- /config.production.php: -------------------------------------------------------------------------------- 1 | 'https://blueprint.laravel-shift.com', 5 | 'production' => true, 6 | 'build' => [ 7 | 'destination' => 'build' 8 | ], 9 | 10 | // DocSearch credentials 11 | 'docsearchApiKey' => 'e7636fa4e7966c21a67c7cc2e10de70c', 12 | 'docsearchAppId' => 'AV69P8LQ8H', 13 | 'docsearchIndexName' => 'laravelshift_blueprint', 14 | ]; 15 | -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | npm run production 2 | vendor/bin/jigsaw build --quiet production 3 | git add build/ 4 | git commit -m 'Deploy' 5 | git push origin HEAD 6 | -------------------------------------------------------------------------------- /listeners/GenerateSitemap.php: -------------------------------------------------------------------------------- 1 | getConfig('baseUrl'); 20 | 21 | if (! $baseUrl) { 22 | echo("\nTo generate a sitemap.xml file, please specify a 'baseUrl' in config.php.\n\n"); 23 | 24 | return; 25 | } 26 | 27 | $sitemap = new Sitemap($jigsaw->getDestinationPath() . '/sitemap.xml'); 28 | 29 | collect($jigsaw->getOutputPaths()) 30 | ->reject(function ($path) { 31 | return $this->isExcluded($path); 32 | })->each(function ($path) use ($baseUrl, $sitemap) { 33 | $sitemap->addItem(rtrim($baseUrl, '/') . $path, time(), Sitemap::DAILY); 34 | }); 35 | 36 | $sitemap->write(); 37 | } 38 | 39 | public function isExcluded($path) 40 | { 41 | return Str::is($this->exclude, $path); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /navigation.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'url' => '/docs/getting-started', 6 | 'children' => [ 7 | 'Installation' => '/docs/installation', 8 | 'Generating Components' => '/docs/generating-components', 9 | 'Available Commands' => '/docs/available-commands', 10 | ], 11 | ], 12 | 'Defining Models' => [ 13 | 'url' => '/docs/defining-models', 14 | 'children' => [ 15 | 'Types & Modifiers' => '/docs/model-data-types', 16 | 'Keys and Indexes' => '/docs/keys-and-indexes', 17 | 'Relationships' => '/docs/model-relationships', 18 | 'Shorthands' => '/docs/model-shorthands', 19 | 'Generating Seeders' => '/docs/generating-database-seeders', 20 | ], 21 | ], 22 | 'Defining Controllers' => [ 23 | 'url' => '/docs/defining-controllers', 24 | 'children' => [ 25 | 'Statements' => '/docs/controller-statements', 26 | 'Model References' => '/docs/model-references', 27 | 'Shorthands' => '/docs/controller-shorthands', 28 | 'Generated Tests' => '/docs/generated-tests', 29 | ], 30 | ], 31 | 'Configuration' => '/docs/advanced-configuration', 32 | 'Extending' => '/docs/extending-blueprint', 33 | 'Contributing' => '/docs/contributing', 34 | 'Videos' => '/docs/videos' 35 | ]; 36 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "local": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --env=local --config=node_modules/laravel-mix/setup/webpack.config.js", 5 | "staging": "cross-env NODE_ENV=staging node_modules/webpack/bin/webpack.js --progress --hide-modules --env=staging --config=node_modules/laravel-mix/setup/webpack.config.js", 6 | "production": "mix --production", 7 | "dev": "npm run local", 8 | "watch": "npm run local -- --watch", 9 | "development": "mix", 10 | "watch-poll": "mix watch -- --watch-options-poll=1000", 11 | "hot": "mix watch --hot", 12 | "prod": "npm run production" 13 | }, 14 | "devDependencies": { 15 | "docsearch.js": "^2.6.3", 16 | "browser-sync": "^2.27.4", 17 | "browser-sync-webpack-plugin": "^2.3.0", 18 | "highlight.js": "^10.5.0", 19 | "laravel-mix": "^6.0.39", 20 | "postcss": "^8.4.40", 21 | "postcss-import": "^14.0.2", 22 | "tailwindcss": "^3.4.6" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /source/404.blade.php: -------------------------------------------------------------------------------- 1 | @extends('_layouts.master') 2 | 3 | @section('body') 4 |
5 |

404

6 | 7 |

Page not found

8 | 9 |
10 | 11 |

12 | Need to update this page? See the Jigsaw documentation. 13 |

14 |
15 | @endsection 16 | -------------------------------------------------------------------------------- /source/_assets/css/base.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-size: 17px; 3 | } 4 | 5 | a { 6 | @apply font-semibold; 7 | @apply no-underline; 8 | @apply text-blue-600; 9 | 10 | &:hover { 11 | @apply text-blue-800; 12 | } 13 | } 14 | 15 | blockquote { 16 | @apply border-blue-400; 17 | @apply border-l-4; 18 | @apply font-normal; 19 | @apply italic; 20 | @apply my-8; 21 | @apply pl-6; 22 | @apply text-gray-800; 23 | @apply text-lg; 24 | } 25 | 26 | code { 27 | @apply bg-gray-300; 28 | @apply px-2; 29 | @apply py-px; 30 | @apply rounded; 31 | @apply text-sm; 32 | } 33 | 34 | code.hljs { 35 | @apply bg-transparent; 36 | @apply p-0; 37 | 38 | .hljs-comment, 39 | .hljs-keyword, 40 | .hljs-meta { 41 | @apply font-normal; 42 | @apply not-italic; 43 | } 44 | } 45 | 46 | h1, 47 | h2, 48 | h3, 49 | h4, 50 | h5, 51 | h6 { 52 | @apply leading-tight; 53 | @apply mb-4; 54 | @apply mt-8; 55 | @apply text-gray-900; 56 | 57 | &:first-child { 58 | @apply mt-0; 59 | } 60 | } 61 | 62 | h1 { 63 | @apply font-extrabold; 64 | @apply text-5xl; 65 | } 66 | 67 | h2 { 68 | @apply font-bold; 69 | @apply text-4xl; 70 | } 71 | 72 | h3 { 73 | @apply font-bold; 74 | @apply text-3xl; 75 | } 76 | 77 | h4 { 78 | @apply font-normal; 79 | @apply text-2xl; 80 | } 81 | 82 | h5 { 83 | @apply font-normal; 84 | @apply text-xl; 85 | } 86 | 87 | h6 { 88 | @apply font-light; 89 | @apply text-lg; 90 | } 91 | 92 | hr { 93 | @apply border-b; 94 | @apply border-blue-200; 95 | @apply my-12; 96 | @apply rounded-full; 97 | } 98 | 99 | li { 100 | ul, 101 | ol { 102 | @apply my-0; 103 | } 104 | } 105 | 106 | ol, 107 | ul { 108 | @apply my-4; 109 | } 110 | 111 | ol { 112 | @apply list-decimal; 113 | } 114 | 115 | p { 116 | @apply my-3; 117 | 118 | @screen md { 119 | @apply my-6; 120 | } 121 | } 122 | 123 | pre { 124 | @apply bg-gray-200; 125 | @apply leading-loose; 126 | @apply my-6; 127 | @apply overflow-x-auto; 128 | @apply p-4; 129 | @apply rounded; 130 | @apply shadow; 131 | @apply text-base; 132 | 133 | code { 134 | @apply bg-transparent; 135 | @apply block; 136 | @apply p-0; 137 | } 138 | } 139 | 140 | ::selection { 141 | @apply bg-blue-500; 142 | @apply text-white; 143 | } 144 | -------------------------------------------------------------------------------- /source/_assets/css/documentation.css: -------------------------------------------------------------------------------- 1 | /* Add your custom styles here */ 2 | -------------------------------------------------------------------------------- /source/_assets/css/main.css: -------------------------------------------------------------------------------- 1 | @import 'tailwindcss/base'; 2 | @import 'tailwindcss/components'; 3 | 4 | /* Code syntax highlighting, powered by https://highlightjs.org */ 5 | @import 'highlight.js/styles/a11y-light.css'; 6 | 7 | @import 'base'; 8 | @import 'navigation'; 9 | @import 'documentation'; 10 | @import 'search'; 11 | 12 | @import 'tailwindcss/utilities'; 13 | -------------------------------------------------------------------------------- /source/_assets/css/navigation.css: -------------------------------------------------------------------------------- 1 | .nav-menu { 2 | @apply -mt-12; 3 | @apply -mx-8; 4 | @apply bg-gray-200; 5 | @apply mb-8; 6 | @apply pb-4; 7 | @apply pt-8; 8 | @apply px-4; 9 | @apply shadow; 10 | @apply w-auto; 11 | 12 | @screen lg { 13 | @apply -mx-4; 14 | @apply bg-transparent; 15 | @apply block; 16 | @apply border-b-0; 17 | @apply mt-1; 18 | @apply pl-0; 19 | @apply pr-4; 20 | @apply pt-0; 21 | @apply shadow-none; 22 | @apply w-1/4; 23 | } 24 | } 25 | 26 | .nav-menu__item { 27 | @apply block; 28 | @apply no-underline; 29 | @apply mb-3; 30 | @apply mt-0; 31 | @apply text-gray-800; 32 | @apply text-sm; 33 | } 34 | -------------------------------------------------------------------------------- /source/_assets/css/search.css: -------------------------------------------------------------------------------- 1 | .docsearch-input { 2 | background-image: url('/assets/img/magnifying-glass.svg'); 3 | background-position: 0.8em; 4 | background-repeat: no-repeat; 5 | text-indent: 1.2em; 6 | 7 | @screen lg { 8 | &:focus { 9 | @apply w-2/3; 10 | } 11 | } 12 | 13 | @screen xl { 14 | &:focus { 15 | @apply w-1/2; 16 | } 17 | } 18 | 19 | 20 | } 21 | 22 | .docsearch-input__wrapper { 23 | @apply absolute; 24 | @apply bg-white; 25 | @apply mt-7; 26 | @apply left-0; 27 | @apply top-0; 28 | @apply px-4; 29 | @apply w-full; 30 | @apply z-10; 31 | 32 | @screen md { 33 | @apply mt-0; 34 | @apply px-0; 35 | @apply relative; 36 | } 37 | } 38 | 39 | .algolia-autocomplete { 40 | @apply text-right; 41 | @apply w-full; 42 | 43 | .ds-dropdown-menu { 44 | @apply w-full; 45 | 46 | max-width: 750px !important; 47 | min-width: auto !important; 48 | 49 | .algolia-docsearch-suggestion { 50 | .algolia-docsearch-suggestion--content { 51 | @apply w-full; 52 | 53 | @screen md { 54 | @apply w-2/3; 55 | } 56 | } 57 | 58 | .algolia-docsearch-suggestion--text { 59 | @apply font-normal; 60 | 61 | line-height: 1.4; 62 | } 63 | 64 | .algolia-docsearch-suggestion--wrapper { 65 | @apply py-3; 66 | } 67 | 68 | .algolia-docsearch-suggestion--subcategory-column { 69 | @apply hidden; 70 | 71 | @screen md { 72 | @apply w-1/3; 73 | @apply inline-block; 74 | } 75 | } 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /source/_assets/js/main.js: -------------------------------------------------------------------------------- 1 | window.docsearch = require('docsearch.js'); 2 | 3 | import hljs from 'highlight.js/lib/highlight'; 4 | 5 | hljs.registerLanguage('bash', require('highlight.js/lib/languages/bash')); 6 | hljs.registerLanguage('shell', require('highlight.js/lib/languages/shell')); 7 | hljs.registerLanguage('json', require('highlight.js/lib/languages/json')); 8 | hljs.registerLanguage('php', require('highlight.js/lib/languages/php')); 9 | hljs.registerLanguage('yaml', require('highlight.js/lib/languages/yaml')); 10 | 11 | document.querySelectorAll('pre code').forEach((block) => { 12 | hljs.highlightBlock(block); 13 | }); 14 | -------------------------------------------------------------------------------- /source/_layouts/documentation.blade.php: -------------------------------------------------------------------------------- 1 | @extends('_layouts.master') 2 | 3 | @section('nav-toggle') 4 | @include('_nav.menu-toggle') 5 | @endsection 6 | 7 | @section('body') 8 |
9 |
10 | 13 | 14 |
15 | @yield('content') 16 |
17 | 18 | 27 |
28 |
29 | @endsection 30 | -------------------------------------------------------------------------------- /source/_layouts/master.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | @if ($page->docsearchApiKey && $page->docsearchIndexName) 21 | 22 | @endif 23 | 24 | {{ $page->siteName }}{{ $page->title ? ' | ' . $page->title : '' }} 25 | 26 | 27 | 28 | 29 | @stack('meta') 30 | 31 | @if ($page->production) 32 | 33 | 40 | @endif 41 | 42 | 43 | 44 | 45 | @if ($page->docsearchApiKey && $page->docsearchIndexName) 46 | 47 | @endif 48 | 49 | 50 | 51 | 52 |
53 |
54 |
55 | 64 | 65 |
66 |
67 | @if ($page->docsearchApiKey && $page->docsearchIndexName) 68 | @include('_nav.search-input') 69 | @endif 70 |
71 | 72 | 82 | 83 | @yield('nav-toggle') 84 |
85 |
86 |
87 |
88 | 89 |
90 | @yield('body') 91 |
92 | 93 | 94 | 95 | @stack('scripts') 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /source/_nav/menu-item.blade.php: -------------------------------------------------------------------------------- 1 |
  • 2 | @if ($url = is_string($item) ? $item : $item->url) 3 | {{-- Menu item with URL--}} 4 | 7 | {{ $label }} 8 | 9 | @else 10 | {{-- Menu item without URL--}} 11 | 12 | @endif 13 | 14 | @if (! is_string($item) && $item->children) 15 | {{-- Recursively handle children --}} 16 | @include('_nav.menu', ['items' => $item->children, 'level' => ++$level]) 17 | @endif 18 |
  • 19 | -------------------------------------------------------------------------------- /source/_nav/menu-toggle.blade.php: -------------------------------------------------------------------------------- 1 | 16 | 17 | @push('scripts') 18 | 29 | @endpush 30 | -------------------------------------------------------------------------------- /source/_nav/menu.blade.php: -------------------------------------------------------------------------------- 1 | @php $level = $level ?? 0 @endphp 2 | 3 | 8 | -------------------------------------------------------------------------------- /source/_nav/search-input.blade.php: -------------------------------------------------------------------------------- 1 | 7 | 8 | @push('scripts') 9 | @if ($page->docsearchApiKey && $page->docsearchIndexName) 10 | 25 | @endif 26 | @endpush 27 | -------------------------------------------------------------------------------- /source/assets/img/blueprint-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laravel-shift/blueprint-docs/77207907ab5695ba3b2605b5de6b2ad6e199c59e/source/assets/img/blueprint-logo.png -------------------------------------------------------------------------------- /source/assets/img/icon-stack.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Group 7 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /source/assets/img/icon-terminal.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | terminal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /source/assets/img/icon-window.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Group 6 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /source/assets/img/laravel-blueprint-code-generator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laravel-shift/blueprint-docs/77207907ab5695ba3b2605b5de6b2ad6e199c59e/source/assets/img/laravel-blueprint-code-generator.png -------------------------------------------------------------------------------- /source/assets/img/logo-github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laravel-shift/blueprint-docs/77207907ab5695ba3b2605b5de6b2ad6e199c59e/source/assets/img/logo-github.png -------------------------------------------------------------------------------- /source/assets/img/logo-large.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Group 2 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /source/assets/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laravel-shift/blueprint-docs/77207907ab5695ba3b2605b5de6b2ad6e199c59e/source/assets/img/logo.png -------------------------------------------------------------------------------- /source/assets/img/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /source/assets/img/magnifying-glass.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /source/docs/advanced-configuration.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Advanced Configuration 3 | description: Publish the configuration file to configure Blueprint to follow your own custom conventions. 4 | extends: _layouts.documentation 5 | section: content 6 | --- 7 | ## Blueprint Configuration {#blueprint-configuration} 8 | Blueprint aims to provide sensible defaults which align nicely with Laravel's conventions. However, you are free to configure Blueprint to follow your own custom conventions. 9 | 10 | You may publish the configuration file when running the `blueprint:new` command by passing the `--config` (or `-c`) flag: 11 | 12 | ```sh 13 | php artisan blueprint:new --config 14 | ``` 15 | 16 | Alternatively, you may publish the configuration file with the following standalone command: 17 | 18 | ```sh 19 | php artisan vendor:publish --tag=blueprint-config 20 | ``` 21 | 22 | This will copy a `blueprint.php` file into the `config` folder. Similar to the default Laravel configuration files, each of the configuration options are preceded by a detailed comment. 23 | 24 | In summary, there are options for customizing the paths and namespaces for generated components, as well as options to toggle code generation. For example, to always generate foreign key constraints or PHPDocs for model properties. 25 | 26 | To see all the available options, browse the [`blueprint.php` configuration file on GitHub](https://github.com/laravel-shift/blueprint/blob/master/config/blueprint.php). 27 | -------------------------------------------------------------------------------- /source/docs/available-commands.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Blueprint Commands 3 | description: Blueprint comes with a set of artisan commands for generating new components and referencing existing components within your Laravel application. 4 | extends: _layouts.documentation 5 | section: content 6 | --- 7 | ## Blueprint Commands {#blueprint-commands} 8 | Blueprint comes with a set of `artisan` commands which are helpful during code generation. All of these commands are under the `blueprint` namespace. 9 | 10 | While we will cover each of the commands below, you may get additional help for any of these commands by using the `--help` option. For example: 11 | 12 | ```sh 13 | php artisan blueprint:build --help 14 | ``` 15 | 16 | ### Build Command {#build-command} 17 | The `blueprint:build` command is the one you'll use most often as this handles [Generating Components](/docs/generating-components). 18 | 19 | It accepts a single argument of path to your _draft_ file. This argument is optional. By default, Blueprint will attempt to load a `draft.yaml` (or `draft.yml`) file from the project root folder. 20 | 21 | As such, it's convenient to use the `draft.yaml` file for defining components, but reuse it instead of creating separate _draft_ files each time you run the `blueprint:build` command. 22 | 23 | When complete, `blueprint:build` will output a list of the files it created and updated. 24 | 25 | ### New Command {#new-command} 26 | Blueprint includes a `blueprint:new` command. This command may be helpful when you want to start using Blueprint within your project. 27 | 28 | The `blueprint:new` command will generate a `draft.yaml` file with stubs for the `models` and `controllers` sections, as well as run the [`trace` command](#trace-command) to preload your existing models into Blueprint's cache. 29 | 30 | ^^^ 31 | This command has optional flags. `--config` (or `-c`) for also publishing the configuration file, and `--stubs` (or `-s`) for publishing the stub files. 32 | ^^^ 33 | 34 | ### Erase Command {#erase-command} 35 | Blueprint also comes with a `blueprint:erase` command. Anytime you run `blueprint:build`, the list of generated components is cached in a local `.blueprint` file. 36 | 37 | The `blueprint:erase` command can be used to _undo_ the last `blueprint:build` command. Upon running this command, any of the files generated during the last _build_ will be deleted. 38 | 39 | If you realize a mistake after running `blueprint:build` and would like to _rebuild_ your components, your may run `blueprint:erase` and `blueprint:build`. 40 | 41 | ^^^ 42 | While the `blueprint:erase` command is offered for convenience, its capabilities are limited. Instead, Blueprint recommends running `blueprint:build` from a _clean working state_. This way, you can use version control commands to _undo_ the changes with finer control. 43 | ^^^ 44 | 45 | ### Publish Stubs Command {#stubs-command} 46 | Blueprint allows you to publish and modify the stubs. Similiar to Laravel, Blueprint uses these files when generating new components. Blueprint will use any custom stubs, before falling back to the default stubs. 47 | 48 | To publish the stubs for customizing, you may run the `blueprint:stubs` command. 49 | 50 | ### Trace Command {#trace-command} 51 | When using Blueprint with existing applications, you may need to reference existing models when generating new components. Furthermore, even though Blueprint caches the generated model definitions in a `.blueprint` file, this file may become outdated as you continue to develop your application. 52 | 53 | At anytime, you may run the `blueprint:trace` command to have Blueprint analyze your application and update its cache with all of your existing models. 54 | -------------------------------------------------------------------------------- /source/docs/contributing.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Contributing to Blueprint 3 | description: Contribute to Blueprint by submitting an issue, opening a Pull Request, adding to the docs, or sharing your love of Blueprint on Twitter. 4 | extends: _layouts.documentation 5 | section: content 6 | --- 7 | ## Contributing to Blueprint {#contributing-to-blueprint} 8 | Contributions may be made by submitting a Pull Request against the `master` branch. 9 | 10 | Submitted PRs should: 11 | 12 | - Explain the change, ideally using _before_ and _after_ examples. 13 | - Include tests which verify the change. 14 | - Pass all build steps. 15 | 16 | You may also contribute by [opening an issue](https://github.com/laravel-shift/blueprint/issues) to report a bug or suggest a new feature. Or submit a Pull Request to improve the [Blueprint Documentation](https://github.com/laravel-shift/blueprint-docs). 17 | 18 | If you are so inclined, you may also say "thanks" or proclaim your love of Blueprint [on Twitter](https://twitter.com/gonedark). 19 | -------------------------------------------------------------------------------- /source/docs/controller-shorthands.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Controller Shorthands 3 | description: Learn to use syntax shorthands to generate controllers even faster with Blueprint. 4 | extends: _layouts.documentation 5 | section: content 6 | --- 7 | ## Controller Shorthands {#controller-shorthands} 8 | In addition to some of the statement shorthands and model reference conveniences, Blueprint also offers shorthands for generating [resource](#resource-shorthand) and [invokable](#invokable-shorthand) controllers. 9 | 10 | ### Resource Shorthand {#resource-shorthand} 11 | This aligns with Laravel‘s preference for creating [resource controllers](https://laravel.com/docs/controllers#resource-controllers). 12 | 13 | Instead of having to write out all of the actions and statements common to CRUD behavior within your controllers, you may instead use the `resource` shorthand. 14 | 15 | The `resource` shorthand automatically infers the model reference based on the controller name. Blueprint will expand this into the 7 resource actions with the appropriate statements for each action: `index`, `create`, `store`, `show`, `edit`, `update`, and `destroy`. 16 | 17 | For example, the following represents the _longhand_ definition of resource controller: 18 | 19 | ```yaml 20 | controllers: 21 | Post: 22 | index: 23 | query: all:posts 24 | render: post.index with:posts 25 | create: 26 | render: post.create 27 | store: 28 | validate: post 29 | save: post 30 | flash: post.id 31 | redirect: post.index 32 | show: 33 | render: post.show with:post 34 | edit: 35 | render: post.edit with:post 36 | update: 37 | validate: post 38 | update: post 39 | flash: post.id 40 | redirect: post.index 41 | destroy: 42 | delete: post 43 | redirect: post.index 44 | ``` 45 | 46 | Instead, you may generate the equivalent by simply writing `resource`. 47 | 48 | ```yaml 49 | controllers: 50 | Post: 51 | resource 52 | ``` 53 | 54 | By default, the `resource` shorthand generates the 7 _web_ resource actions. Of course, you are welcome to set this explicitly as `resource: web`. 55 | 56 | Blueprint doesn’t stop there. You may also specify a value of `api`. A value of `api` would generate the 5 resource actions of an API controller with the appropriate statements and responses for each action: `index`, `store`, `show`, `update`, and `destroy`. 57 | 58 | You may also specify the exact controller actions you wish to generate by specifying any of the 7 resource actions as a comma separated list. If you wish to use the API actions, prefix the action with `api.`. 59 | 60 | The following examples demonstrates which methods would be generated for each of the shorthands. 61 | 62 | ```yaml 63 | # generate only index and show actions 64 | resource: index, show 65 | 66 | # generate only store and update API actions 67 | resource: api.store, api.update 68 | 69 | # generate "web" index and API destroy actions 70 | resource: index, api.destroy 71 | ``` 72 | 73 | While you may use this shorthand to generate these controller actions quickly, and update the code after, you may also combine the `resource` shorthand with any additional actions or even override the defaults. 74 | 75 | The following example demonstrates the definition for controller which will generate the all 7 resource actions, plus a `download` action, and will use the defined statements for the `show` action instead of the shorthand defaults. 76 | 77 | ```yaml 78 | controllers: 79 | Post: 80 | resource: all 81 | download: 82 | find: post.id 83 | respond: post 84 | show: 85 | query: comments where:post.id 86 | render: post.show with:post,comments 87 | ``` 88 | 89 | ### Invokable Shorthand {#invokable-shorthand} 90 | You may also use Blueprint to generate [single action controllers](https://laravel.com/docs/controllers#single-action-controllers), 91 | using the `invokable` shorthand: 92 | 93 | ```yaml 94 | controllers: 95 | Report: 96 | invokable 97 | ``` 98 | 99 | The above draft is equivalent to explicitly defining an `__invoke` action which renders a view with the same name as the controller: 100 | 101 | ```yaml 102 | controllers: 103 | Report: 104 | __invoke: 105 | render: report 106 | ``` 107 | 108 | For convenience, you may also define an `invokable` action instead of having to remember the underlying `__invoke` syntax: 109 | 110 | ```yaml 111 | controllers: 112 | Report: 113 | invokable: 114 | fire: ReportGenerated 115 | render: report 116 | ``` 117 | 118 | All of the above draft files would generate the following route for an invokable controller: 119 | 120 | ```php 121 | Route::get('/report', App\Http\Controllers\ReportController::class); 122 | ``` 123 | -------------------------------------------------------------------------------- /source/docs/controller-statements.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Controller Statements 3 | description: Blueprint comes with an expressive set of statements to define behavior common within Laravel controllers. 4 | extends: _layouts.documentation 5 | section: content 6 | --- 7 | ## Controller Statements {#controller-statements} 8 | Blueprint comes with an expressive set of statements which define code within each controller action, but also additional components to generate. 9 | 10 | Each statement is a `key: value` pair. 11 | 12 | The `key` defines the _type_ of statement to generate. Currently, Blueprint supports the following types of statements: `delete`, `dispatch`, `find`, `fire`, `flash`, `notify`, `query`, `redirect`, `render`, `resource`, `respond`, `save`, `send`, `store`, `update`, `validate`. 13 | 14 | 15 | #### delete {#delete-statement} 16 | Generates an Eloquent statement for deleting a model. Blueprint uses the controller action to infer which statement to generate. 17 | 18 | For example, within a `destroy` controller action, Blueprint will generate a `$model->delete()` statement. Otherwise, a `Model::destroy()` statement will be generated. 19 | 20 | 21 | #### dispatch {#dispatch-statement} 22 | Generates a statement to dispatch a [Job](https://laravel.com/docs/queues#creating-jobs) using the `value` to instantiate an object and pass any data. 23 | 24 | For example: 25 | 26 | ```yaml 27 | dispatch: SyncMedia with:post 28 | ``` 29 | 30 | If the referenced _job_ class does not exist, Blueprint will create one using any data to define properties and a `__construct` method which assigns them. 31 | 32 | 33 | #### find {#find-statement} 34 | Generates an Eloquent `find` statement. If the `value` provided is a qualified [reference](#references), Blueprint will expand the reference to determine the model. Otherwise, Blueprint will attempt to use the controller to determine the related model. 35 | 36 | 37 | #### fire {#fire-statement} 38 | Generates a statement to dispatch a [Event](https://laravel.com/docs/events#defining-events) using the `value` to instantiate the object and pass any data. 39 | 40 | For example: 41 | 42 | ```yaml 43 | fire: NewPost with:post 44 | ``` 45 | 46 | If the referenced _event_ class does not exist, Blueprint will create one using any data to define properties and a `__construct` method which assigns them. 47 | 48 | 49 | #### flash {#flash-statement} 50 | Generates a statement to [flash data](https://laravel.com/docs/session#flash-data) to the session. Blueprint will use the `value` as the session key and expands the reference as the session value. 51 | 52 | For example: 53 | 54 | ```yaml 55 | flash: post.title 56 | ``` 57 | 58 | #### notify {#notify-statement} 59 | Generates a statement to send a [Notification](https://laravel.com/docs/notifications) using the `value` to instantiate the object, specify the recipient, and pass any data. 60 | 61 | For example: 62 | 63 | ```yaml 64 | notify: post.author ReviewPost with:post 65 | ``` 66 | 67 | If the referenced _notification_ class does not exist, Blueprint will create one using any data to define properties and a `__construct` method which assigns them. 68 | 69 | You may also send a notification using the [`Notifiable` trait](https://laravel.com/docs/notifications#using-the-notifiable-trait) by passing a model reference. 70 | 71 | For example: 72 | 73 | ```yaml 74 | notify: user AccountAlert 75 | ``` 76 | 77 | 78 | #### query {#query-statement} 79 | Generates an Eloquent query statement using `key:value` pairs provided in `value`. Keys may be any of the basic query builder methods for [`where` clauses](https://laravel.com/docs/queries#where-clauses) and [ordering](https://laravel.com/docs/queries#ordering-grouping-limit-and-offset). 80 | 81 | For example: 82 | 83 | ```yaml 84 | query: where:title where:content order:published_at limit:5 85 | ``` 86 | 87 | Currently, Blueprint supports generating query statements for `all`, `get`, `pluck`, and `count`. 88 | 89 | 90 | #### redirect {#redirect-statement} 91 | Generates a `return redirect()` statement using the `value` as a reference to a named route passing any data parameters. 92 | 93 | For example: 94 | 95 | ```yaml 96 | redirect: post.show with:post 97 | ``` 98 | 99 | 100 | #### render {#render-statement} 101 | Generates a `return view();` statement for the referenced template with any additional view data as a comma separated list. 102 | 103 | For example: 104 | 105 | ```yaml 106 | render: post.show with:post,foo,bar 107 | ``` 108 | 109 | When the template does not exist, Blueprint will generate the Blade template for the view. 110 | 111 | 112 | #### resource {#resource-statement} 113 | Generates response statement for the [Resource](https://laravel.com/docs/eloquent-resources) to the referenced model. You may prefix the plural model reference with `collection` or `paginate` to return a resource collection or paginated collection, respectively. 114 | 115 | If the resource for the referenced model does not exist, Blueprint will create one using the model definition. 116 | 117 | For example: 118 | 119 | ```yaml 120 | resource: user 121 | resource: paginate:users 122 | ``` 123 | 124 | 125 | #### respond {#respond-statement} 126 | Generates a response which returns the given value. If the value is an integer, Blueprint will generate the proper `response()` statement using the value as the status code. Otherwise, the value will be used as the name of the variable to return. 127 | 128 | For example: 129 | 130 | ```yaml 131 | respond: post.show with:post 132 | ``` 133 | 134 | When the template does not exist, Blueprint will generate the Blade template for the view. 135 | 136 | 137 | #### save {#save-statement} 138 | Generates an Eloquent statement for saving a model. Blueprint uses the controller action to infer which statement to generate. 139 | 140 | For example, for a `store` controller action, Blueprint will generate a `Model::create()` statement. Otherwise, a `$model->save()` statement will be generated. 141 | 142 | 143 | #### send {#send-statement} 144 | Generates a statement to send a [Mailable](https://laravel.com/docs/mail#generating-mailables) or [Notification](https://laravel.com/docs/7.x/notifications) using the `value` to instantiate the object, specify the recipient, and pass any data. 145 | 146 | For example: 147 | 148 | ```yaml 149 | send: ReviewPost to:post.author with:post 150 | ``` 151 | 152 | If the referenced _mailable_ class does not exist, Blueprint will create one using any data to define properties and a `__construct` method which assigns them. 153 | 154 | 155 | #### store {#store-statement} 156 | Generates a statement to [store data](https://laravel.com/docs/session#storing-data) to the session. Blueprint will slugify the `value` as the session key and expands the reference as the session value. 157 | 158 | For example: 159 | 160 | ```yaml 161 | store: post.title 162 | ``` 163 | 164 | Generates: 165 | 166 | ```php 167 | $request->session()->put('post-title', $post->title); 168 | ``` 169 | 170 | 171 | #### update {#update-statement} 172 | Generates an Eloquent `update` statement for a model. You may use a value of the model reference to generate a generic `update` statement, or a comma separated list of column names to update. 173 | 174 | For example: 175 | 176 | ```yaml 177 | update: post 178 | update: title, content, author_id 179 | ``` 180 | 181 | When used with a resource controller, Blueprint will infer the model reference. 182 | 183 | #### validate {#validate-statement} 184 | Generates a form request with _rules_ based on the referenced model definition. You may use a value of the model reference to validate all columns, or a comma separated list of the column names to validate. 185 | 186 | For example: 187 | 188 | ```yaml 189 | validate: post 190 | validate: title, content, author_id 191 | ``` 192 | 193 | Blueprint also updates the type-hint of the injected request object, as well as any PHPDoc reference. 194 | -------------------------------------------------------------------------------- /source/docs/defining-controllers.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Defining Controllers 3 | description: Learn how to define controllers to generate not only controllers, but events, jobs, mailables, and more with Blueprint. 4 | extends: _layouts.documentation 5 | section: content 6 | --- 7 | ## Defining Controllers {#defining-controllers} 8 | Similar to [defining models](/docs/defining-models), Blueprint also supports defining _controllers_. You may do so within the `controllers` section, listing controllers by name. For each controller, you may define multiple `actions` which contain a list of _statements_. 9 | 10 | Consider the `controllers` section of the following draft file: 11 | 12 | ```yaml 13 | controllers: 14 | Post: 15 | index: 16 | query: all 17 | render: post.index with:posts 18 | create: 19 | render: post.create 20 | store: 21 | validate: title, content 22 | save: post 23 | redirect: post.index 24 | 25 | Comment: 26 | show: 27 | render: comment.show with:comment 28 | ``` 29 | 30 | From this definition, Blueprint will generate two controllers. A `PostController` with `index`, `create`, and `store` actions. And a `CommentController` with a `show` action. 31 | 32 | While you may specify the full name of a controller, Blueprint will automatically suffix controller names with `Controller` to follow Laravel's naming conventions. So, for convenience, you may simply specify the root name of the controller - be it singular or plural. 33 | 34 | Blueprint will generate the methods for each controller's actions. In addition, Blueprint will register routes for each action. The HTTP method will be inferred based on the action name. For example, Blueprint will register a `post` route for the `store` action. Otherwise, a `get` route will be registered. 35 | 36 | For these reasons, Blueprint recommends defining [resource controllers](/docs/controller-shorthands#resource-shorthand). Doing so allows Blueprint to infer details and generate even more code automatically. 37 | 38 | If you wish to namespace a controller, you may prefix the controller name. Blueprint will use this prefix as the namespace and properly save the generated controller class following Laravel conventions. For example, defining an `Api\Post` controller will generate a `App\Http\Controllers\Api\PostController` class saved as `app/Http/Controllers/Api/PostController.php`. 39 | 40 | Review the [advanced configuration](/docs/advanced-configuration) to customize these namespaces and paths further. 41 | 42 | Finally, Blueprint will analyze each of the statements listed within the action to generate the body of each controller method. For example, the above definition for the `index` action would generate the following controller method: 43 | 44 | ```php 45 | public function index(Request $request): View 46 | { 47 | $posts = Post::all(); 48 | 49 | return view('post.index', compact('posts')); 50 | } 51 | ``` 52 | 53 | Blueprint has statements for many of the common actions within Laravel. Some statements generate code beyond the controller. Review the [Controller Statements](/docs/controller-statements) section for a full list of statements and the code they generate. 54 | -------------------------------------------------------------------------------- /source/docs/defining-models.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Defining Models 3 | description: Learn how to define models to generate not only models, but migrations, factories, and more with Blueprint. 4 | extends: _layouts.documentation 5 | section: content 6 | --- 7 | ## Defining Models {#defining-models} 8 | Within the `models` section of a draft file you may define multiple models. Each model is defined with a _name_ followed by a list of columns. Columns are `key: value` pairs where `key` is the column name and `value` defines its attributes. 9 | 10 | Expanding on the example above, this draft file defines multiple models: 11 | 12 | ```yaml 13 | models: 14 | Post: 15 | title: string:400 16 | content: longtext 17 | published_at: nullable timestamp 18 | 19 | Comment: 20 | content: longtext 21 | published_at: nullable timestamp 22 | 23 | # additional models... 24 | ``` 25 | 26 | From this definition, Blueprint creates two models: `Post` and `Comment`, respectively. You may continue to define additional models. 27 | 28 | Blueprint recommends defining the model name in its _StudlyCase_, singular form to follow Laravel's model naming conventions. For example, use `Post` instead of `post`, `Posts`, or `posts`. 29 | 30 | For each of the model columns, the `key` will be used as the exact column name. The _attributes_ are a space separated string of [data types and modifiers](/docs/model-data-types). 31 | 32 | For example, using the `Post` definition above, Blueprint would generate the following migration code: 33 | 34 | ```php 35 | Schema::create('posts', function (Blueprint $table) { 36 | $table->id(); 37 | $table->string('title', 400); 38 | $table->longText('content'); 39 | $table->timestamp('published_at')->nullable(); 40 | $table->timestamps(); 41 | }); 42 | ``` 43 | -------------------------------------------------------------------------------- /source/docs/extending-blueprint.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Extending Blueprint 3 | description: Build your own add-ons to generate even more code or add your own syntax. 4 | extends: _layouts.documentation 5 | section: content 6 | --- 7 | ## Extending Blueprint {#extending-blueprint} 8 | From the beginning, Blueprint was designed to be extendable. There’s so much more code you could generate from the _draft_ file, as well as add your own syntax. 9 | 10 | Blueprint's primary focus will always be models and controllers. However, Blueprint encourages the Laravel community to create additional packages for generating even more components. 11 | 12 | For example, generating HTML for CRUD views, or components for [Laravel Nova](https://nova.laravel.com/). 13 | 14 | Blueprint is [bound to the container](https://laravel.com/docs/container#binding) as a _singleton_. This means you can resolve an instance of the `Blueprint` object either from within your own application or another Laravel package. 15 | 16 | All of the parsing and code generation is managed by this `Blueprint`. As such, you may register your own _lexer_ or _generator_ to generate additional code when `blueprint:build` is run. 17 | 18 | By registering a lexer, Blueprint will pass an array of the parsed tokens from the YAML file. With these, you could build your own data structures to add the Blueprints _tree_. 19 | 20 | Each registered generator is then called with tree and responsible for generating code. By default, this contains the parsed `models` and `controllers`. However, it may also contain additional items you may have placed in the tree with a lexer. 21 | 22 | In addition, I also discuss the architecture for extending Blueprint as well as adding new syntax for [database seeders](/docs/generating-database-seeders) during this [weekly Blueprint live-stream](https://www.youtube.com/watch?v=ZxpmSAXKG1A&t=1656). 23 | 24 | ### Community Addons 25 | You may use these addons in your projects or as an example of how to create your own and possibly share them with the Laravel community. 26 | 27 | 28 | - [Laravel Nova](https://github.com/Naoray/blueprint-nova-addon): Automatically generate Nova resources for each of the models specified in your _draft file_. 29 | - [API Resources Tests](https://github.com/axitbv/laravel-blueprint-streamlined-test-addon): Generate test code similar to Blueprint, but using an [opinionated and streamlined](https://github.com/laravel-shift/blueprint/pull/220) style. 30 | - [TALL-forms](https://github.com/tanthammar/tall-blueprint-addon): Automatically generate _TALL_ forms for each of the models specified in your draft file. 31 | 32 | ### Additional Services 33 | The following services also support using _Blueprint_ by either accepting or generating a draft file. 34 | 35 | - [drawSQL](https://drawsql.app/): Generate _draft file_ from your database entity relationship diagrams. 36 | -------------------------------------------------------------------------------- /source/docs/generated-tests.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Generated Tests 3 | description: Blueprint generates HTTP tests for any of the controller actions you define. 4 | extends: _layouts.documentation 5 | section: content 6 | --- 7 | ## Generated Tests {#generated-tests} 8 | For any controller action generated by Blueprint, a corresponding [HTTP Test](https://laravel.com/docs/http-tests) will be generated. Each test will contain _arrange_, _act_, and _assert_ code. 9 | 10 | The _arrange_ section will set up any [model factories](https://laravel.com/docs/database-testing#using-factories), as well as [mock](https://laravel.com/docs/mocking) any of the underlying Facades used within the controller action. 11 | 12 | Next, the _act_ section will send the appropriate HTTP request to the route with any parameters and request data for the controller action. 13 | 14 | Finally, the _assert_ section will verify the response as well as the behavior for any mock. 15 | 16 | While these tests are generated to be runnable out of the box, they are provided as a foundation. You should always review them for opportunities to strengthen their assertions and update them as you continue to write more code. 17 | 18 | ^^^ 19 | Blueprint generates PHPUnit tests by default. If you would to generate [Pest](https://pestphp.com/) tests instead, you may edit your [Blueprint config](/docs/advanced-configuration). Under the `generators` option, simply uncomment `\Blueprint\Generators\PestTestGenerator::class` and comment or remove `\Blueprint\Generators\PhpUnitTestGenerator::class`. 20 | ^^^ 21 | -------------------------------------------------------------------------------- /source/docs/generating-components.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Generating Components 3 | description: Learn how to rapidly generate Laravel components using a Blueprint draft file. 4 | extends: _layouts.documentation 5 | section: content 6 | --- 7 | ## Generating Components {#generating-components} 8 | Blueprint provides `artisan` commands to generate multiple Laravel components from a _draft_ file. The draft file contains a _definition_ using a YAML syntax, with a few _shorthands_ for convenience. 9 | 10 | By default, the `blueprint:build` command attempts to load a `draft.yaml` (or `draft.yml`) file. While you are welcome to create multiple _draft_ files, it's common to simply reuse the `draft.yaml` file over and over to generate code for your application. 11 | 12 | ### Draft file syntax {#draft-file-syntax} 13 | Within the draft file you define _models_ and _controllers_ using an expressive, human-readable YAML syntax. 14 | 15 | Let's review the following draft file: 16 | 17 | ```yaml 18 | models: 19 | Post: 20 | title: string:400 21 | content: longtext 22 | published_at: nullable timestamp 23 | 24 | controllers: 25 | Post: 26 | index: 27 | query: all 28 | render: post.index with:posts 29 | 30 | store: 31 | validate: title, content 32 | save: post 33 | send: ReviewNotification to:post.author with:post 34 | dispatch: SyncMedia with:post 35 | fire: NewPost with:post 36 | flash: post.title 37 | redirect: post.index 38 | ``` 39 | 40 | This draft file defines a model named `Post` and a controller with two actions: `index` and `store`. You may, of course, define multiple models and controllers in your own draft files. 41 | 42 | At first, this YAML may seem dense. But its syntax aligns nicely with the same syntax you'd use within Laravel. For example, all of the column data types are the same you would use when [creating columns](https://laravel.com/docs/migrations#columns) in a migration. 43 | 44 | In addition, the _statements_ within each controller actions use familiar terms like `validate`, `save`, and `fire`. 45 | 46 | Blueprint also leverages conventions and uses shorthands whenever possible. For example, you don't need to define the `id`, `created_at`, and `updated_at` columns in your models. Blueprint automatically generates these. 47 | 48 | You also don't have to specify the _Controller_ suffix when defining a controller. Blueprint automatically appends it when not present. All of this aligns with Blueprint's goal of _rapid development_. 49 | 50 | ### Generated code {#generated-code} 51 | From just these 20 lines of YAML, Blueprint will generate all of the following Laravel components: 52 | 53 | - A _model_ class for `Post` complete with `fillable`, `casts`, and `dates` properties, as well as relationships methods. 54 | - A _migration_ to create the `posts` table. 55 | - A [_factory_](https://laravel.com/docs/database-testing) intelligently set with fake data. 56 | - A _controller_ class for `PostController` with `index` and `store` actions complete with code generated for each [statement](#statements). 57 | - Resource _routes_ for the `PostController` actions. 58 | - A [_form request_](https://laravel.com/docs/validation#form-request-validation) of `StorePostRequest` validating `title` and `content` based on the `Post` model definition. 59 | - A _mailable_ class for `ReviewNotification` complete with a `post` property set through the _constructor_. 60 | - A _job_ class for `SyncMedia` complete with a `post` property set through the _constructor_. 61 | - An _event_ class for `NewPost` complete with a `post` property set through the _constructor_. 62 | - A _Blade template_ of `post/index.blade.php` rendered by `PostController@index`. 63 | - An [HTTP Test](https://laravel.com/docs/http-tests) complete with respective _arrange_, _act_, and _assert_ sections for the `PostController` actions. 64 | -------------------------------------------------------------------------------- /source/docs/generating-database-seeders.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Generating Database Seeders 3 | description: Learn how to define seeders with Blueprint to generate database seeders which leverage the generated model factories. 4 | extends: _layouts.documentation 5 | section: content 6 | --- 7 | ## Generating Database Seeders {#defining-models} 8 | Blueprint also supports defining a `seeders` section within a draft file to generate [database seeders](https://laravel.com/docs/seeding) for a given model. 9 | 10 | The syntax for this section is simply `seeders: value`, where `value` is a comma separated list of [model references](/docs/model-references). 11 | 12 | For example: 13 | 14 | ```yaml 15 | models: 16 | Post: 17 | title: string:400 18 | content: longtext 19 | published_at: nullable timestamp 20 | 21 | Comment: 22 | post_id: id 23 | content: longtext 24 | user_id: id 25 | 26 | User: 27 | name: string 28 | 29 | seeders: Post, Comment 30 | ``` 31 | 32 | From this definition, Blueprint will create two seeders: `PostSeeder` and `CommentSeeder`, respectively. 33 | 34 | Notice Blueprint does not create a `UserSeeder` in this instance since it was not included in the list of model references. 35 | 36 | The code within the generated seeder uses the [model factories](https://laravel.com/docs/database-testing#writing-factories) to seed the database with 5 records. 37 | 38 | For example, within the `PostSeeder`, Blueprint would generate the following code: 39 | 40 | ```php 41 | public function run(): void 42 | { 43 | factory(\App\Post::class, 5)->create(); 44 | } 45 | ``` 46 | -------------------------------------------------------------------------------- /source/docs/getting-started.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Getting Started 3 | description: Getting started with Jigsaw's docs starter template is as easy as 1, 2, 3. 4 | extends: _layouts.documentation 5 | section: content 6 | --- 7 | ## Getting Started {#getting-started} 8 | _Blueprint_ is an open-source tool for **rapidly generating multiple** Laravel components from a **single, human readable** definition. 9 | 10 | Blueprint has two driving principles: 11 | 12 | 1. Increase development speed 13 | 2. Promote Laravel conventions 14 | 15 | ### Requirements {#requirements} 16 | Blueprint requires a Laravel application running version 6.0 or higher. 17 | 18 | While Blueprint may be more flexible in a future version, it currently assumes a standard project structure using the default `App` namespace. 19 | -------------------------------------------------------------------------------- /source/docs/installation.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Installing Blueprint 3 | description: Add Blueprint to your Laravel application with Composer and setup your project in under 2 minutes. 4 | extends: _layouts.documentation 5 | section: content 6 | --- 7 | ## Installing Blueprint {#installing-blueprint} 8 | You may install Blueprint via Composer. It's recommended to install Blueprint as a development dependency of your Laravel application. If you haven't created a Laravel application yet, follow the [installation guide in the Laravel docs](https://laravel.com/docs/10.x/installation#creating-a-laravel-project). 9 | 10 | When ready, run the following command to install Blueprint: 11 | 12 | ```sh 13 | composer require -W --dev laravel-shift/blueprint 14 | ``` 15 | 16 | ### Additional Packages {#additional-packages} 17 | Blueprint also _suggests_ installing the [Laravel Test Assertions package](https://github.com/jasonmccreary/laravel-test-assertions), as the generated tests may use some of the additional, helpful assertions provided by this package. 18 | 19 | You may do so with the following command: 20 | 21 | ```sh 22 | composer require --dev jasonmccreary/laravel-test-assertions 23 | ``` 24 | 25 | ### Ignoring Blueprint files {#ignoring-blueprint-files} 26 | You may also consider ignoring files Blueprint uses from version control. We'll talk about these files more in [Generating Components](/docs/generating-components). But for now, these files are mainly used as a "scratch pad" or "local cache". So it's unlikely you'd want to track their changes. 27 | 28 | You may quickly add these files to your `.gitignore` with the following command: 29 | 30 | ```sh 31 | echo '/draft.yaml' >> .gitignore 32 | echo '/.blueprint' >> .gitignore 33 | ``` 34 | -------------------------------------------------------------------------------- /source/docs/keys-and-indexes.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Model Keys and Indexes 3 | description: Blueprint supports keys and indexes on your models through the column definition and by leveraging convention. 4 | extends: _layouts.documentation 5 | section: content 6 | --- 7 | ## Model Keys and Indexes {#model-keys-indexes} 8 | Blueprint supports keys and indexes on your models through the column definition and by leveraging convention. 9 | 10 | Within the column definition, you may specify a key or index using the `id` column type or the `foreign`, `index`, or `unique` column modifiers. 11 | 12 | The simplest of these are the `index` and `unique` modifiers. Blueprint will generate the necessary code to the migration to add the _index_. In turn, Laravel will create an index for this column. 13 | 14 | The `foreign` column modifier will also generate the necessary code to create an index on the column. In addition, it will generate code to add the reference and cascade "on delete" constraints. 15 | 16 | By default, Blueprint will automatically infer the foreign reference from the column name just as Laravel does. For example, a column name of `user_id`, would imply a reference to the `id` column of the `users` table. 17 | 18 | If you are not following Laravel's naming conventions, you may set the attribute on the `foreign` modifier. Blueprint supports either the foreign table name or the table and column name using dot notation. 19 | 20 | For example, all of the following column definitions generate a foreign reference to the `id` column of the `users` table. 21 | 22 | ```yaml 23 | user_id: id foreign 24 | owner_id: id foreign:users 25 | uid: id foreign:users.id 26 | ``` 27 | 28 | Finally, while the `id` column type does not create an explicit index on the database, it does imply a foreign key relationships for the model. 29 | 30 | Similar to the `foreign` column modifier, you may specify an attribute on the `id` column type. In this case, you specify the foreign model name or the model and column name using dot notation. 31 | 32 | ^^^ 33 | Blueprint will always create model relationships for `id` and `uuid` columns. So it is only necessary to specify `foreign` when you want to generate constraints. If you always want to generate foreign key constraints, you should enable at the `use_constraints` [configuration option](/docs/advanced-configuration). 34 | ^^^ 35 | 36 | 37 | ### Composite Indexes {#composite-indexes} 38 | Blueprint also supports adding a composite index. You may do so adding the `indexes` key to your model definition. This key accepts an array of key/value pairs, where the key is the type of index and the value is a comma separated list of column names. 39 | 40 | For example, this will add a unique composite index on the `owner_id` and the `badge_number` column of the `users` table. 41 | 42 | ```yaml 43 | User: 44 | indexes: 45 | - unique: owner_id, badge_number 46 | ``` 47 | -------------------------------------------------------------------------------- /source/docs/model-data-types.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Model Data Types 3 | description: Blueprint supports all of the column types within Laravel, as well as a few shorthands for defining models. 4 | extends: _layouts.documentation 5 | section: content 6 | --- 7 | ## Model Data Types {#model-data-types} 8 | Blueprint supports all of the [available column types](https://laravel.com/docs/migrations#creating-columns) within Laravel. Blueprint also has a built-in column type of `id`. This is one of the [model shorthands](/docs/model-shorthands). 9 | 10 | Some of these column types support additional attributes. For example, the `string` column type accepts a length, `decimal` accepts a _precision_ and _scale_, and an `enum` may accept a list of values. 11 | 12 | Within Blueprint, you may define these attributes by appending the column type with a colon (`:`) followed by the attribute value. For example: 13 | 14 | ```yaml 15 | payment_token: string:40 16 | total: decimal:8,2 17 | status: enum:pending,successful,failed 18 | ``` 19 | 20 | You may also specify _modifiers_ for each column. Blueprint supports most of the [column modifiers](https://laravel.com/docs/migrations#column-modifiers) available in Laravel, including: `autoIncrement`, `always`, `charset`, `collation`, `comment`, `default`, `foreign`, `index`, `nullable`, `onDelete`, `onUpdate`, `primary`, `unsigned`, `unique`, `useCurrent`, and `useCurrentOnUpdate`. 21 | 22 | ^^^ 23 | To give you full control, Blueprint uses the literal value you define for the `default` modifier. For example, defining an _integer_ with `default:1`, versus a _string_ with `default:'1'`. 24 | ^^^ 25 | 26 | Similar to the column type attributes, the `foreign` modifier also supports attributes. This is discussed in [Keys and Indexes](/docs/keys-and-indexes). 27 | 28 | The column type and modifiers are separated by a space. While you may specify these in any order, it's recommend to specify the column type first, then the modifiers. For example: 29 | 30 | ```yaml 31 | email: string:100 nullable index 32 | ``` 33 | 34 | ^^^ 35 | When specifying an attribute or modifier value which contains a space, you must wrap the value in double quotes (`"`). For example, `enum:Ordered,Completed,"On Hold"`. Blueprint will _unwrap_ the value during parsing. 36 | ^^^ 37 | -------------------------------------------------------------------------------- /source/docs/model-references.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Model References 3 | description: Learn how to leverage Blueprint to infer model references or specify your own. 4 | extends: _layouts.documentation 5 | section: content 6 | --- 7 | ## Model References {#model-references} 8 | For convenience, Blueprint will use the name of a controller to infer the related model. For example, Blueprint will assume a `PostController` relates to a `Post` model. 9 | 10 | Blueprint also supports a dot (`.`) syntax for more complex references. This allows you to define values which reference columns on other models. 11 | 12 | For example, to _find_ a `User` model within the `PostController` you may use: 13 | 14 | ```yaml 15 | controllers: 16 | Post: 17 | show: 18 | find: user.id 19 | # ... 20 | ``` 21 | 22 | While these references will often be used within _Eloquent_ and `query` statements, they may be used in other statements as well. When necessary, Blueprint will convert these into variable references using an arrow (`->`) syntax. 23 | 24 | Many times within a controller you will be referencing a model. Blueprint attempts to infer the context based on the controller name. 25 | 26 | However, there may be some statements where you need to reference additional models. You may do this by specifying the name of the model. This may be a model that you are generating in the current draft file or an existing model within your application. 27 | 28 | You should reference these models using their class name. For example, `User`. If you have namespaced the model, you should prefix it with the appropriate namespace relative to the model namespace. For example, `Admin\User`. 29 | 30 | If you wish to also reference an attribute of a model for one of the statements, you may specify it using dot notation. For example, `User.name`. 31 | 32 | Let’s consider the following draft file: 33 | 34 | ```yaml 35 | controllers: 36 | Post: 37 | index: 38 | query: all 39 | render: post.index with:posts 40 | create: 41 | find: user.id 42 | render: post.create with:user 43 | store: 44 | validate: title, published_at 45 | save: post 46 | redirect: post.show 47 | show: 48 | query: all:comments 49 | render: post.show with:post,comments 50 | 51 | ``` 52 | 53 | Based on the model name, Blueprint will use the model `Post` for any context that doesn’t reference a model by name. 54 | 55 | In this case, the `validate` statement will use `title`, `published_at` on the `Post` model. 56 | 57 | The `index` action will query all _posts_. However, the `show` action will query all _comments_. And the `create` action will find the `User` model by the `id` attribute. 58 | -------------------------------------------------------------------------------- /source/docs/model-relationships.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Model Relationships 3 | description: Blueprint also allows you to define many of the relationships available within Laravel. 4 | extends: _layouts.documentation 5 | section: content 6 | --- 7 | ## Model Relationships {#model-relationships} 8 | Blueprint also allows you to define many of the relationships available within Laravel, including: `belongsTo`, `hasOne`, `hasMany`, and `belongsToMany`. 9 | 10 | ^^^ 11 | While you may define the `belongsTo` relationship explicitly, it is not necessary. Simply defining a column with the `id` data type or `foreign` attribute is enough for Blueprint to automatically generate the relationship. 12 | ^^^ 13 | 14 | To define one of these relationships, you may add a `relationships` section to your model definition. Within this section, you specify the relationship type followed by a comma separated list of model names. 15 | 16 | For example, the following definition adds some common relationships to a `Post` model: 17 | 18 | ```yaml 19 | models: 20 | Post: 21 | title: string:400 22 | published_at: timestamp nullable 23 | relationships: 24 | hasMany: Comment 25 | belongsToMany: Media, Site 26 | belongsTo: \Spatie\LaravelPermission\Models\Role 27 | ``` 28 | 29 | ^^^ 30 | While you may specify the `relationships` anywhere within the model section, Blueprint recommends doing so at the bottom. 31 | ^^^ 32 | 33 | For each of these relationships, Blueprint will add the respective [Eloquent relationship](https://laravel.com/docs/eloquent-relationships) method within the generated model class. In addition, Blueprint will automatically generate the "pivot table" migration for any `belongsToMany` relationship. 34 | 35 | ^^^ 36 | When defining relationships or [foreign keys](/docs/keys-and-indexes) the referenced tables must exist. While Blueprint makes an effort to generate migrations for "pivot tables" last, it is still possible to encounter errors. If so, you may define your models without these relationships or constraints and add them manually later. 37 | ^^^ 38 | 39 | To specify a model which is not part of your application, you may provide the fully qualified class name. Be sure to include the initial `\` (backslash). For example, `\Spatie\LaravelPermission\Models\Role`. 40 | 41 | You may also _alias_ any of the relationships to give them a different name by suffixing the model name by appending the model name with a colon (`:`) followed by the name. For example: 42 | 43 | ```yaml 44 | models: 45 | Post: 46 | relationships: 47 | hasMany: Comment:reply 48 | ``` 49 | 50 | Blueprint will automatically pluralize the alias correctly based on the relationship type. 51 | 52 | Sometimes you may want to use an [intermediate model](https://laravel.com/docs/eloquent-relationships#defining-custom-intermediate-table-models) for a `belongsToMany` relationship. If so, you may prefix the alias with an ampersand (`&`) and reference the model name. For example: 53 | 54 | ```yaml 55 | User: 56 | relationships: 57 | belongsToMany: Team:&Membership 58 | ``` 59 | -------------------------------------------------------------------------------- /source/docs/model-shorthands.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Model Shorthands 3 | description: Learn to use syntax shorthands to generate models even faster with Blueprint. 4 | extends: _layouts.documentation 5 | section: content 6 | --- 7 | ## Model Shorthands {#model-shorthands} 8 | Blueprint provides several _shorthands_ when defining models. While using these may at time appear as invalid YAML, they are provided for developer convenience. Blueprint will properly expand these shorthands into valid YAML before parsing the draft file. 9 | 10 | Blueprint provides an implicit model shorthand by automatically generating the `id` and _timestamp_ (`created_at`, and `updated_at`) columns on every model. You never need to specify these columns when defining models. 11 | 12 | Of course, you are able to define these yourself at anytime. For example, if you want to use a different column type for the _id_ column, like `uuid`. 13 | 14 | You may also disable them by marking them as `false`. For example, to disable the _timestamp_ columns, you may add `timestamps: false` to your model definition. If you wish to generate the _timestamp_ columns with timezone column types, you may use the `timestampsTz` shorthand. 15 | 16 | Blueprint also offers a `softDeletes` shorthand. Adding this to your model definition will generate the appropriate `deleted_at` column, as well add the `SoftDeletes` trait to your model. Similarly, if you want timezone information, you may use the `softDeletesTz` shorthand. 17 | 18 | You may write these shorthands using the camel casing shown above or all lowercase. Blueprint supports both for developer convenience. 19 | 20 | To illustrate using these shorthands, here is the _longhand_ definition of a model: 21 | 22 | ```yaml 23 | models: 24 | Widget: 25 | id: id 26 | deleted_at: timestamp 27 | created_at: timestamp 28 | updated_at: timestamp 29 | ``` 30 | 31 | And again using shorthands: 32 | 33 | ```yaml 34 | models: 35 | Widget: 36 | id 37 | softDeletes 38 | timestamps 39 | ``` 40 | 41 | And finally, leveraging the full power of Blueprint by also using implicit model shorthands: 42 | 43 | ```yaml 44 | models: 45 | Widget: 46 | softDeletes 47 | ``` 48 | -------------------------------------------------------------------------------- /source/docs/videos.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Videos 3 | description: A list of video demonstrations, tutorials, and deep-dives on Blueprint. 4 | extends: _layouts.documentation 5 | section: content 6 | --- 7 | ## Blueprint Videos {#blueprint-videos} 8 | Below are a list of videos which demonstrate using Blueprint. 9 | 10 | - [Quick Demo](https://www.youtube.com/watch?v=A_gUCwni_6c) on YouTube 11 | - [Rapid Code Generation With Blueprint](https://laracasts.com/series/guest-spotlight/episodes/9) on Laracasts 12 | - [Create Models with Blueprint](https://laracasts.com/series/rapid-laravel-development-with-filament/episodes/1) on Laracasts 13 | - Weekly live-streams of [Building Blueprint](https://www.youtube.com/playlist?list=PLmwAMIdrAmK5q0c0JUqzW3u9tb0AqW95w) on YouTube 14 | -------------------------------------------------------------------------------- /source/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laravel-shift/blueprint-docs/77207907ab5695ba3b2605b5de6b2ad6e199c59e/source/favicon.ico -------------------------------------------------------------------------------- /source/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('_layouts.master') 2 | 3 | @section('body') 4 |
    5 |
    6 |
    7 |

    {{ $page->siteName }}

    8 | 9 |

    Code generation for Laravel developers

    10 | 11 |

    Rapidly develop multiple Laravel components
    from a single, human readable domain language.

    12 | 13 | 17 |
    18 | 19 | {{ $page->siteName }} large logo 20 |
    21 | 22 |
    23 | 24 |
    25 |
    26 | window icon 27 |

    Draft your application
    with a simple syntax

    28 |

    Blueprint uses a simple YAML syntax to define your models and controllers offering shorthands and leveraging conventions to maximize the developer experience.

    29 |
    30 | 31 |
    32 | terminal icon 33 |

    Generate code using
    artisan commands

    34 |

    Blueprint comes with artisan commands making it easy and familiar to build new components and reference existing within your Laravel application.

    35 |
    36 | 37 |
    38 | stack icon 39 |

    Output multiple Laravel
    components at once

    40 |

    Blueprint not only generates models and controllers, but factories, migrations, form requests, events, jobs, and mailables. Oh, and tests too.

    41 |
    42 |
    43 |
    44 | @endsection 45 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import("tailwindcss").Config} */ 2 | module.exports = { 3 | content: [ 4 | 'source/**/*.html', 5 | 'source/**/*.md', 6 | 'source/**/*.js', 7 | 'source/**/*.php', 8 | 'source/**/*.vue', 9 | ], 10 | options: { 11 | whitelist: [ 12 | /language/, 13 | /hljs/, 14 | /algolia/, 15 | ], 16 | }, 17 | theme: { 18 | extend: { 19 | fontFamily: { 20 | sans: [ 21 | 'Nunito Sans' 22 | ], 23 | mono: [ 24 | 'monospace', 25 | ], 26 | }, 27 | lineHeight: { 28 | normal: '1.6', 29 | loose: '1.75', 30 | }, 31 | maxWidth: { 32 | none: 'none', 33 | '7xl': '80rem', 34 | '8xl': '88rem' 35 | }, 36 | spacing: { 37 | '7': '1.75rem', 38 | '9': '2.25rem' 39 | }, 40 | boxShadow: { 41 | 'lg': '0 -1px 27px 0 rgba(0, 0, 0, 0.04), 0 4px 15px 0 rgba(0, 0, 0, 0.08)', 42 | } 43 | }, 44 | fontSize: { 45 | 'xs': '.8rem', 46 | 'sm': '.925rem', 47 | 'base': '1rem', 48 | 'lg': '1.125rem', 49 | 'xl': '1.25rem', 50 | '2xl': '1.5rem', 51 | '3xl': '1.75rem', 52 | '4xl': '2.125rem', 53 | '5xl': '2.625rem', 54 | '6xl': '10rem', 55 | }, 56 | }, 57 | variants: { 58 | borderRadius: ['responsive', 'focus'], 59 | borderWidth: ['responsive', 'active', 'focus'], 60 | width: ['responsive', 'focus'] 61 | }, 62 | plugins: [ 63 | function ({addUtilities}) { 64 | const newUtilities = { 65 | '.transition-fast': { 66 | transition: 'all .2s ease-out', 67 | }, 68 | '.transition': { 69 | transition: 'all .5s ease-out', 70 | }, 71 | } 72 | addUtilities(newUtilities) 73 | } 74 | ] 75 | } 76 | -------------------------------------------------------------------------------- /webpack.mix.js: -------------------------------------------------------------------------------- 1 | const mix = require('laravel-mix'); 2 | 3 | mix.disableSuccessNotifications(); 4 | mix.setPublicPath('source/assets/build'); 5 | 6 | mix.js('source/_assets/js/main.js', 'js') 7 | .css('source/_assets/css/main.css', 'css/main.css', [ 8 | require('postcss-import'), 9 | require('tailwindcss/nesting'), 10 | require('tailwindcss'), 11 | ]) 12 | .options({processCssUrls: false}) 13 | .sourceMaps() 14 | .version(); 15 | --------------------------------------------------------------------------------