├── .github ├── ISSUE_TEMPLATE │ └── bug-reporting.md └── workflows │ └── deploy.yml ├── .phpunit.result.cache ├── LICENSE.md ├── build ├── coverage.txt ├── coverage │ ├── Commands │ │ ├── CrudBase.php.html │ │ ├── CrudGenerate.php.html │ │ ├── CrudRemove.php.html │ │ ├── CrudTemplate.php.html │ │ ├── MakeCrud.php.html │ │ ├── dashboard.html │ │ └── index.html │ ├── Crud.php.html │ ├── Formatters │ │ ├── Formatter.php.html │ │ ├── dashboard.html │ │ └── index.html │ ├── Generators │ │ ├── BaseGen.php.html │ │ ├── ControllerGen.php.html │ │ ├── ModelGen.php.html │ │ ├── PolicyGen.php.html │ │ ├── RouteGen.php.html │ │ ├── Templates.php.html │ │ ├── ViewGen.php.html │ │ ├── dashboard.html │ │ └── index.html │ ├── ServiceProvider.php.html │ ├── Utils │ │ ├── FileUtils.php.html │ │ ├── NameUtils.php.html │ │ ├── RouteUtils.php.html │ │ ├── SchemaUtils.php.html │ │ ├── TextUtils.php.html │ │ ├── dashboard.html │ │ └── index.html │ ├── _css │ │ ├── bootstrap.min.css │ │ ├── custom.css │ │ ├── nv.d3.min.css │ │ ├── octicons.css │ │ └── style.css │ ├── _icons │ │ ├── file-code.svg │ │ └── file-directory.svg │ ├── _js │ │ ├── bootstrap.min.js │ │ ├── d3.min.js │ │ ├── file.js │ │ ├── jquery.min.js │ │ ├── nv.d3.min.js │ │ └── popper.min.js │ ├── dashboard.html │ ├── index.html │ └── template │ │ ├── dashboard.html │ │ ├── index.html │ │ └── stubs │ │ ├── Controllers │ │ ├── _controller_.php.html │ │ ├── dashboard.html │ │ └── index.html │ │ ├── Models │ │ ├── _model_.php.html │ │ ├── dashboard.html │ │ └── index.html │ │ ├── Policies │ │ ├── _policy_.php.html │ │ ├── dashboard.html │ │ └── index.html │ │ ├── dashboard.html │ │ ├── index.html │ │ ├── routes │ │ ├── _route_.php.html │ │ ├── dashboard.html │ │ └── index.html │ │ └── views │ │ ├── bootstrap │ │ ├── create.blade.php.html │ │ ├── dashboard.html │ │ ├── edit.blade.php.html │ │ ├── index.blade.php.html │ │ ├── index.html │ │ ├── partials │ │ │ ├── buttons │ │ │ │ ├── actions-trash.blade.php.html │ │ │ │ ├── actions.blade.php.html │ │ │ │ ├── dashboard.html │ │ │ │ └── index.html │ │ │ ├── dashboard.html │ │ │ ├── display │ │ │ │ ├── boolean.blade.php.html │ │ │ │ ├── dashboard.html │ │ │ │ ├── index.html │ │ │ │ ├── json.blade.php.html │ │ │ │ ├── string.blade.php.html │ │ │ │ └── text.blade.php.html │ │ │ ├── index.html │ │ │ ├── inputs │ │ │ │ ├── boolean.blade.php.html │ │ │ │ ├── dashboard.html │ │ │ │ ├── index.html │ │ │ │ ├── input.blade.php.html │ │ │ │ ├── json.blade.php.html │ │ │ │ ├── related.blade.php.html │ │ │ │ ├── select.blade.php.html │ │ │ │ └── textarea.blade.php.html │ │ │ └── render │ │ │ │ ├── dashboard.html │ │ │ │ ├── form.blade.php.html │ │ │ │ ├── index.html │ │ │ │ ├── show.blade.php.html │ │ │ │ └── table.blade.php.html │ │ └── show.blade.php.html │ │ ├── dashboard.html │ │ └── index.html └── report.junit.xml ├── composer.json ├── config └── crud.php ├── database └── migrations │ ├── leads_table.php │ ├── replies_table.php │ ├── tickets_table.php │ └── users_table.php ├── docs ├── .vitepress │ ├── cache │ │ └── deps │ │ │ ├── @theme_index.js │ │ │ ├── @theme_index.js.map │ │ │ ├── _metadata.json │ │ │ ├── package.json │ │ │ ├── vue.js │ │ │ └── vue.js.map │ └── config.js ├── CONTRIBUTING.md ├── LICENSE.md ├── badges.md ├── guide │ ├── about.md │ ├── authentication.md │ ├── crud.md │ ├── customization.md │ ├── gotchas.md │ ├── index.md │ ├── install.md │ ├── license.md │ ├── nesting.md │ ├── options.md │ ├── remove.md │ ├── roadmap.md │ ├── search.md │ └── soft-deletes.md ├── index.md └── readme.php ├── package.json ├── src ├── Commands │ ├── CrudBase.php │ ├── CrudGenerate.php │ ├── CrudRemove.php │ └── CrudTemplate.php ├── Crud.php ├── Formatters │ └── Formatter.php ├── Generators │ ├── BaseGen.php │ ├── ControllerGen.php │ ├── ModelGen.php │ ├── PolicyGen.php │ ├── RouteGen.php │ ├── Templates.php │ └── ViewGen.php ├── ServiceProvider.php ├── Utils │ ├── FileUtils.php │ ├── NameUtils.php │ ├── RouteUtils.php │ ├── SchemaUtils.php │ └── TextUtils.php └── template │ └── stubs │ ├── Controllers │ └── _controller_.php │ ├── Models │ └── _model_.php │ ├── Policies │ └── _policy_.php │ ├── routes │ └── _route_.php │ └── views │ ├── bootstrap │ ├── create-edit.blade.php │ ├── create.blade.php │ ├── edit.blade.php │ ├── index.blade.php │ ├── layout.blade.php │ ├── partials │ │ ├── buttons │ │ │ ├── actions-expanded.blade.php │ │ │ ├── actions-trash.blade.php │ │ │ └── actions.blade.php │ │ ├── display │ │ │ ├── boolean.blade.php │ │ │ ├── json.blade.php │ │ │ ├── string.blade.php │ │ │ └── text.blade.php │ │ ├── inputs │ │ │ ├── boolean.blade.php │ │ │ ├── input.blade.php │ │ │ ├── json.blade.php │ │ │ ├── related.blade.php │ │ │ ├── select.blade.php │ │ │ └── textarea.blade.php │ │ └── render │ │ │ ├── breadcrumbs.blade.php │ │ │ ├── cards.blade.php │ │ │ ├── chat.blade.php │ │ │ ├── form.blade.php │ │ │ ├── show.blade.php │ │ │ └── table.blade.php │ └── show.blade.php │ ├── larastrap │ ├── create-edit.blade.php │ ├── create.blade.php │ ├── edit.blade.php │ ├── index.blade.php │ ├── layout.blade.php │ ├── partials │ │ ├── buttons │ │ │ ├── actions-expanded.blade.php │ │ │ ├── actions-trash.blade.php │ │ │ └── actions.blade.php │ │ ├── display │ │ │ ├── boolean.blade.php │ │ │ ├── json.blade.php │ │ │ ├── string.blade.php │ │ │ └── text.blade.php │ │ ├── inputs │ │ │ ├── boolean.blade.php │ │ │ ├── input.blade.php │ │ │ ├── json.blade.php │ │ │ ├── related.blade.php │ │ │ ├── select.blade.php │ │ │ └── textarea.blade.php │ │ └── render │ │ │ ├── breadcrumbs.blade.php │ │ │ ├── cards.blade.php │ │ │ ├── chat.blade.php │ │ │ ├── form.blade.php │ │ │ ├── show.blade.php │ │ │ └── table.blade.php │ └── show.blade.php │ └── tailwind │ ├── create-edit.blade.php │ ├── create.blade.php │ ├── edit.blade.php │ ├── index.blade.php │ ├── layout.blade.php │ ├── partials │ ├── buttons │ │ ├── actions-trash.blade.php │ │ └── actions.blade.php │ ├── display │ │ ├── boolean.blade.php │ │ ├── json.blade.php │ │ ├── string.blade.php │ │ └── text.blade.php │ ├── inputs │ │ ├── boolean.blade.php │ │ ├── input.blade.php │ │ ├── json.blade.php │ │ ├── related.blade.php │ │ ├── select.blade.php │ │ └── textarea.blade.php │ └── render │ │ ├── breadcrumbs.blade.php │ │ ├── cards.blade.php │ │ ├── chat.blade.php │ │ ├── form.blade.php │ │ ├── show.blade.php │ │ └── table.blade.php │ └── show.blade.php └── yarn.lock /.github/ISSUE_TEMPLATE/bug-reporting.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: bug reporting 3 | about: How to report an issue 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | Before submitting a bug report please make sure to include the following information 11 | 12 | 1. Have you set the mysql password in the .env file? 13 | 14 | 2. Have you created the db migrations using `artisan migrate`? 15 | 16 | 3. Can laravel can connect to your mysql db? 17 | 18 | 4. Are you able to see the output for `User:all()`? 19 | 20 | 5. Can you see the tables you've created in the mysql database? (using phpmyadmin or mysql client) 21 | -------------------------------------------------------------------------------- /.github/workflows/deploy.yml: -------------------------------------------------------------------------------- 1 | name: Deploy 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | deploy: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v3 13 | with: 14 | fetch-depth: 0 15 | - uses: actions/setup-node@v3 16 | with: 17 | node-version: 16 18 | cache: yarn 19 | - run: yarn install --frozen-lockfile 20 | 21 | - name: Build 22 | run: yarn docs:build 23 | 24 | - name: Deploy 25 | uses: peaceiris/actions-gh-pages@v3 26 | with: 27 | github_token: ${{ secrets.GITHUB_TOKEN }} 28 | publish_dir: docs/.vitepress/dist 29 | # cname: example.com # if wanna deploy to custom domain -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright (c) San Kumar 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 | -------------------------------------------------------------------------------- /build/coverage.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | Code Coverage Report: 4 | 2022-12-24 03:08:27 5 | 6 | Summary: 7 | Classes: 44.44% (8/18) 8 | Methods: 87.39% (104/119) 9 | Lines: 91.13% (452/496) 10 | 11 | San\Crud\Commands\CrudBase 12 | Methods: 80.00% ( 4/ 5) Lines: 71.43% ( 10/ 14) 13 | San\Crud\Commands\CrudGenerate 14 | Methods: 66.67% ( 2/ 3) Lines: 98.97% ( 96/ 97) 15 | San\Crud\Commands\CrudRemove 16 | Methods: 66.67% ( 2/ 3) Lines: 89.13% ( 41/ 46) 17 | San\Crud\Commands\CrudTemplate 18 | Methods: 66.67% ( 2/ 3) Lines: 80.00% ( 16/ 20) 19 | San\Crud\Formatters\Formatter 20 | Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 3/ 3) 21 | San\Crud\Generators\BaseGen 22 | Methods: 100.00% (18/18) Lines: 100.00% ( 28/ 28) 23 | San\Crud\Generators\ControllerGen 24 | Methods: 82.35% (14/17) Lines: 94.12% ( 48/ 51) 25 | San\Crud\Generators\ModelGen 26 | Methods: 85.71% ( 6/ 7) Lines: 94.44% ( 17/ 18) 27 | San\Crud\Generators\PolicyGen 28 | Methods: 100.00% (12/12) Lines: 100.00% ( 17/ 17) 29 | San\Crud\Generators\RouteGen 30 | Methods: 100.00% (14/14) Lines: 100.00% ( 27/ 27) 31 | San\Crud\Generators\Templates 32 | Methods: 100.00% ( 5/ 5) Lines: 100.00% ( 10/ 10) 33 | San\Crud\Generators\ViewGen 34 | Methods: 83.33% ( 5/ 6) Lines: 94.34% ( 50/ 53) 35 | San\Crud\Utils\FileUtils 36 | Methods: 33.33% ( 1/ 3) Lines: 91.30% ( 21/ 23) 37 | San\Crud\Utils\NameUtils 38 | Methods: 100.00% ( 8/ 8) Lines: 100.00% ( 8/ 8) 39 | San\Crud\Utils\RouteUtils 40 | Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 13/ 13) 41 | San\Crud\Utils\SchemaUtils 42 | Methods: 70.00% ( 7/10) Lines: 68.97% ( 40/ 58) 43 | San\Crud\Utils\TextUtils 44 | Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 7/ 7) 45 | -------------------------------------------------------------------------------- /build/coverage/Formatters/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Coverage for /home/san/laravel/plugins/laravel-crud/src/Formatters 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 | 25 |
26 |
27 |
28 |
29 |
30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 53 | 54 | 55 | 61 | 62 | 63 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 81 | 82 | 83 | 89 | 90 | 91 | 97 | 98 | 99 | 100 | 101 | 102 | 103 |
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
48 |
49 | 100.00% covered (success) 50 |
51 |
52 |
100.00%
3 / 3
56 |
57 | 100.00% covered (success) 58 |
59 |
60 |
100.00%
1 / 1
64 |
65 | 100.00% covered (success) 66 |
67 |
68 |
100.00%
1 / 1
Formatter.php
76 |
77 | 100.00% covered (success) 78 |
79 |
80 |
100.00%
3 / 3
84 |
85 | 100.00% covered (success) 86 |
87 |
88 |
100.00%
1 / 1
92 |
93 | 100.00% covered (success) 94 |
95 |
96 |
100.00%
1 / 1
104 |
105 | 117 |
118 | 119 | 120 | -------------------------------------------------------------------------------- /build/coverage/_css/custom.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/san-kumar/laravel-crud/a8f30149291d4b95402dda4225050cdf2f8cea6f/build/coverage/_css/custom.css -------------------------------------------------------------------------------- /build/coverage/_css/octicons.css: -------------------------------------------------------------------------------- 1 | .octicon { 2 | display: inline-block; 3 | vertical-align: text-top; 4 | fill: currentColor; 5 | } 6 | -------------------------------------------------------------------------------- /build/coverage/_css/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: sans-serif; 3 | font-size: 1em; 4 | font-kerning: normal; 5 | font-variant-ligatures: common-ligatures; 6 | text-rendering: optimizeLegibility; 7 | padding-top: 10px; 8 | } 9 | 10 | .popover { 11 | max-width: none; 12 | } 13 | 14 | .octicon { 15 | margin-right:.25em; 16 | vertical-align: baseline; 17 | width: 0.75em; 18 | } 19 | 20 | .table-bordered>thead>tr>td { 21 | border-bottom-width: 1px; 22 | } 23 | 24 | .table tbody>tr>td, .table thead>tr>td { 25 | padding-top: 3px; 26 | padding-bottom: 3px; 27 | } 28 | 29 | .table-condensed tbody>tr>td { 30 | padding-top: 0; 31 | padding-bottom: 0; 32 | } 33 | 34 | .table .progress { 35 | margin-bottom: inherit; 36 | } 37 | 38 | .table-borderless th, .table-borderless td { 39 | border: 0 !important; 40 | } 41 | 42 | .table tbody tr.covered-by-large-tests, li.covered-by-large-tests, tr.success, td.success, li.success, span.success { 43 | background-color: #dff0d8; 44 | } 45 | 46 | .table tbody tr.covered-by-medium-tests, li.covered-by-medium-tests { 47 | background-color: #c3e3b5; 48 | } 49 | 50 | .table tbody tr.covered-by-small-tests, li.covered-by-small-tests { 51 | background-color: #99cb84; 52 | } 53 | 54 | .table tbody tr.danger, .table tbody td.danger, li.danger, span.danger { 55 | background-color: #f2dede; 56 | } 57 | 58 | .table tbody tr.warning, .table tbody td.warning, li.warning, span.warning { 59 | background-color: #fcf8e3; 60 | } 61 | 62 | .table tbody td.info { 63 | background-color: #d9edf7; 64 | } 65 | 66 | td.big { 67 | vertical-align: middle; 68 | width: 117px; 69 | } 70 | 71 | td.small { 72 | } 73 | 74 | td.codeLine { 75 | font-family: "Source Code Pro", "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; 76 | white-space: pre-wrap; 77 | } 78 | 79 | td span.comment { 80 | color: #888a85; 81 | } 82 | 83 | td span.default { 84 | color: #2e3436; 85 | } 86 | 87 | td span.html { 88 | color: #888a85; 89 | } 90 | 91 | td span.keyword { 92 | color: #2e3436; 93 | font-weight: bold; 94 | } 95 | 96 | pre span.string { 97 | color: #2e3436; 98 | } 99 | 100 | span.success, span.warning, span.danger { 101 | margin-right: 2px; 102 | padding-left: 10px; 103 | padding-right: 10px; 104 | text-align: center; 105 | } 106 | 107 | #toplink { 108 | position: fixed; 109 | left: 5px; 110 | bottom: 5px; 111 | outline: 0; 112 | } 113 | 114 | svg text { 115 | font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif; 116 | font-size: 11px; 117 | color: #666; 118 | fill: #666; 119 | } 120 | 121 | .scrollbox { 122 | height:245px; 123 | overflow-x:hidden; 124 | overflow-y:scroll; 125 | } 126 | 127 | table + .structure-heading { 128 | border-top: 1px solid lightgrey; 129 | padding-top: 0.5em; 130 | } 131 | -------------------------------------------------------------------------------- /build/coverage/_icons/file-code.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /build/coverage/_icons/file-directory.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /build/coverage/_js/file.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | var $window = $(window) 3 | , $top_link = $('#toplink') 4 | , $body = $('body, html') 5 | , offset = $('#code').offset().top 6 | , hidePopover = function ($target) { 7 | $target.data('popover-hover', false); 8 | 9 | setTimeout(function () { 10 | if (!$target.data('popover-hover')) { 11 | $target.popover('hide'); 12 | } 13 | }, 300); 14 | }; 15 | 16 | $top_link.hide().click(function(event) { 17 | event.preventDefault(); 18 | $body.animate({scrollTop:0}, 800); 19 | }); 20 | 21 | $window.scroll(function() { 22 | if($window.scrollTop() > offset) { 23 | $top_link.fadeIn(); 24 | } else { 25 | $top_link.fadeOut(); 26 | } 27 | }).scroll(); 28 | 29 | $('.popin') 30 | .popover({trigger: 'manual'}) 31 | .on({ 32 | 'mouseenter.popover': function () { 33 | var $target = $(this); 34 | var $container = $target.children().first(); 35 | 36 | $target.data('popover-hover', true); 37 | 38 | // popover already displayed 39 | if ($target.next('.popover').length) { 40 | return; 41 | } 42 | 43 | // show the popover 44 | $container.popover('show'); 45 | 46 | // register mouse events on the popover 47 | $target.next('.popover:not(.popover-initialized)') 48 | .on({ 49 | 'mouseenter': function () { 50 | $target.data('popover-hover', true); 51 | }, 52 | 'mouseleave': function () { 53 | hidePopover($container); 54 | } 55 | }) 56 | .addClass('popover-initialized'); 57 | }, 58 | 'mouseleave.popover': function () { 59 | hidePopover($(this).children().first()); 60 | } 61 | }); 62 | }); 63 | -------------------------------------------------------------------------------- /build/coverage/template/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Coverage for /home/san/laravel/plugins/laravel-crud/src/template 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 | 25 |
26 |
27 |
28 |
29 |
30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 53 | 54 | 55 | 61 | 62 | 63 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 81 | 82 | 83 | 89 | 90 | 91 | 97 | 98 | 99 | 100 | 101 | 102 | 103 |
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
48 |
49 | 0.00% covered (danger) 50 |
51 |
52 |
0.00%
0 / 274
56 |
57 | 0.00% covered (danger) 58 |
59 |
60 |
0.00%
0 / 16
64 |
65 | 0.00% covered (danger) 66 |
67 |
68 |
0.00%
0 / 2
stubs
76 |
77 | 0.00% covered (danger) 78 |
79 |
80 |
0.00%
0 / 274
84 |
85 | 0.00% covered (danger) 86 |
87 |
88 |
0.00%
0 / 16
92 |
93 | 0.00% covered (danger) 94 |
95 |
96 |
0.00%
0 / 2
104 |
105 | 117 |
118 | 119 | 120 | -------------------------------------------------------------------------------- /build/coverage/template/stubs/Models/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Coverage for /home/san/laravel/plugins/laravel-crud/src/template/stubs/Models 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 | 27 |
28 |
29 |
30 |
31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 |
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
n/a
0 / 0
_model_.php
n/a
0 / 0
n/a
0 / 0
n/a
0 / 0
76 |
77 | 89 |
90 | 91 | 92 | -------------------------------------------------------------------------------- /build/coverage/template/stubs/routes/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Coverage for /home/san/laravel/plugins/laravel-crud/src/template/stubs/routes 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 | 27 |
28 |
29 |
30 |
31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 |
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
50 |
51 | 0.00% covered (danger) 52 |
53 |
54 |
0.00%
0 / 5
n/a
0 / 0
n/a
0 / 0
_route_.php
68 |
69 | 0.00% covered (danger) 70 |
71 |
72 |
0.00%
0 / 5
n/a
0 / 0
n/a
0 / 0
86 |
87 | 99 |
100 | 101 | 102 | -------------------------------------------------------------------------------- /build/coverage/template/stubs/views/bootstrap/partials/display/boolean.blade.php.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Coverage for /home/san/laravel/plugins/laravel-crud/src/template/stubs/views/bootstrap/partials/display/boolean.blade.php 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 | 30 |
31 |
32 |
33 |
34 |
35 |
36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 |
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
53 |
54 | 0.00% covered (danger) 55 |
56 |
57 |
0.00%
0 / 1
n/a
0 / 0
CRAP
n/a
0 / 0
72 |
73 | 74 | 75 | 76 | 77 | 78 |
1{{ $_var_->_col_ ? "Yes" : "No" }}
79 | 80 | 81 | 92 |
93 | 94 | 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /build/coverage/template/stubs/views/bootstrap/partials/display/json.blade.php.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Coverage for /home/san/laravel/plugins/laravel-crud/src/template/stubs/views/bootstrap/partials/display/json.blade.php 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 | 30 |
31 |
32 |
33 |
34 |
35 |
36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 |
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
53 |
54 | 0.00% covered (danger) 55 |
56 |
57 |
0.00%
0 / 1
n/a
0 / 0
CRAP
n/a
0 / 0
72 |
73 | 74 | 75 | 76 | 77 | 78 |
1<textarea class="form-control" readonly>@json($_var_->_col_, JSON_PRETTY_PRINT)</textarea>
79 | 80 | 81 | 92 |
93 | 94 | 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /build/coverage/template/stubs/views/bootstrap/partials/display/string.blade.php.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Coverage for /home/san/laravel/plugins/laravel-crud/src/template/stubs/views/bootstrap/partials/display/string.blade.php 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 | 30 |
31 |
32 |
33 |
34 |
35 |
36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 |
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
53 |
54 | 0.00% covered (danger) 55 |
56 |
57 |
0.00%
0 / 1
n/a
0 / 0
CRAP
n/a
0 / 0
72 |
73 | 74 | 75 | 76 | 77 | 78 |
1{{ $_var_->_col_ ?: "(blank)" }}
79 | 80 | 81 | 92 |
93 | 94 | 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /build/coverage/template/stubs/views/bootstrap/partials/display/text.blade.php.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Coverage for /home/san/laravel/plugins/laravel-crud/src/template/stubs/views/bootstrap/partials/display/text.blade.php 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 | 30 |
31 |
32 |
33 |
34 |
35 |
36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 |
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
53 |
54 | 0.00% covered (danger) 55 |
56 |
57 |
0.00%
0 / 1
n/a
0 / 0
CRAP
n/a
0 / 0
72 |
73 | 74 | 75 | 76 | 77 | 78 |
1{{ Str::limit($_var_->_col_, 50) ?: "(blank)"}}
79 | 80 | 81 | 92 |
93 | 94 | 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /build/coverage/template/stubs/views/bootstrap/partials/inputs/input.blade.php.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Coverage for /home/san/laravel/plugins/laravel-crud/src/template/stubs/views/bootstrap/partials/inputs/input.blade.php 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 | 30 |
31 |
32 |
33 |
34 |
35 |
36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 |
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
53 |
54 | 0.00% covered (danger) 55 |
56 |
57 |
0.00%
0 / 1
n/a
0 / 0
CRAP
n/a
0 / 0
72 |
73 | 74 | 75 | 76 | 77 | 78 |
1<input type="_type_" name="_id_" id="_id_" class="form-control" value="{{_val_}}" _required_/>
79 | 80 | 81 | 92 |
93 | 94 | 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /build/coverage/template/stubs/views/bootstrap/partials/inputs/json.blade.php.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Coverage for /home/san/laravel/plugins/laravel-crud/src/template/stubs/views/bootstrap/partials/inputs/json.blade.php 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 | 30 |
31 |
32 |
33 |
34 |
35 |
36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 |
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
53 |
54 | 0.00% covered (danger) 55 |
56 |
57 |
0.00%
0 / 1
n/a
0 / 0
CRAP
n/a
0 / 0
72 |
73 | 74 | 75 | 76 | 77 | 78 |
1<textarea name="_id_" id="_id_" class="form-control" _required_>{{_val_}}</textarea>
79 | 80 | 81 | 92 |
93 | 94 | 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /build/coverage/template/stubs/views/bootstrap/partials/inputs/textarea.blade.php.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Coverage for /home/san/laravel/plugins/laravel-crud/src/template/stubs/views/bootstrap/partials/inputs/textarea.blade.php 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 | 30 |
31 |
32 |
33 |
34 |
35 |
36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 |
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
53 |
54 | 0.00% covered (danger) 55 |
56 |
57 |
0.00%
0 / 1
n/a
0 / 0
CRAP
n/a
0 / 0
72 |
73 | 74 | 75 | 76 | 77 | 78 |
1<textarea name="_id_" id="_id_" class="form-control" _required_>{{_val_}}</textarea>
79 | 80 | 81 | 92 |
93 | 94 | 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /build/coverage/template/stubs/views/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Coverage for /home/san/laravel/plugins/laravel-crud/src/template/stubs/views 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 | 27 |
28 |
29 |
30 |
31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 |
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
50 |
51 | 0.00% covered (danger) 52 |
53 |
54 |
0.00%
0 / 241
n/a
0 / 0
n/a
0 / 0
bootstrap
68 |
69 | 0.00% covered (danger) 70 |
71 |
72 |
0.00%
0 / 241
n/a
0 / 0
n/a
0 / 0
86 |
87 | 99 |
100 | 101 | 102 | -------------------------------------------------------------------------------- /build/report.junit.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/san-kumar/laravel-crud/a8f30149291d4b95402dda4225050cdf2f8cea6f/build/report.junit.xml -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "san-kumar/laravel-crud", 3 | "description": "Laravel CRUD generator: Generate CRUD for any db table with the crud:generate command.", 4 | "keywords": [ 5 | "artisan", 6 | "laravel", 7 | "crud", 8 | "view", 9 | "templates", 10 | "blade" 11 | ], 12 | "license": "MIT", 13 | "authors": [ 14 | { 15 | "name": "San Kumar", 16 | "email": "sanchitbh@gmail.com", 17 | "homepage": "https://dayandnight.in" 18 | } 19 | ], 20 | "require": { 21 | "php": "^8.0", 22 | "doctrine/dbal": "^3.5" 23 | }, 24 | "require-dev": { 25 | "laravel/framework": "^8.0 || ^9.0", 26 | "phpunit/phpunit": "^9.0 || ^10.0", 27 | "mockery/mockery": "^1.4", 28 | "orchestra/testbench": "*" 29 | }, 30 | "autoload": { 31 | "psr-4": { 32 | "San\\Crud\\": "src/" 33 | } 34 | }, 35 | "autoload-dev": { 36 | "psr-4": { 37 | "San\\Crud\\Tests\\": "tests/" 38 | } 39 | }, 40 | "extra": { 41 | "laravel": { 42 | "providers": [ 43 | "San\\Crud\\ServiceProvider" 44 | ] 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /config/crud.php: -------------------------------------------------------------------------------- 1 | NULL, 5 | ]; -------------------------------------------------------------------------------- /database/migrations/leads_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->integer('user_id'); 19 | $table->string('name'); 20 | $table->string('email'); 21 | 22 | $table->timestamps(); 23 | $table->softDeletes(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('leads'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /database/migrations/replies_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->integer('ticket_id'); 17 | $table->text('body'); 18 | $table->boolean('is_admin')->default(FALSE); 19 | $table->timestamps(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() { 29 | Schema::dropIfExists('replies'); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /database/migrations/tickets_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->integer('lead_id'); 17 | $table->integer('user_id'); 18 | $table->string('subject'); 19 | $table->json('extra_data')->nullable(); 20 | $table->timestamps(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() { 30 | Schema::dropIfExists('tickets'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/migrations/users_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->string('email')->unique(); 20 | $table->timestamp('email_verified_at')->nullable(); 21 | $table->string('password'); 22 | $table->rememberToken(); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('users'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /docs/.vitepress/cache/deps/@theme_index.js: -------------------------------------------------------------------------------- 1 | // node_modules/vitepress/dist/client/theme-default/index.js 2 | import "/home/san/laravel/plugins/php/laravel-crud/node_modules/vitepress/dist/client/theme-default/styles/fonts.css"; 3 | import "/home/san/laravel/plugins/php/laravel-crud/node_modules/vitepress/dist/client/theme-default/styles/vars.css"; 4 | import "/home/san/laravel/plugins/php/laravel-crud/node_modules/vitepress/dist/client/theme-default/styles/base.css"; 5 | import "/home/san/laravel/plugins/php/laravel-crud/node_modules/vitepress/dist/client/theme-default/styles/utils.css"; 6 | import "/home/san/laravel/plugins/php/laravel-crud/node_modules/vitepress/dist/client/theme-default/styles/components/custom-block.css"; 7 | import "/home/san/laravel/plugins/php/laravel-crud/node_modules/vitepress/dist/client/theme-default/styles/components/vp-code.css"; 8 | import "/home/san/laravel/plugins/php/laravel-crud/node_modules/vitepress/dist/client/theme-default/styles/components/vp-code-group.css"; 9 | import "/home/san/laravel/plugins/php/laravel-crud/node_modules/vitepress/dist/client/theme-default/styles/components/vp-doc.css"; 10 | import "/home/san/laravel/plugins/php/laravel-crud/node_modules/vitepress/dist/client/theme-default/styles/components/vp-sponsor.css"; 11 | import VPBadge from "/home/san/laravel/plugins/php/laravel-crud/node_modules/vitepress/dist/client/theme-default/components/VPBadge.vue"; 12 | import Layout from "/home/san/laravel/plugins/php/laravel-crud/node_modules/vitepress/dist/client/theme-default/Layout.vue"; 13 | import NotFound from "/home/san/laravel/plugins/php/laravel-crud/node_modules/vitepress/dist/client/theme-default/NotFound.vue"; 14 | import { default as default2 } from "/home/san/laravel/plugins/php/laravel-crud/node_modules/vitepress/dist/client/theme-default/components/VPHomeHero.vue"; 15 | import { default as default3 } from "/home/san/laravel/plugins/php/laravel-crud/node_modules/vitepress/dist/client/theme-default/components/VPHomeFeatures.vue"; 16 | import { default as default4 } from "/home/san/laravel/plugins/php/laravel-crud/node_modules/vitepress/dist/client/theme-default/components/VPHomeSponsors.vue"; 17 | import { default as default5 } from "/home/san/laravel/plugins/php/laravel-crud/node_modules/vitepress/dist/client/theme-default/components/VPDocAsideSponsors.vue"; 18 | import { default as default6 } from "/home/san/laravel/plugins/php/laravel-crud/node_modules/vitepress/dist/client/theme-default/components/VPTeamPage.vue"; 19 | import { default as default7 } from "/home/san/laravel/plugins/php/laravel-crud/node_modules/vitepress/dist/client/theme-default/components/VPTeamPageTitle.vue"; 20 | import { default as default8 } from "/home/san/laravel/plugins/php/laravel-crud/node_modules/vitepress/dist/client/theme-default/components/VPTeamPageSection.vue"; 21 | import { default as default9 } from "/home/san/laravel/plugins/php/laravel-crud/node_modules/vitepress/dist/client/theme-default/components/VPTeamMembers.vue"; 22 | var theme = { 23 | Layout, 24 | NotFound, 25 | enhanceApp: ({ app }) => { 26 | app.component("Badge", VPBadge); 27 | } 28 | }; 29 | var theme_default_default = theme; 30 | export { 31 | default5 as VPDocAsideSponsors, 32 | default3 as VPHomeFeatures, 33 | default2 as VPHomeHero, 34 | default4 as VPHomeSponsors, 35 | default9 as VPTeamMembers, 36 | default6 as VPTeamPage, 37 | default8 as VPTeamPageSection, 38 | default7 as VPTeamPageTitle, 39 | theme_default_default as default 40 | }; 41 | //# sourceMappingURL=@theme_index.js.map 42 | -------------------------------------------------------------------------------- /docs/.vitepress/cache/deps/@theme_index.js.map: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "sources": ["../../../../node_modules/vitepress/dist/client/theme-default/index.js"], 4 | "sourcesContent": ["import './styles/fonts.css';\r\nimport './styles/vars.css';\r\nimport './styles/base.css';\r\nimport './styles/utils.css';\r\nimport './styles/components/custom-block.css';\r\nimport './styles/components/vp-code.css';\r\nimport './styles/components/vp-code-group.css';\r\nimport './styles/components/vp-doc.css';\r\nimport './styles/components/vp-sponsor.css';\r\nimport VPBadge from './components/VPBadge.vue';\r\nimport Layout from './Layout.vue';\r\nimport NotFound from './NotFound.vue';\r\nexport { default as VPHomeHero } from './components/VPHomeHero.vue';\r\nexport { default as VPHomeFeatures } from './components/VPHomeFeatures.vue';\r\nexport { default as VPHomeSponsors } from './components/VPHomeSponsors.vue';\r\nexport { default as VPDocAsideSponsors } from './components/VPDocAsideSponsors.vue';\r\nexport { default as VPTeamPage } from './components/VPTeamPage.vue';\r\nexport { default as VPTeamPageTitle } from './components/VPTeamPageTitle.vue';\r\nexport { default as VPTeamPageSection } from './components/VPTeamPageSection.vue';\r\nexport { default as VPTeamMembers } from './components/VPTeamMembers.vue';\r\nconst theme = {\r\n Layout,\r\n NotFound,\r\n enhanceApp: ({ app }) => {\r\n app.component('Badge', VPBadge);\r\n }\r\n};\r\nexport default theme;\r\n"], 5 | "mappings": ";AAAA,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO,aAAa;AACpB,OAAO,YAAY;AACnB,OAAO,cAAc;AACrB,SAAoB,WAAXA,gBAA6B;AACtC,SAAoB,WAAXA,gBAAiC;AAC1C,SAAoB,WAAXA,gBAAiC;AAC1C,SAAoB,WAAXA,gBAAqC;AAC9C,SAAoB,WAAXA,gBAA6B;AACtC,SAAoB,WAAXA,gBAAkC;AAC3C,SAAoB,WAAXA,gBAAoC;AAC7C,SAAoB,WAAXA,gBAAgC;AACzC,IAAM,QAAQ;AAAA,EACV;AAAA,EACA;AAAA,EACA,YAAY,CAAC,EAAE,IAAI,MAAM;AACrB,QAAI,UAAU,SAAS,OAAO;AAAA,EAClC;AACJ;AACA,IAAO,wBAAQ;", 6 | "names": ["default"] 7 | } 8 | -------------------------------------------------------------------------------- /docs/.vitepress/cache/deps/_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "hash": "576f85bf", 3 | "browserHash": "2852436b", 4 | "optimized": { 5 | "vue": { 6 | "src": "../../../../node_modules/vue/dist/vue.runtime.esm-bundler.js", 7 | "file": "vue.js", 8 | "fileHash": "2b8c4af0", 9 | "needsInterop": false 10 | }, 11 | "@theme/index": { 12 | "src": "../../../../node_modules/vitepress/dist/client/theme-default/index.js", 13 | "file": "@theme_index.js", 14 | "fileHash": "eaeed8d1", 15 | "needsInterop": false 16 | } 17 | }, 18 | "chunks": {} 19 | } -------------------------------------------------------------------------------- /docs/.vitepress/cache/deps/package.json: -------------------------------------------------------------------------------- 1 | {"type":"module"} -------------------------------------------------------------------------------- /docs/.vitepress/config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | title: 'Laravel Crud Generator', 3 | host: 'localhost', 4 | description: 'Laravel CRUD generator: Generate CRUD for any db table with the crud:generate command.', 5 | //base: 'https://san-kumar.github.io/laravel-crud/', 6 | base: '/laravel-crud/', 7 | appearance: 'dark', 8 | themeConfig: { 9 | nav: [ 10 | {text: 'Getting started', link: '/guide'}, 11 | { 12 | text: 'Artisan commands', 13 | items: [ 14 | {text: 'artisan crud:generate', link: '/guide/'}, 15 | {text: 'artisan crud:template', link: '/guide/customization'}, 16 | {text: 'artisan crud:remove', link: '/guide/remove'}, 17 | ] 18 | } 19 | ], 20 | sidebar: [ 21 | { 22 | text: 'Introduction', 23 | items: [ 24 | {text: 'Index', link: '/guide/'}, 25 | {text: 'Installation', link: '/guide/install'}, 26 | {text: 'Options', link: '/guide/options'}, 27 | ] 28 | }, 29 | { 30 | text: 'Details', 31 | items: [ 32 | {text: 'Nested parents', link: '/guide/nesting'}, 33 | {text: 'Authentication', link: '/guide/authentication'}, 34 | {text: 'Create / edit form', link: '/guide/crud'}, 35 | {text: 'Soft deletes', link: '/guide/soft-deletes'}, 36 | {text: 'Inbuilt search', link: '/guide/search'}, 37 | {text: 'Customization', link: '/guide/customization'}, 38 | ] 39 | }, 40 | { 41 | text: 'Appendix', 42 | items: [ 43 | {text: 'Gotchas', link: '/guide/gotchas'}, 44 | {text: 'CRUD removal', link: '/guide/remove'}, 45 | {text: 'License', link: '/guide/license'}, 46 | {text: 'Roadmap', link: '/guide/roadmap'}, 47 | {text: 'About', link: '/guide/about'}, 48 | ] 49 | }, 50 | ], 51 | editLink: { 52 | pattern: 'https://github.com/san-kumar/laravel-crud/docs/:path' 53 | }, 54 | search: { 55 | maxSuggestions: 10 56 | }, 57 | footer: { 58 | message: 'Released under the MIT License.', 59 | copyright: 'Copyright © 2022-present San Kumar' 60 | }, 61 | socialLinks: [ 62 | { icon: 'github', link: 'https://github.com/san-kumar/laravel-crud' } 63 | ], 64 | } 65 | }; 66 | -------------------------------------------------------------------------------- /docs/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to contribute 2 | Thank you for considering to contribute to this repository! This file will walk you through all the steps to ensure both 3 | you and I have a good time submitting and reviewing your contribution. First off, some basic rules and reading material: 4 | 5 | - Submit your work in a new branch and make the PR to the master branch. 6 | - [Write a short & descriptive commit message](http://chris.beams.io/posts/git-commit/). 7 | - Rebase before committing the final change. 8 | - Stick to [PSR-2](http://www.php-fig.org/psr/psr-2/). 9 | - Add tests if necessary and ensure all the tests are green on the final commit. 10 | - Make sure the CI tools used by the repository are all in order. If one fails, you should make it pass. 11 | 12 | ## Contributing 13 | Here are the steps to follow to contribute to this repository: 14 | 15 | - [Fork this repository on GitHub](#fork-this-repository). 16 | - [Clone your fork to your local machine](#clone-your-fork). 17 | - [Create a feature branch](#create-a-branch). 18 | - [Add an 'upstream' remote](#add-a-remote). 19 | - [Regularly pull & rebase from the upstream remote](#pull-and-rebase). 20 | - [Work on feature branch](#working-on-branch). 21 | - [Submit a pull request to the master branch](#submitting-pull-request). 22 | 23 | ### Fork this repository 24 | Fork the repository right here on GitHub. To learn more about forking a repository, visit 25 | [GitHub's help article](https://help.github.com/articles/fork-a-repo/). 26 | 27 | ### Clone your fork 28 | Clone your repository on your local machine to start work on your pull request. 29 | 30 | ```bash 31 | $ git clone git@github.com:/.git 32 | # Or if you prefer HTTPS: 33 | $ git clone https://github.com//.git 34 | 35 | $ cd 36 | ``` 37 | 38 | ### Create a branch 39 | Make your own feature branch in order not to clutter up master. 40 | 41 | ```bash 42 | # Think of a good name for your branch: 43 | # fix/typo-in-readme 44 | # feature/some-feature 45 | # bug/some-bug-you-are-fixing 46 | $ git checkout -b 47 | ``` 48 | 49 | ### Add a remote 50 | Add an 'upstream' remote to pull from and to stay up to date with the work being done in there. 51 | 52 | ```bash 53 | # List all current remotes 54 | $ git remote -v 55 | origin git@github.com//.git (fetch) 56 | origin git@github.com//.git (push) 57 | 58 | # Add a new remote called 'upstream' 59 | $ git remote add upstream git@github.com:san-kumar/.git 60 | # Or if you prefer HTTPS: 61 | $ git remote add upstream https://github.com/san-kumar/.git 62 | 63 | # The new remote should now be in the list 64 | $ git remote -v 65 | origin git@github.com//.git (fetch) 66 | origin git@github.com//.git (push) 67 | upstream git@github.com/san-kumar/.git (fetch) 68 | upstream git@github.com/san-kumar/.git (push) 69 | ``` 70 | 71 | ### Pull and rebase 72 | Pull from upstream to stay up to date with what others might be doing in this repository. Any merge conflicts that arise 73 | are your responsibility to resolve. 74 | 75 | ```bash 76 | $ git pull --rebase upstream master 77 | ``` 78 | 79 | ### Working on branch 80 | Do your magic and make your fix. I can't help you with this :wink:. Once you're happy with the result and all tests pass, 81 | go ahead and push to your feature branch. 82 | 83 | ```bash 84 | $ git push origin 85 | ``` 86 | 87 | ### Submitting pull request 88 | Now, let's head back over to this repository on GitHub and submit the pull request! 89 | -------------------------------------------------------------------------------- /docs/LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright (c) San Kumar 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 | -------------------------------------------------------------------------------- /docs/badges.md: -------------------------------------------------------------------------------- 1 | [![Software License](https://img.shields.io/badge/license-MIT-green.svg?style=flat-square)](LICENSE.md) 2 | [![Build Status](https://img.shields.io/circleci/project/github/san-kumar/laravel-crud.svg?style=flat-square)](https://circleci.com/gh/san-kumar/laravel-crud) 3 | [![Coverage Status](https://img.shields.io/badge/coverage-94%25-brightgreen)](https://raw.githack.com/san-kumar/laravel-crud/main/build/coverage/index.html) 4 | [![Latest Version on Packagist](https://img.shields.io/packagist/v/san-kumar/laravel-crud.svg?style=flat-square)](https://packagist.org/packages/san-kumar/laravel-crud) 5 | [![Total Downloads](https://img.shields.io/packagist/dt/san-kumar/laravel-crud.svg?style=flat-square)](https://img.shields.io/packagist/dt/san-kumar/laravel-crud.svg?style=flat-square) 6 | 7 | -------------------------------------------------------------------------------- /docs/guide/about.md: -------------------------------------------------------------------------------- 1 | # About 2 | 3 | **Found any bugs?** Report them on the [issue tracker](https://github.com/san-kumar/laravel-crud/issues). 4 | 5 | **Want to contribute?** Fork the project on GitHub and send a 6 | pull request. 7 | 8 | **Like the project?** Star it on GitHub. 9 | -------------------------------------------------------------------------------- /docs/guide/authentication.md: -------------------------------------------------------------------------------- 1 | # Authentication 2 | 3 | Laravel CRUD generator uses the default Laravel 4 | authentication 5 | package [laravel/ui](https://laravel.com/docs/7.x/authentication#included-routing) 6 | for handling user authentication. The CRUD generator will 7 | automatically add authentication to routes (using the 8 | `auth` middleware) and generate Policy classes for Models. 9 | 10 | ## `user_id` field in table 11 | 12 | If you generate CRUD for any table that has a `user_id` 13 | field, then the generated CRUD will automatically generate a 14 | Policy file for the Model and add the 15 | [`authorizeResource`](https://laravel.com/docs/7.x/authorization#authorizing-actions-using-policies) 16 | method to the Resource Controller. 17 | 18 | ## `user_id` in parent tables 19 | 20 | If you generate CRUD for a table that has a `user_id` field 21 | in the parent tables (i.e. `authors.posts.comments` has a 22 | `user_id` field in the `authors` table), then the generated 23 | CRUD will automatically generate a Policy file for 24 | the `Authors` Model and add it to your Resource Controller 25 | in the appropriate places. 26 | 27 | This way access to `posts` and `comments` will be restricted 28 | to the owner of the `authors` table only. 29 | 30 | -------------------------------------------------------------------------------- /docs/guide/crud.md: -------------------------------------------------------------------------------- 1 | # Create and Edit records 2 | 3 | Laravel CRUD generator can automatically generate the FORM 4 | for creating and editing records. It can also generate the 5 | validation rules for the form. 6 | 7 | ## Form fields 8 | 9 | The form fields are generated based on the database table 10 | columns. The following column types are supported: 11 | 12 | > ![Example of generated fields](https://cdn.articlevideorobot.com/hosted/22-12-2022/selection-307-f402.webp) 13 | > (Example of generated fields) 14 | 15 | - `string` (input type text) 16 | - `text` (textarea) 17 | - `integer` (input type number) 18 | - `enum` (select) 19 | - `boolean` (radio buttons) 20 | - `relation` (select with hydrated options) 21 | - and so on... 22 | 23 | It can also infer the field type from the column names. For 24 | example, if the column name is `email`, the field type will 25 | be `email`. 26 | 27 | ## Validation rules 28 | 29 | By default, all non-nullable fields are required. Columns 30 | with a `unique` index are also validated to be unique in the 31 | table. 32 | 33 | Some additional validation rules are also added based on the 34 | column name. For example, if the column name is `email`, the 35 | validation rule will be `email`. 36 | 37 | ## Relation fields 38 | 39 | If the table has any foreign key columns, the generator will 40 | automatically add a select field for that column. The 41 | options for the select field will be hydrated from the 42 | related table. 43 | 44 | For example, if your table has a `country_id` column and if 45 | the `country` table exists: the generator will add a select 46 | field for country (as shown in the image above) and the 47 | options for that select field will be hydrated from 48 | the `countries` table (if the country table has a `user_id` 49 | column, the options will be filtered by the current user). 50 | 51 | ## Quick note about relation fields 52 | 53 | You do need to add relation fields manually or create any 54 | foreign key columns in the database. The relation is 55 | inferred from the column name only. Any column name that 56 | matches the pattern `*_id` are considered relation. 57 | 58 | For example, if the column name is `country_id`, the 59 | generator will look for a `countries` table and add if that 60 | exists (and if the current user has permission to access 61 | that table) it will add a select field for that column and 62 | hydrate the options from the `countries` table. 63 | -------------------------------------------------------------------------------- /docs/guide/customization.md: -------------------------------------------------------------------------------- 1 | # Customization 2 | 3 | ## Using your own templates 4 | 5 | At the heart of Laravel CRUD generator are the templates 6 | files that are used to generate the CRUD files. 7 | 8 | The templates files included with this package are stored in 9 | the `./vendor/san-kumar/laravel-crud/src/template` 10 | directory. 11 | 12 | It contains all the stub files that are used to generate the 13 | Controller, Model, Policy, routes, etc. 14 | 15 | ## Customizing the templates 16 | 17 | You can customize the templates by copying the template into 18 | a new directory and then modifying the template files. 19 | 20 | To make this simple Laravel CRUD generator provides an 21 | artisan command that will copy the template files into a new 22 | directory for you. 23 | 24 | ```bash 25 | # Copy the template files into a new directory 26 | $ php artisan crud:template newname 27 | ``` 28 | 29 | This will copy the template files into a new directory 30 | `./templates/newname/` directory. 31 | 32 | It you want to specify a different directory to copy the 33 | template files into you can use the `--directory` or 34 | `-d` option. 35 | 36 | ```bash 37 | # Copy the template files into a new directory 38 | $ php artisan crud:template newname -d etc/templates 39 | ``` 40 | 41 | This will copy the template files into a new directory 42 | `./etc/templates/newname/` directory. 43 | 44 | ## Using your own templates 45 | 46 | To use your own templates you need to specify the template 47 | directory in the `config/crud.php` file. 48 | 49 | ```php 50 | // config/crud.php 51 | 52 | return [ 53 | 'template_dir' => 'etc/templates/newname', 54 | ]; 55 | 56 | ``` 57 | 58 | Alternatively you can specify the template directory using 59 | the `--template` or `-t` option while generating the CRUD. 60 | 61 | ```bash 62 | # Generate the CRUD using the new template 63 | $ php artisan crud:generate Post --template etc/templates/newname 64 | ``` 65 | 66 | ## Customizing the templates 67 | 68 | You will need to modify the template files in the new 69 | directory to customize the generated files. 70 | 71 | You will find multiple variables that are used in the 72 | template files that are replaced with the actual values when 73 | the files are generated. 74 | 75 | To see the full list of variables that are used in the 76 | template files check out the source code for 77 | [GenerateCrud.php](https://github.com/san-kumar/laravel-crud/blob/main/src/Commands/CrudGenerate.php#L49) 78 | 79 | -------------------------------------------------------------------------------- /docs/guide/gotchas.md: -------------------------------------------------------------------------------- 1 | # Known Gotchas 2 | 3 | ## Laravel Jetstream 4 | 5 | Laravel CRUD generator doesn't seem to work with 6 | [Laravel jetstream](https://jetstream.laravel.com/) 7 | just yet. If you are using jetstream, you can still use the 8 | package, but you will have to manually modify some generated 9 | code to fix the layout and authentication issues. 10 | 11 | ## Inbuilt search 12 | 13 | A very simple search is added to the list view by default. 14 | It searches the first text column of the table and filters 15 | the results. But this generated search code is just a 16 | rudimentary placeholder, and you should customize the search 17 | algorithm as per your own needs. 18 | 19 | ## Opinionated code 20 | 21 | While the package tries to be as flexible as possible, it 22 | still generates some opinionated code. For example, the 23 | generated CRUD uses Laravel's `Policy` classes for handling 24 | authorization. But you may prefer to use something else 25 | like `spatie/laravel-permission`, which can be done but 26 | requires you 27 | to [create your own templates](/guide/customization). 28 | 29 | ## Alpha version 30 | 31 | You should only use it with new projects. If you are using 32 | it in an existing project, make sure to back up (or commit) 33 | any project changes before running the command. 34 | -------------------------------------------------------------------------------- /docs/guide/index.md: -------------------------------------------------------------------------------- 1 | # Laravel CRUD Generator 2 | 3 | ![laravel-crud-generator](https://cdn.articlevideorobot.com/hosted/16-12-2022/laravel-crud-152f.webp) 4 | 5 | ## Introduction 6 | 7 | This package adds a **crud:generate** command to Artisan in 8 | your Laravel project. With this command you can generate 9 | CRUD (Create, Read, Update, Delete) for your db tables 10 | instantly! 11 | 12 | The generated CRUD includes a Controller, Model, Policy, 13 | routes, validations, and 4 view files (index, create, edit, 14 | show). It also supports relations between tables, so you can 15 | generate nested CRUDs, for example: generating CRUD for 16 | comments inside a blog post. 17 | 18 | The output is fully customizable and supports 19 | both [Bootstrap 5](https://getbootstrap.com/docs/5.0/getting-started/introduction/) 20 | and [Tailwind CSS](https://tailwindcss.com/). 21 | 22 | ## Demo Video 23 | 24 | [![Laravel crud generator package](https://cdn.articlevideorobot.com/hosted/02-01-2023/laravel-crud-generator-5d81.webp)](https://www.youtube.com/watch?v=N_N2FqPDLvQ) 25 | 26 | ## Screenshots 27 | 28 | ### Index page 29 | 30 | Laravel-crud can generate nested CRUDs. For example, you can 31 | generate CRUD for customers > tickets > replies by simply 32 | running: 33 | 34 | ```bash 35 | $ php artisan crud:generate customers.tickets.replies 36 | ``` 37 | 38 | #### Table layout 39 | 40 | > ![Table index](https://cdn.articlevideorobot.com/hosted/22-12-2022/image-2-dbed.webp) 41 | > (Automatically generated index page with responsive table 42 | > layout) 43 | 44 | The generated views are fully customizable and template 45 | based. For example, you can change the look of the index 46 | page by using different templates like table, cards or 47 | chat (included in the package). 48 | 49 | #### Card layout 50 | 51 | ```bash 52 | $ php artisan crud:generate customers.tickets.replies -i cards 53 | ``` 54 | 55 | > ![Card layout](https://cdn.articlevideorobot.com/hosted/22-12-2022/selection-303-4a64.webp) 56 | > (Card layout) 57 | 58 | #### Chat layout 59 | 60 | ```bash 61 | $ php artisan crud:generate customers.tickets.replies -i chat 62 | ``` 63 | 64 | > ![Chat layout](https://cdn.articlevideorobot.com/hosted/22-12-2022/selection-304-c429.webp) 65 | > (Chat layout) 66 | 67 | #### Create / Edit Forms 68 | 69 | Laravel CRUD generator can automatically generate the FORM 70 | for creating and editing records. It can also generate the 71 | validation rules for the form. 72 | 73 | > ![Example of generated fields](https://cdn.articlevideorobot.com/hosted/22-12-2022/selection-307-f402.webp) 74 | > (Example of generated fields) 75 | 76 | ## Heads up! 77 | 78 | :::warning The package is still in _alpha_ 79 | 80 | You should only use it with new projects. If you are using 81 | it in an existing project, make sure to back up (or commit) 82 | any project changes before running the command. 83 | ::: 84 | 85 | The aim of the CRUD generator is to save you time by 86 | generating common boilerplate CRUD code for any database 87 | table instantly. 88 | 89 | But this code is **not** intended to be used as-is. You 90 | should always customize the generated code to fit your needs 91 | and manually review the generated files before deploying it 92 | to production. 93 | -------------------------------------------------------------------------------- /docs/guide/install.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | ## Install with Composer 4 | 5 | Via [composer](http://getcomposer.org): 6 | 7 | ```bash 8 | $ composer require san-kumar/laravel-crud --dev 9 | ``` 10 | 11 | ## Generate files 12 | 13 | :::warning Important! 14 | 15 | Make sure to create the db tables and run migrations before 16 | starting the crud generator. 17 | ::: 18 | 19 | After installing the package you should see a 20 | new `crud:generate` command in your Artisan commands list. 21 | 22 | To generate the Controller, Model, Policy, routes, etc use 23 | the following command: 24 | 25 | ```bash 26 | # Create CRUD for authors table 27 | $ php artisan crud:generate authors 28 | 29 | # Create CRUD for the authors > posts table 30 | $ php artisan crud:generate authors.posts 31 | 32 | # Create CRUD for the authors > posts > comments table 33 | $ php artisan crud:generate authors.posts.comments 34 | ``` 35 | 36 | ## Including the generated routes 37 | 38 | By default, the generated routes are placed in 39 | the `./routes/crud/` directory. To include the generated 40 | routes just open your `routes/web.php` file and add the 41 | following line at the end of the file: 42 | 43 | ```php 44 | /* inside routes/web.php */ 45 | 46 | \San\Crud\Crud::routes(); 47 | ``` 48 | 49 | This will `glob` all the generated route files and include 50 | them in the `routes/web.php` file for you. 51 | 52 | Alternatively, you can copy-paste the generated routes from 53 | the `./routes/crud/` directory to your `routes/web.php` 54 | file. This way you make any changes to the generated route 55 | code as per your needs. 56 | 57 | ## Location of the generated files 58 | 59 | The `crud:generate` command will generate the following 60 | files and place them in the appropriate directories: 61 | 62 | - Resource Controller 63 | - `app/Http/Controllers/[Name].php` 64 | - Model 65 | - `app/Model/[Name].php` 66 | - Policy 67 | - `app/Policies/[Name]Policy.php` 68 | - Routes 69 | - `routes/crud/[name].php` 70 | - Views 71 | - `resources/views/[name]/(index|edit|create|show).blade.php` 72 | 73 | By default, the generated code will not overwrite any 74 | existing files. If you want to overwrite the existing files, 75 | you can use the `--force` option. 76 | -------------------------------------------------------------------------------- /docs/guide/license.md: -------------------------------------------------------------------------------- 1 | # License 2 | 3 | The software is licensed using a MIT License. It means you 4 | can do whatever you want with it (including using it for 5 | commercial purposes freely), as long as you include the 6 | original copyright and license notice in any copy of the 7 | software/source. 8 | -------------------------------------------------------------------------------- /docs/guide/nesting.md: -------------------------------------------------------------------------------- 1 | # Relational tables and nesting 2 | 3 | In addition to generating simple CRUD for a single table, 4 | you can also generate CRUD for tables related to each other. 5 | 6 | ## Example #1 7 | 8 | For example, let's say we have the following tables: 9 | 10 | - Authors 11 | - Posts 12 | - Comments 13 | 14 | To generate CRUD for these tables you can use the dot 15 | notation to specify the parent tables like this: 16 | `authors.posts.comments`. 17 | 18 | ```bash 19 | 20 | ```bash 21 | # Create CRUD for authors table 22 | $ php artisan crud:generate authors 23 | 24 | # Create CRUD for posts table 25 | $ php artisan crud:generate authors.posts 26 | 27 | # Create CRUD for comments table 28 | $ php artisan crud:generate authors.posts.comments 29 | ``` 30 | 31 | This will generate CRUD files for the `authors` table, so 32 | you can view, create, edit and delete authors using the 33 | `/authors` route. 34 | 35 | Then for each author, you can view, create, edit and delete 36 | posts using the `/authors/{author}/posts` route. 37 | 38 | And for each post, you can view, create, edit and delete 39 | comments using the `/authors/{author}/posts/{post}/comments` 40 | route. 41 | 42 | ## Example #2 43 | 44 | On the other hand, if you want to generate CRUD for the 45 | `posts` table without nesting it under the `authors` route, 46 | you can do this: 47 | 48 | ```bash 49 | # Create CRUD for posts table 50 | $ php artisan crud:generate posts 51 | 52 | # Create CRUD for comments table 53 | $ php artisan crud:generate posts.comments 54 | ``` 55 | 56 | So now you can view, create, edit and delete all posts 57 | regardless of the author using the `/posts` route and then 58 | for each post, you can view, create, edit and delete 59 | comments using the `/posts/{post}/comments` route. -------------------------------------------------------------------------------- /docs/guide/options.md: -------------------------------------------------------------------------------- 1 | # Options 2 | 3 | ### CSS Framework: Bootstrap 5, and TailwindCSS. 4 | 5 | You can choose between Bootstrap 5 and Tailwind CSS or you 6 | can use your own CSS framework. By default, Bootstrap 5 is 7 | used when nothing is specified. 8 | 9 | ```bash 10 | # Create CRUD for authors table using Tailwind CSS 11 | $ php artisan crud:generate authors --css=tailwind 12 | 13 | # Shortcut for Tailwind CSS 14 | $ php artisan crud:generate authors -t 15 | ``` 16 | 17 | ```bash 18 | # Create CRUD for authors table using layout 'layouts/admin.blade.php' 19 | $ php artisan crud:generate authors --layout=admin 20 | $ php artisan crud:generate authors --section=mysection 21 | ``` 22 | 23 | ### Prefix 24 | 25 | You can add a route prefix for the generated CRUD by passing 26 | a `--prefix` option. 27 | 28 | ```bash 29 | # Create CRUD for authors table using Tailwind CSS 30 | $ php artisan crud:generate authors --prefix=admin 31 | ``` 32 | 33 | This will change the route from `/authors` to 34 | `/admin/authors` in all the generated files. 35 | 36 | ### Index templates 37 | 38 | You can choose between 3 ready-made index templates: table, 39 | cards and chat. By default, the table template is used. 40 | 41 | ```bash 42 | # Create CRUD for authors table using cards template 43 | $ php artisan crud:generate authors -i cards 44 | 45 | # Create CRUD for authors table using chat template 46 | $ php artisan crud:generate authors -i chat 47 | ``` 48 | 49 | Please see the [index page here](/guide/index.md#screenshots) 50 | for screenshots. 51 | 52 | ### Single create and edit form 53 | 54 | In some cases, you may want to use a single form for both 55 | creating and editing a resource. You can do that by passing 56 | `--merge-forms` option. 57 | 58 | ```bash 59 | # Create CRUD for authors table using a single form 60 | $ php artisan crud:generate authors --merge-forms 61 | ``` 62 | 63 | This will generate a single `view` file called 64 | `create-edit.blade.php` and update the controller code 65 | accordingly so that it can be used for both creating and 66 | editing a resource. 67 | 68 | ### Layout and section names 69 | 70 | By default, the generated views use `layouts/app.blade.php` 71 | for layout and `content` for section name. You can change 72 | these default names by passing your own layout and section 73 | names. 74 | 75 | -------------------------------------------------------------------------------- /docs/guide/remove.md: -------------------------------------------------------------------------------- 1 | # Removing the generated CRUD files 2 | 3 | ## Remove files 4 | 5 | Laravel CRUD Generator allows you to remove the generated 6 | files using the `artisan crud:remove` command. 7 | 8 | ```bash 9 | $ php artisan crud:remove customers.tickets.replies 10 | ``` 11 | 12 | This will remove all the files generated by 13 | the `crud:generate` for this table. 14 | 15 | ## Backup 16 | 17 | If you want to keep the generated files, you can use the 18 | `--backup` option to move the files into a Zip archive 19 | instead. 20 | 21 | ```bash 22 | $ php artisan crud:remove customers.tickets.replies --backup=backup.zip 23 | ``` 24 | 25 | This too will remove the files from the disk but will also 26 | create a Zip archive of all the removed files too. 27 | 28 | -------------------------------------------------------------------------------- /docs/guide/roadmap.md: -------------------------------------------------------------------------------- 1 | # Roadmap 2 | 3 | - Add support for Livewire 4 | - Add support for Laravel Jetstream 5 | -------------------------------------------------------------------------------- /docs/guide/search.md: -------------------------------------------------------------------------------- 1 | # Inbuilt search 2 | 3 | A very simple search is added to the list view by default. 4 | It searches the first text column of the table and filters 5 | the results. 6 | 7 | This generated search code is just a placeholder, and you 8 | should customize it as per your own needs. 9 | 10 | > ![Inbuilt search](https://cdn.articlevideorobot.com/hosted/22-12-2022/selection-306-99d5.webp) 11 | > (Inbuilt search) 12 | 13 | To modify the search algorithm just edit the `index` method 14 | of the Resource controller for that route. -------------------------------------------------------------------------------- /docs/guide/soft-deletes.md: -------------------------------------------------------------------------------- 1 | # Soft deletes 2 | 3 | Laravel provides a simple way to implement soft deletes on 4 | your Eloquent models. Soft deletes allow you to keep a 5 | record of a model's deletion without actually deleting the 6 | model from your database. This allows you to restore the 7 | model at a later time if needed. 8 | 9 | Laravel CRUD generator handles tables with soft deletes 10 | automatically and generates the appropriate code for you to 11 | restore or purge deleted records. 12 | 13 | > ![Handling soft deletes](https://cdn.articlevideorobot.com/hosted/22-12-2022/selection-305-e2e0.webp) 14 | > (Handling soft deletes) 15 | 16 | To show deleted records in the list view, just append 17 | `?trashed=1` to the URL (this link isn't added to the 18 | navigation menu by default, so you have to add it manually). -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: home 3 | 4 | hero: 5 | name: Laravel CRUD 6 | text: Generate CRUD for your db tables instantly! 7 | tagline: Zero learning curve. Save time. Avoid errors. 8 | actions: 9 | - theme: brand 10 | text: Get Started 11 | link: /guide/index 12 | - theme: alt 13 | text: View on GitHub 14 | link: https://github.com/san-kumar/laravel-crud 15 | 16 | features: 17 | - icon: ⚡️ 18 | title: Nested Tables Support 19 | details: Generate CRUD for nested tables. For example, generate CRUD for comments inside a blog post. 20 | link: /test 21 | - icon: 🖖 22 | title: Bootstrap 5 and Tailwind CSS 23 | details: Supports both Bootstrap 5 and Tailwind CSS or you can use your own CSS framework. 24 | link: /test 25 | - icon: 🛠️ 26 | title: Models, Gates, Policies, Views, Controllers, Routes and more 27 | details: Generate everything you need with one single "artisan crud:generate" command 28 | link: /test 29 | --- 30 | -------------------------------------------------------------------------------- /docs/readme.php: -------------------------------------------------------------------------------- 1 | ## Please see the [**full documentation here**](https://san-kumar.github.io/laravel-crud/).\n\n"; 17 | $content = preg_replace("/## Introduction\n/", "## Introduction\n\n" . file_get_contents(__DIR__ . '/badges.md') . "\n\n$docs", $content); 18 | $content = preg_replace_callback("/:::warning(.*?):::/ms", fn($match) => "> " . join("\n> ", explode("\n", $match[1])), $content); 19 | $content = preg_replace("#\(/guide#", "(https://san-kumar.github.io/laravel-crud/guide", $content); 20 | 21 | file_put_contents(__DIR__ . '/../README.md', $content); 22 | } else { 23 | echo "No files found"; 24 | } 25 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel-crud", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "repository": "git@github.com:san-kumar/laravel-crud.git", 6 | "author": "San Kumar ", 7 | "license": "MIT", 8 | "scripts": { 9 | "docs:dev": "vitepress dev docs --host localhost", 10 | "docs:build": "vitepress build docs", 11 | "docs:preview": "vitepress preview docs" 12 | }, 13 | "devDependencies": { 14 | "vitepress": "^1.0.0-alpha.33", 15 | "vue": "^3.2.45" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Commands/CrudBase.php: -------------------------------------------------------------------------------- 1 | getConfig('template_dir'); 15 | 16 | if (!empty($customDir)) { 17 | if (!is_dir($customDir)) { 18 | $this->error("Template directory '$customDir' does not exist"); 19 | exit(1); 20 | } 21 | 22 | return $customDir; 23 | } 24 | 25 | return $this->getConfig('template_dir', __DIR__ . '/../template'); 26 | } 27 | 28 | protected function getConfig($path = NULL, $default = NULL) { 29 | $config = config('crud') ?: []; 30 | 31 | return !empty($path) ? (data_get($config, $path) ?: $default) : $config; 32 | } 33 | 34 | protected function getCssFramework() { 35 | if (preg_match('/^(tailwind|larastrap)$/', $this->option('css'))) { 36 | return $this->option('css'); 37 | } 38 | 39 | if ($this->option('tailwind')) { 40 | return 'tailwind'; 41 | } 42 | 43 | return $this->getConfig('css', 'bootstrap'); 44 | } 45 | 46 | protected function getTables($checkExists = TRUE) { 47 | $tables = array_values(array_filter(array_map('trim', preg_split('/\.\s*/', $this->argument('table'))))); 48 | $aliases = $this->getTableAliases(); 49 | 50 | if ($checkExists) { 51 | foreach ($tables as $table) { 52 | if (!SchemaUtils::tableExists($aliases[$table] ?? $table)) { 53 | $this->warn("Table $table does not exist in the database. Did you forget to run migrations?"); 54 | } 55 | } 56 | } 57 | 58 | return $tables; 59 | } 60 | 61 | protected function getTableAliases() { 62 | if (!$this->hasOption('alias')) return []; 63 | 64 | $aliases = $this->option('alias'); 65 | 66 | foreach ($aliases as $alias) { 67 | [$a, $t] = explode('=', $alias); 68 | if (!empty($a) && !empty($t)) { 69 | if (SchemaUtils::tableExists($t)) { 70 | $results[$a] = $t; 71 | } else { 72 | $this->warn("Table $t (alias $a) does not exist in the database. Did you forget to run migrations?"); 73 | } 74 | } 75 | } 76 | 77 | return $results ?? []; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/Commands/CrudRemove.php: -------------------------------------------------------------------------------- 1 | getTables(); 37 | 38 | $cgen = new ControllerGen($tables, $tables); 39 | $mgen = new ModelGen($tables, $tables); 40 | $rgen = new RouteGen($tables, $tables); 41 | $vgen = new ViewGen($tables, $tables); 42 | $pgen = new PolicyGen($tables, $tables); 43 | 44 | $blanks = [ 45 | 'controller' => $cgen->getControllerName(), 46 | 'model' => $mgen->getModelName(), 47 | 'route' => $rgen->getRouteName(), 48 | 'policy' => $pgen->getPolicyName(), 49 | ]; 50 | 51 | $files = new Templates($this->getTemplateDir()); 52 | $cssFramework = 'bootstrap'; 53 | $interactive = $this->option('interactive'); 54 | 55 | if ($zipFile = $this->option('backup')) { 56 | if (!class_exists('ZipArchive')) { 57 | $this->error('ZipArchive class not found. Please install php-zip extension.'); 58 | return COMMAND::FAILURE; 59 | } 60 | 61 | $zip = new \ZipArchive(); 62 | $result = $zip->open($zipFile, \ZipArchive::CREATE | \ZipArchive::OVERWRITE); 63 | 64 | if (($result !== TRUE) || !is_writable(dirname($zipFile))) { 65 | $this->error('Cannot create zip file: ' . $zipFile); 66 | return COMMAND::FAILURE; 67 | } 68 | } 69 | 70 | foreach ($this->getStubTypes($cssFramework) as $type) { 71 | $stubs = $files->getStubs($type); 72 | 73 | foreach ($stubs as $stub) { 74 | $dest = $files->getDest($type, $stub, $blanks, $rgen->getRouteUrl()); 75 | 76 | if (file_exists($dest)) { 77 | if ($interactive && !$this->confirm("Delete $dest?")) { 78 | continue; 79 | } 80 | 81 | if (!empty($zip)) { 82 | $zip->addFromString(file_get_contents($dest), sprintf('%s/%s', $type, basename($dest))); 83 | } 84 | 85 | $this->info("Removing file $dest"); 86 | 87 | unlink($dest); 88 | } 89 | } 90 | } 91 | 92 | if (!empty($zip) && ($zip->numFiles > 0)) { 93 | $zip->close(); 94 | $this->info(sprintf("Backup created at: %s", realpath($zipFile))); 95 | } 96 | 97 | return Command::SUCCESS; 98 | } 99 | 100 | protected function getOptions() { 101 | return [ 102 | ['backup', 'b', InputOption::VALUE_REQUIRED, 'Name of zip file to backup files before removing'], 103 | ['interactive', 'i', InputOption::VALUE_NONE, 'Ask for confirmation before removing each file'], 104 | ]; 105 | } 106 | 107 | /** 108 | * {@inheritdoc} 109 | */ 110 | protected function getArguments() { 111 | return [ 112 | ['table', InputArgument::REQUIRED, 'Remove all generated files for the given tables'], 113 | ]; 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /src/Commands/CrudTemplate.php: -------------------------------------------------------------------------------- 1 | option('output') ?: 'templates'); 32 | $dest = sprintf('%s/%s', $base, $this->argument('name')); 33 | $force = $this->option('force'); 34 | 35 | if (is_dir($dest) && !$force) { 36 | $this->error("Template '$dest' already exists"); 37 | return Command::FAILURE; 38 | } 39 | 40 | $src = realpath(__DIR__ . '/../template'); 41 | if (!is_dir($src)) { 42 | $this->error("Template source '$src' not found"); 43 | return Command::FAILURE; 44 | } 45 | 46 | $count = FileUtils::recursiveCopy($src, $dest, $force); 47 | $this->info("Created $count files in '$dest'"); 48 | 49 | return Command::SUCCESS; 50 | } 51 | 52 | protected function getOptions() { 53 | return [ 54 | ['output', 'o', InputOption::VALUE_REQUIRED, 'Output directory name (default: "templates")'], 55 | ['force', 'f', InputOption::VALUE_NONE, 'Overwrite existing files'], 56 | ]; 57 | } 58 | 59 | /** 60 | * {@inheritdoc} 61 | */ 62 | protected function getArguments() { 63 | return [ 64 | ['name', InputArgument::REQUIRED, 'The name of the new template'], 65 | ]; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/Crud.php: -------------------------------------------------------------------------------- 1 | hasSoftDeletes()) { 11 | $str = preg_replace('#//@softdelete.*?@endsoftdelete#s', '', $str); 12 | } 13 | 14 | return $str; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Generators/BaseGen.php: -------------------------------------------------------------------------------- 1 | getVarNamePlural()); 14 | } 15 | 16 | public function getVarNamePlural() { 17 | return NameUtils::getVariableNamePlural($this->mainTable()); 18 | } 19 | 20 | public function mainTable() { 21 | return $this->tables[count($this->tables) - 1]; 22 | } 23 | 24 | public function getTitle() { 25 | return Str::singular($this->getTitlePlural()); 26 | } 27 | 28 | public function getTitlePlural() { 29 | return NameUtils::titleCase($this->mainTable()); 30 | } 31 | 32 | public function getParentVarName() { 33 | return Str::singular($this->getParentVarNamePlural()); 34 | } 35 | 36 | public function getParentVarNamePlural() { 37 | return NameUtils::getVariableNamePlural($this->parentTable()); 38 | } 39 | 40 | public function parentTable() { 41 | return $this->tables[count($this->tables) - 2]; 42 | } 43 | 44 | public function getMainModelName() { 45 | return NameUtils::getModelName((array) $this->mainTable()); 46 | } 47 | 48 | public function getMainVarName() { 49 | return NameUtils::getVariableName($this->mainTable()); 50 | } 51 | 52 | public function hasParentTable() { 53 | return count($this->tables) > 1; 54 | } 55 | 56 | public function parentTables() { 57 | return array_slice($this->tables, 0, -1); 58 | } 59 | 60 | public function getVars(array $tables, array $extraVars = []) { 61 | $vars = $this->getRawVars($tables, $extraVars); 62 | 63 | return !empty($vars) ? sprintf("compact(%s)", join(', ', array_map(fn($var) => sprintf("'%s'", $var), $vars))) : '[]'; 64 | } 65 | 66 | public function getRawVars(array $tables, ?array $extraVars = []) { 67 | foreach ($tables as $table) { 68 | $vars[] = NameUtils::getVariableName($table); 69 | } 70 | 71 | return array_merge($vars ?? [], (array) $extraVars); 72 | } 73 | 74 | protected function hasUserId() { 75 | return SchemaUtils::getUserIdField($this->mainTableReal()); 76 | } 77 | 78 | public function mainTableReal() { 79 | return $this->getTableNameFromAlias($this->mainTable()); 80 | } 81 | 82 | public function getTableNameFromAlias($tableName) { 83 | return $this->aliases[$tableName] ?? $tableName; 84 | } 85 | 86 | public function getAliasFromTableName($tableName) { 87 | return array_search($tableName, $this->aliases) ?: $tableName; 88 | } 89 | 90 | protected function hasTimestamps() { 91 | return SchemaUtils::hasTimestamps($this->mainTableReal()); 92 | } 93 | 94 | protected function hasSoftDeletes() { 95 | return SchemaUtils::hasSoftDelete($this->mainTableReal()); 96 | } 97 | 98 | protected function getFirstReadableField($key = NULL) { 99 | return SchemaUtils::firstHumanReadableField($this->mainTableReal(), $key) ?: 'id'; 100 | } 101 | 102 | protected function getFillableFields($exceptColumns = ['user_id']) { 103 | foreach (SchemaUtils::getTableFields($this->mainTableReal(), $exceptColumns) as $field) { 104 | if (in_array($field['related_table'] ?? '', $this->realTables())) continue; 105 | $fillable[] = $field; 106 | } 107 | 108 | return $fillable ?? []; 109 | } 110 | 111 | public function realTables() { 112 | return array_map(fn($table) => $this->getTableNameFromAlias($table), $this->tables); 113 | } 114 | 115 | protected function getExternallyRelatedFields() { 116 | $fields = SchemaUtils::getTableFieldsWithIds($this->mainTableReal(), ['user_id']); 117 | 118 | foreach ($fields as $field) { 119 | if (in_array($field['related_table'], $this->realTables())) continue; 120 | $externallyRelatedFields[] = $field; 121 | } 122 | 123 | return $externallyRelatedFields ?? []; 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /src/Generators/ModelGen.php: -------------------------------------------------------------------------------- 1 | sprintf('use App\Models\%s;', NameUtils::getModelName((array) $table)), $this->tables)); 12 | } 13 | 14 | public function getModelName() { 15 | return NameUtils::getModelName($this->mainTable()); 16 | } 17 | 18 | public function getSoftDelete() { 19 | return $this->hasSoftDeletes() ? 'use \Illuminate\Database\Eloquent\SoftDeletes;' : ''; 20 | } 21 | 22 | public function getFillable() { 23 | foreach ($this->getFillableFields() as $field) { 24 | $fillable[] = $field['id']; 25 | } 26 | 27 | return join(', ', array_map(fn($f) => sprintf('"%s"', $f), $fillable ?? [])); 28 | } 29 | 30 | public function getBelongsTo() { 31 | foreach (SchemaUtils::getTableFieldsWithIds($this->mainTableReal(), ['user_id']) as $field) { 32 | $relations[] = sprintf("public function %s() {\n\t\treturn \$this->belongsTo(%s::class);\n\t}", $field['relation'], NameUtils::getModelName((array) $field['related_table'])); 33 | } 34 | 35 | return join("\n\n", $relations ?? []); 36 | } 37 | 38 | public function getHasMany() { 39 | $tables = SchemaUtils::getTables($this->mainTableReal()); 40 | 41 | foreach ($tables as $table) { 42 | $fields = SchemaUtils::getTableFieldsWithIds($this->getTableNameFromAlias($table), ['user_id']); 43 | foreach ($fields as $field) { 44 | if ($field['related_table'] == $this->mainTableReal()) { 45 | $fKey = $field['id']; 46 | $relations[] = sprintf("public function %s() {\n\t\treturn \$this->hasMany(%s::class, '%s');\n\t}", NameUtils::getVariableNamePlural($table), NameUtils::getModelName((array) $table), $fKey); 47 | } 48 | } 49 | } 50 | 51 | return join("\n\n", $relations ?? []); 52 | } 53 | 54 | public function getCasts() { 55 | foreach (SchemaUtils::getTableFields($this->mainTableReal(), ['user_id']) as $field) { 56 | if ($field['type'] == 'json') { 57 | $casts[] = sprintf("'%s' => AsArrayObject::class", $field['id']); 58 | } elseif (preg_match('/^date/', $field['type'])) { 59 | $casts[] = sprintf("'%s' => 'datetime'", $field['id']); 60 | } 61 | } 62 | 63 | return !empty($casts) ? sprintf("protected \$casts = [\n\t\t%s\n\t];", join(",\n\t\t", $casts)) : ''; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/Generators/PolicyGen.php: -------------------------------------------------------------------------------- 1 | tables)); 12 | } 13 | 14 | public function getPolicyName() { 15 | return NameUtils::getPolicyName($this->mainTable()); 16 | } 17 | 18 | public function getControllerPolicy() { 19 | return sprintf("public function __construct() {\n\t\t\$this->authorizeResource(%s::class, '%s');\n\t}", $this->getMainModelName(), $this->getMainVarName()); 20 | } 21 | 22 | public function getPolicyReadArgs() { 23 | return $this->getPolicyArgs([]); 24 | } 25 | 26 | public function getPolicyArgs($tables) { 27 | foreach (array_merge(['User'], (array) $tables) as $table) { 28 | $args[] = sprintf('%s $%s', NameUtils::getModelName((array) $table), NameUtils::getVariableName($table)); 29 | } 30 | 31 | return join(', ', $args ?? []); 32 | } 33 | 34 | public function getPolicyReadRules() { 35 | return $this->getPolicyRules([]); 36 | } 37 | 38 | public function getPolicyRules($tables) { 39 | foreach ((array) $tables as $table) { 40 | if (SchemaUtils::getUserIdField($this->getTableNameFromAlias($table))) { 41 | $checks[] = sprintf('($%s->user_id == $user->id)', NameUtils::getVariableName($table)); 42 | } 43 | } 44 | 45 | return empty($checks) ? "return true;" : sprintf('return ($user->id > 0) && %s;', join(' && ', $checks)); 46 | } 47 | 48 | public function getPolicyWriteArgs() { 49 | return $this->getPolicyArgs($this->mainTable()); 50 | } 51 | 52 | public function getPolicyWriteRules() { 53 | return $this->getPolicyRules($this->mainTable()); 54 | } 55 | 56 | public function getParentAuthorization() { 57 | return $this->getPolicyAuthorization($this->parentTables(), 'view'); 58 | } 59 | 60 | public function getPolicyAuthorization($tables, $fn) { 61 | foreach ((array) $tables as $table) { 62 | $checks[] = sprintf("\$this->authorize('%s', [%s::class, \$%s]);", $fn, NameUtils::getModelName($table), NameUtils::getVariableName($table)); 63 | } 64 | 65 | return empty($checks) ? "" : join("\n\t\t", $checks); 66 | } 67 | 68 | public function getModelAuthorization() { 69 | return $this->getPolicyAuthorization($this->mainTable(), 'delete'); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/Generators/RouteGen.php: -------------------------------------------------------------------------------- 1 | tables); 14 | } 15 | 16 | public function getParentRouteName() { 17 | return NameUtils::getRouteName($this->parentTables()); 18 | } 19 | 20 | public function getRouteUrl() { 21 | return $this->withRoutePrefix(str_replace('.', '/', $this->getRouteName())); 22 | } 23 | 24 | public function getRouteUrlWithoutPrefix() { 25 | return str_replace('.', '/', $this->getRouteName()); 26 | } 27 | 28 | public function getRouteUrlWithPlaceholders() { 29 | return $this->getUrlWithPlaceholders($this->tables); 30 | } 31 | 32 | public function getParentRouteUrlWithPlaceholders() { 33 | return $this->getUrlWithPlaceholders($this->parentTables(), $this->mainTable()); 34 | } 35 | 36 | public function getUrlWithPlaceholders($tables, $suffix = '') { 37 | foreach ((array) $tables as $table) { 38 | $parts[] = sprintf('%s/{%s}', $table, NameUtils::getVariableName($table)); 39 | } 40 | 41 | if (!empty($suffix)) { 42 | $parts[] = $suffix; 43 | } 44 | 45 | return $this->withRoutePrefix(implode('/', $parts ?? [])); 46 | } 47 | 48 | public function getRouteUrlWithId() { 49 | foreach ((array) $this->tables as $table) { 50 | if ($table == $this->mainTable()) { 51 | $parts[] = sprintf('%s/{%s_id}', $table, NameUtils::getVariableName($table)); 52 | } else { 53 | $parts[] = sprintf('%s/{%s}', $table, NameUtils::getVariableName($table)); 54 | } 55 | } 56 | 57 | return $this->withRoutePrefix(implode('/', $parts)); 58 | } 59 | 60 | public function getParentRouteUrl() { 61 | return $this->withRoutePrefix(str_replace('.', '/', $this->getParentRouteName())); 62 | } 63 | 64 | public function getRouteVars() { 65 | return sprintf('[%s]', join(', ', array_map(fn($table) => sprintf("'%s' => $%s", NameUtils::getVariableName($table), NameUtils::getVariableName($table)), $this->tables))); 66 | } 67 | 68 | public function getRouteVarsWithId() { 69 | foreach ($this->tables as $table) { 70 | if ($table == $this->mainTable()) { 71 | $vars[] = sprintf("'%s_id' => $%s->id", NameUtils::getVariableName($table), NameUtils::getVariableName($table)); 72 | } else { 73 | $vars[] = sprintf("'%s' => $%s", NameUtils::getVariableName($table), NameUtils::getVariableName($table)); 74 | } 75 | } 76 | 77 | return sprintf('[%s]', join(', ', $vars ?? [])); 78 | } 79 | 80 | public function getAsRoute() { 81 | return $this->hasParentTable() ? sprintf('"as" => "%s",', $this->getParentRouteName()) : ''; 82 | } 83 | 84 | public function withRoutePrefix(string $route) { 85 | return empty($this->routePrefix) ? $route : sprintf('%s/%s', trim($this->routePrefix, '/'), $route); 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/Generators/Templates.php: -------------------------------------------------------------------------------- 1 | path/stubs/$suffix", ['php']); 17 | return array_values(array_filter($files, fn($file) => !\str_contains($file, 'partials'))); 18 | } 19 | 20 | public function getFirstStub(string $suffix) { 21 | $stubs = $this->getStubs($suffix); 22 | return $stubs[0] ?? NULL; 23 | } 24 | 25 | public function getDest(string $type, mixed $stub, array $replacements = [], string $suffix = '') { 26 | $dest = \str_contains($type, 'views/') ? resource_path('views') . "/$suffix" : ($type === 'routes' ? base_path("routes/crud") : ($type === 'Controllers' ? app_path('Http/Controllers') : app_path($type))); 27 | $str = sprintf('%s/%s', $dest, basename($stub)); 28 | return TextUtils::replaceBlanks($str, $replacements); 29 | } 30 | 31 | public function templatePath() { 32 | return $this->path; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/ServiceProvider.php: -------------------------------------------------------------------------------- 1 | commands([ 13 | Commands\CrudGenerate::class, 14 | Commands\CrudRemove::class, 15 | Commands\CrudTemplate::class, 16 | ]); 17 | } 18 | 19 | /** 20 | * {@inheritdoc} 21 | */ 22 | public function boot() { 23 | $this->publishes([ 24 | __DIR__ . '/../config/crud.php' => config_path('crud.php'), 25 | ]); 26 | } 27 | 28 | /** 29 | * {@inheritdoc} 30 | */ 31 | public function provides() { 32 | return [ 33 | Commands\CrudGenerate::class, 34 | Commands\CrudRemove::class, 35 | Commands\CrudTemplate::class, 36 | ]; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Utils/FileUtils.php: -------------------------------------------------------------------------------- 1 | isFile()) continue; 15 | if (count($filter) > 0 && !in_array($file->getExtension(), $filter)) continue; 16 | 17 | $files[] = $file->getRealPath(); 18 | } 19 | 20 | return $files ?? []; 21 | } 22 | 23 | public static function recursiveCopy($src, $dest, $force = FALSE) { 24 | $files = self::getFiles($src); 25 | $count = 0; 26 | 27 | foreach ($files as $file) { 28 | $target = $dest . DIRECTORY_SEPARATOR . str_replace($src, '', $file); 29 | 30 | if (file_exists($target) && !$force) { 31 | continue; 32 | } else { 33 | $dir = dirname($target); 34 | if (!is_dir($dir)) { 35 | mkdir($dir, 0755, TRUE); 36 | } 37 | 38 | copy($file, $target); 39 | $count++; 40 | } 41 | } 42 | 43 | return $count; 44 | } 45 | 46 | public static function writeFile(string $dest, string $str) { 47 | $dir = dirname($dest); 48 | if (!is_dir($dir)) { 49 | mkdir($dir, 0777, TRUE); 50 | } 51 | 52 | return file_put_contents($dest, $str); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Utils/NameUtils.php: -------------------------------------------------------------------------------- 1 | Str::studly(Str::singular($tableName)), (array) $tables)); 14 | } 15 | 16 | public static function getModelName(string|array $tables) { 17 | return self::studlyCase((array) $tables); 18 | } 19 | 20 | public static function getControllerName(string|array $tables) { 21 | return self::studlyCase((array) $tables) . 'Controller'; 22 | } 23 | 24 | public static function getRouteName(string|array $tables) { 25 | return join('.', array_map(fn($tableName) => Str::kebab(Str::plural($tableName)), (array) $tables)); 26 | } 27 | 28 | public static function getVariableName(string $table) { 29 | return Str::singular(self::getVariableNamePlural($table)); 30 | } 31 | 32 | public static function getVariableNamePlural(string $table) { 33 | return Str::camel($table); 34 | } 35 | 36 | public static function getPolicyName(string|array $tables) { 37 | return self::studlyCase((array) $tables) . 'Policy'; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Utils/RouteUtils.php: -------------------------------------------------------------------------------- 1 | sprintf("'%s'", $var), (array) $vars)) ?: '[]'); 13 | return sprintf("route('%s', %s)", $name, $args); 14 | } else { //fallback code to handle undefined routes to prevent errors 15 | $parts = explode('.', $name); 16 | $values = array_values((array) $vars); 17 | 18 | $path = [sprintf("'%s'", rtrim("/" . trim($prefix ?: '', '/'), '/'))]; 19 | 20 | for ($i = 0; $i < count($parts); $i++) { 21 | if ($parts[$i] === 'index') continue; 22 | 23 | if ($parts[$i] !== 'show') { 24 | $path[] = sprintf("'%s'", $parts[$i]); 25 | } 26 | 27 | if (!empty($values[$i])) { 28 | $path[] = is_scalar($vars) ? $values[$i] : sprintf("$%s?->id ?: 0", $values[$i]); 29 | } 30 | } 31 | 32 | return sprintf("implode('/', [%s])", join(',', $path)); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/Utils/SchemaUtils.php: -------------------------------------------------------------------------------- 1 | getDoctrineSchemaManager()->listTableNames(); 10 | if ($withViews) { 11 | $views = DB::connection()->getDoctrineSchemaManager()->listViews(); 12 | $tables = array_merge($tables, array_keys($views)); 13 | } 14 | 15 | return array_values(array_filter($tables, fn($table) => !in_array($table, (array) $exclude))); 16 | } 17 | 18 | public static function getTableFields(string $tableName, array $excludedColumns = [], array $alwaysIgnoredColumns = ['id', 'created_at', 'updated_at', 'deleted_at']) { 19 | // ugly enum hack as doctrine does not support enum types 20 | // https://www.doctrine-project.org/projects/doctrine-orm/en/latest/cookbook/mysql-enums.html#solution-1-mapping-to-varchars 21 | 22 | DB::connection()->getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'guid'); 23 | 24 | $columns = DB::getDoctrineSchemaManager()->listTableColumns($tableName); 25 | $ignoredColumns = array_merge((array) $excludedColumns, (array) $alwaysIgnoredColumns); 26 | $indexes = DB::getDoctrineSchemaManager()->listTableIndexes($tableName); 27 | $uniqueColumns = []; 28 | 29 | foreach ($indexes as $index) { 30 | if ($index->isUnique() && count($index->getColumns()) === 1) { 31 | $uniqueColumns = array_merge($uniqueColumns, $index->getColumns()); 32 | } 33 | } 34 | 35 | foreach ($columns as $column) { 36 | if (in_array($column->getName(), $ignoredColumns)) continue; 37 | 38 | $field = [ 39 | 'id' => $column->getName(), 40 | 'type' => $column->getType()->getName(), 41 | 'name' => \Str::title(str_replace('_', ' ', $column->getName())), 42 | 'nullable' => !$column->getNotnull(), 43 | 'default' => $column->getDefault(), 44 | ]; 45 | 46 | if ($field['type'] == 'guid') { 47 | try { 48 | $enums = DB::select("SHOW COLUMNS FROM $tableName WHERE Field = '$field[id]'"); 49 | $field['values'] = explode(',', str_replace("'", '', substr($enums[0]->Type, 5, -1))); 50 | } catch (\Throwable $e) { 51 | echo ''; 52 | } 53 | } 54 | 55 | if (preg_match('/^(.*?)_id$/', $field['id'], $matches)) { 56 | $relatedTable = \Str::plural($matches[1]); 57 | if (self::tableExists($relatedTable)) { 58 | $field['relation'] = $matches[1]; 59 | $field['related_table'] = $relatedTable; 60 | } 61 | } 62 | 63 | //check if column is unique index 64 | if (in_array($field['id'], $uniqueColumns)) { 65 | $field['unique'] = TRUE; 66 | } 67 | 68 | $fields[] = $field; 69 | } 70 | 71 | return $fields ?? []; 72 | } 73 | 74 | public static function firstHumanReadableField(string $table, string $key = NULL) { 75 | $all = self::getTableFields($table); 76 | if (empty($all)) return NULL; 77 | 78 | foreach ($all as $f) { 79 | if (preg_match('/_id$/', $f['id'])) continue; 80 | if (preg_match('/(string|text)/', $f['type'])) return $key ? $f[$key] : $f; 81 | $last = $f['id']; 82 | } 83 | 84 | $result = $last ?? $all[0]; 85 | return $key ? $result[$key] : $result; 86 | } 87 | 88 | public static function getTableFieldsWithIds(string $table, array $excludedColumns = []) { 89 | return array_values(array_filter(self::getTableFields($table, $excludedColumns), fn($f) => !empty($f['relation']))); 90 | } 91 | 92 | public static function getUserIdField(string $tableName, $userIdField = 'user_id') { 93 | if (!self::tableExists($tableName)) return NULL; 94 | return \Schema::hasColumn($tableName, $userIdField) ? $userIdField : NULL; 95 | } 96 | 97 | public static function hasTable(string $tableName) { 98 | return self::tableExists($tableName); 99 | } 100 | 101 | public static function hasTimestamps(string $tableName) { 102 | if (!self::tableExists($tableName)) return FALSE; 103 | return \Schema::hasColumn($tableName, 'created_at') && \Schema::hasColumn($tableName, 'updated_at'); 104 | } 105 | 106 | public static function hasSoftDelete(string $tableName) { 107 | if (!self::tableExists($tableName)) return FALSE; 108 | return \Schema::hasColumn($tableName, 'deleted_at'); 109 | } 110 | 111 | public static function tableExists(string $tableName) { 112 | return \Schema::hasTable($tableName); 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /src/Utils/TextUtils.php: -------------------------------------------------------------------------------- 1 | $value) { 10 | $k = "_{$key}_"; 11 | $text = str_replace("/*\$$k*/", "\$$value", $text); 12 | $text = str_replace("/*$k*/", $value, $text); 13 | $text = str_replace($k, $value, $text); 14 | } 15 | 16 | return preg_replace('/(\s*\n){2,}/', "\n\n", $text); 17 | } 18 | 19 | public static function arrayExport($arr) { 20 | return sprintf('[%s]', implode(', ', array_map(fn($v) => is_string($v) ? sprintf('"%s" => "%s"', $v, Str::title($v)) : $v, $arr))); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/template/stubs/Controllers/_controller_.php: -------------------------------------------------------------------------------- 1 | validate(/*_cvalidatecreate_*/); 58 | 59 | try { 60 | 61 | $_var_ = new _model_(); 62 | /*_cstore_*/ 63 | $_var_->save(); 64 | 65 | return redirect()->route('_route_.index', /*_cparentvars_*/)->with('success', __('_title_ created successfully.')); 66 | } catch (\Throwable $e) { 67 | return redirect()->route('_route_.create', /*_cparentvars_*/)->withInput($request->input())->withErrors(['error' => $e->getMessage()]); 68 | } 69 | } 70 | 71 | /** 72 | * Display the specified resource. 73 | * 74 | * @param \App\Models\_model_ $_var_ 75 | * 76 | * @return \Illuminate\Contracts\Support\Renderable 77 | */ 78 | public function show(/*_callargs_*/) { 79 | /*_pauthorize_*/ 80 | 81 | return view('_route_.show', /*_callvars_*/); 82 | } 83 | 84 | /** 85 | * Show the form for editing the specified resource. 86 | * 87 | * @param \App\Models\_model_ $_var_ 88 | * 89 | * @return \Illuminate\Contracts\Support\Renderable 90 | */ 91 | public function edit(/*_callargs_*/) { 92 | /*_pauthorize_*/ 93 | 94 | /*_cselects_*/ 95 | 96 | return view('_route_._editview_', /*_ceditvars_*/); 97 | } 98 | 99 | /** 100 | * Update the specified resource in storage. 101 | * 102 | * @param \Illuminate\Http\Request $request 103 | * 104 | * @return \Illuminate\Http\RedirectResponse 105 | */ 106 | public function update(Request $request, /*_callargs_*/) { 107 | /*_pauthorize_*/ 108 | 109 | $request->validate(/*_cvalidateedit_*/); 110 | 111 | try { 112 | /*_cedit_*/ 113 | $_var_->save(); 114 | 115 | return redirect()->route('_route_.index', /*_cparentvars_*/)->with('success', __('_title_ edited successfully.')); 116 | } catch (\Throwable $e) { 117 | return redirect()->route('_route_.edit', /*_callvars_*/)->withInput($request->input())->withErrors(['error' => $e->getMessage()]); 118 | } 119 | } 120 | 121 | /** 122 | * Remove the specified resource from storage. 123 | * 124 | * @param \App\Models\_model_ $_var_ 125 | * 126 | * @return \Illuminate\Http\RedirectResponse 127 | */ 128 | public function destroy(/*_callargs_*/) { 129 | /*_pauthorize_*/ 130 | 131 | try { 132 | $_var_->delete(); 133 | 134 | return redirect()->route('_route_.index', /*_cparentvars_*/)->with('success', __('_title_ deleted successfully')); 135 | } catch (\Throwable $e) { 136 | return redirect()->route('_route_.index', /*_cparentvars_*/)->with('error', 'Cannot delete _title_: ' . $e->getMessage()); 137 | } 138 | } 139 | 140 | //@softdelete 141 | 142 | /** 143 | * Restore the specified deleted resource from storage. 144 | * 145 | * @param \App\Models\_model_ $_var_ 146 | * 147 | * @return \Illuminate\Http\RedirectResponse 148 | */ 149 | public function restore(/*_cparentargs_*/ int $_var__id,) { 150 | /*_pauthorize_*/ 151 | 152 | /*_cfindbyid_*/ 153 | /*_mauthorize_*/ 154 | 155 | if (!empty($_var_)) { 156 | $_var_->restore(); 157 | return redirect()->route('_route_.index', /*_cparentvars_*/)->with('success', __('_title_ restored successfully')); 158 | } else { 159 | return redirect()->route('_route_.index', /*_cparentvars_*/)->with('error', '_title_ not found'); 160 | } 161 | } 162 | 163 | /** 164 | * Permanently delete the specified resource from storage. 165 | * 166 | * @param \App\Models\_model_ $_var_ 167 | * 168 | * @return \Illuminate\Http\RedirectResponse 169 | */ 170 | public function purge(/*_cparentargs_*/ int $_var__id,) { 171 | /*_pauthorize_*/ 172 | 173 | /*_cfindbyid_*/ 174 | /*_mauthorize_*/ 175 | 176 | if (!empty($_var_)) { 177 | $_var_->forceDelete(); 178 | return redirect()->route('_route_.index', /*_cparentvars_*/)->with('success', __('_title_ purged successfully')); 179 | } else { 180 | return redirect()->route('_route_.index', /*_cparentvars_*/)->with('error', __('_title_ not found')); 181 | } 182 | } 183 | //@endsoftdelete 184 | } 185 | -------------------------------------------------------------------------------- /src/template/stubs/Models/_model_.php: -------------------------------------------------------------------------------- 1 | group(function () { 7 | Route::resource('_parentrouteurlwithvars_', _controller_::class, [/*_asroute_*/]); 8 | //@softdelete 9 | Route::put('_routeurlwithvars_/restore', [_controller_::class, 'restore'])->name('_route_.restore'); 10 | Route::delete('_routeurlwithvars_/purge', [_controller_::class, 'purge'])->name('_route_.purge'); 11 | //@endsoftdelete 12 | }); 13 | -------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/create-edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('_route_.layout') 2 | 3 | @section('_vars_.content') 4 |
5 |
6 |
7 | 11 |
12 |
13 |
14 | @method(isset($_var_?->id) ? 'PUT' : 'POST') 15 | @csrf 16 |
17 | _edit_ 18 |
19 | 25 |
26 |
27 |
28 |
29 | @endsection 30 | -------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends('_route_.layout') 2 | 3 | @section('_vars_.content') 4 |
5 |
6 |
7 | 11 |
12 | 13 |
14 |
15 |
16 | @csrf 17 | _create_ 18 |
19 | 20 | 26 |
27 |
28 |
29 |
30 | @endsection 31 | -------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('_route_.layout') 2 | 3 | @section('_vars_.content') 4 |
5 |
6 |
7 | 11 |
12 |
13 |
14 | @method('PUT') 15 | @csrf 16 |
17 | _edit_ 18 |
19 | 25 |
26 |
27 |
28 |
29 | @endsection 30 | -------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('_route_.layout') 2 | 3 | @section('_vars_.content') 4 |
5 |
6 |
7 | 10 | 11 |
12 |
13 | 14 | 15 | 16 | 17 |
18 |
19 |
20 |
21 | _index_ 22 | 23 | {{ $_vars_->withQueryString()->links() }} 24 |
25 | 28 |
29 |
30 | @endsection 31 | -------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/layout.blade.php: -------------------------------------------------------------------------------- 1 | @extends('_layout_') 2 | 3 | @section('_section_') 4 | @if(isset($showErrors)) 5 | @if ($errors->any()) 6 |
7 |
8 |
    9 | @foreach ($errors->all() as $error) 10 |
  1. {{ $error }}
  2. 11 | @endforeach 12 |
13 |
14 |
15 | @endif 16 | 17 | @if (session('success') || session('error')) 18 |
19 | 23 |
24 | @endif 25 | @endif 26 | 27 | @yield('_vars_.content') 28 | @endsection 29 | -------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/partials/buttons/actions-expanded.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @@lang('Show') 3 | @@lang('Edit') 4 |
5 | @@csrf 6 | @@method('DELETE') 7 | 8 |
9 |
-------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/partials/buttons/actions-trash.blade.php: -------------------------------------------------------------------------------- 1 | @@if($_var_->trashed()) 2 |
3 | @@csrf 4 | @@method('PUT') 5 | 6 |
7 |
8 | @@csrf 9 | @@method('DELETE') 10 | 11 |
12 | @@else 13 | {!! $render('buttons/actions') !!} 14 | @@endif 15 | -------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/partials/buttons/actions.blade.php: -------------------------------------------------------------------------------- 1 | @@lang('Show') 2 |
3 | 4 | 14 |
15 | -------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/partials/display/boolean.blade.php: -------------------------------------------------------------------------------- 1 | {{ $_var_->_col_ ? "Yes" : "No" }} 2 | -------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/partials/display/json.blade.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/partials/display/string.blade.php: -------------------------------------------------------------------------------- 1 | {{ $_var_->_col_ ?: "(blank)" }} 2 | -------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/partials/display/text.blade.php: -------------------------------------------------------------------------------- 1 | {{ Str::limit($_var_->_col_, 50) ?: "(blank)"}} 2 | -------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/partials/inputs/boolean.blade.php: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 |
6 |
7 | 8 | 9 |
10 |
11 | -------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/partials/inputs/input.blade.php: -------------------------------------------------------------------------------- 1 | $errors->has('_id_')])> 2 | -------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/partials/inputs/json.blade.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/partials/inputs/related.blade.php: -------------------------------------------------------------------------------- 1 |
2 | 8 | 9 | New 10 |
11 | -------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/partials/inputs/select.blade.php: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/partials/inputs/textarea.blade.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/partials/render/breadcrumbs.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/partials/render/cards.blade.php: -------------------------------------------------------------------------------- 1 |
2 | 3 | @@foreach ($_vars_ as $_var_) 4 |
5 |
6 |
_title_ #@{{ $_var_->id }}
7 |

@{{ $_var_->_readable_ }}

8 |
9 | 16 |
17 | @@endforeach 18 | 19 |
-------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/partials/render/chat.blade.php: -------------------------------------------------------------------------------- 1 | @@for($i = 0, $_var_ = $_vars_[0]; $i < count($_vars_); $i++, $_var_ = $_vars_[$i]) 2 |
3 | photo 4 | 5 |
6 |
7 |

8 | _title_ #@{{ $_var_->id }} 9 | 12 mins ago 10 |

11 |
12 | @{{ $_var_->_readable_ }} 13 |
14 |
15 |
16 | 17 | @@endfor 18 | -------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/partials/render/form.blade.php: -------------------------------------------------------------------------------- 1 | @foreach($fields as $field) 2 |
3 | 4 | {!! $input($field) !!} 5 | {!! $err($field) !!} 6 |
7 | @endforeach 8 | -------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/partials/render/show.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | @foreach ($fields as $field) 8 | 9 | 10 | 11 | 12 | @endforeach 13 | @if($hasTimestamps) 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | @endif 23 | 24 |
ID:@{{$_var_->id}}
{{ $field->name }}:{!! $display($field) !!}
Created at@{{Carbon\Carbon::parse($_var_->created_at)->format('d/m/Y H:i:s')}}
Updated at@{{Carbon\Carbon::parse($_var_->updated_at)->format('d/m/Y H:i:s')}}
25 | -------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/partials/render/table.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | @foreach($fields as $field) 5 | 6 | @endforeach 7 | 8 | 9 | 10 | 11 | @@foreach ($_vars_ as $_var_) 12 | 13 | @foreach($fields as $field) 14 | 15 | @endforeach 16 | 17 | 24 | 25 | @@endforeach 26 | 27 |
{{ $field->name }}Actions
{!! $display($field) !!} 18 | @if(!empty($hasSoftDelete)) 19 | {!! $render('buttons/actions-trash') !!} 20 | @else 21 | {!! $render('buttons/actions') !!} 22 | @endif 23 |
28 | -------------------------------------------------------------------------------- /src/template/stubs/views/bootstrap/show.blade.php: -------------------------------------------------------------------------------- 1 | @extends('_route_.layout') 2 | 3 | @section('_vars_.content') 4 |
5 |
6 |
7 | 11 | 12 | Back 13 |
14 | 15 |
16 | _show_ 17 |
18 | 19 | 27 |
28 |
29 | @endsection 30 | -------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/create-edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('_route_.layout') 2 | 3 | @section('_vars_.content') 4 |
5 |
6 |
7 | 11 |
12 |
13 | 14 |
15 | _edit_ 16 |
17 | 23 |
24 |
25 |
26 |
27 | @endsection 28 | -------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends('_route_.layout') 2 | 3 | @section('_vars_.content') 4 |
5 |
6 |
7 | 11 |
12 | 13 |
14 | 15 |
16 | _create_ 17 |
18 | 19 | 25 |
26 |
27 |
28 |
29 | @endsection 30 | -------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('_route_.layout') 2 | 3 | @section('_vars_.content') 4 |
5 |
6 |
7 | 11 |
12 |
13 | 14 |
15 | _edit_ 16 |
17 | 23 |
24 |
25 |
26 |
27 | @endsection 28 | -------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('_route_.layout') 2 | 3 | @section('_vars_.content') 4 |
5 |
6 |
7 | 10 | 11 |
12 |
13 | 14 | 15 | 16 | 17 |
18 |
19 |
20 |
21 | _index_ 22 | 23 | {{ $_vars_->withQueryString()->links() }} 24 |
25 | 28 |
29 |
30 | @endsection 31 | -------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/layout.blade.php: -------------------------------------------------------------------------------- 1 | @extends('_layout_') 2 | 3 | @section('_section_') 4 | @if(isset($showErrors)) 5 | @if ($errors->any()) 6 |
7 |
8 |
    9 | @foreach ($errors->all() as $error) 10 |
  1. {{ $error }}
  2. 11 | @endforeach 12 |
13 |
14 |
15 | @endif 16 | 17 | @if (session('success') || session('error')) 18 |
19 | 23 |
24 | @endif 25 | @endif 26 | 27 | @yield('_vars_.content') 28 | @endsection 29 | -------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/partials/buttons/actions-expanded.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @@lang('Show') 3 | @@lang('Edit') 4 |
5 | @@csrf 6 | @@method('DELETE') 7 | 8 |
9 |
-------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/partials/buttons/actions-trash.blade.php: -------------------------------------------------------------------------------- 1 | @@if($_var_->trashed()) 2 |
3 | @@csrf 4 | @@method('PUT') 5 | 6 |
7 |
8 | @@csrf 9 | @@method('DELETE') 10 | 11 |
12 | @@else 13 | {!! $render('buttons/actions') !!} 14 | @@endif 15 | -------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/partials/buttons/actions.blade.php: -------------------------------------------------------------------------------- 1 | @@lang('Show') 2 |
3 | 4 | 14 |
15 | -------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/partials/display/boolean.blade.php: -------------------------------------------------------------------------------- 1 | {{ $_var_->_col_ ? "Yes" : "No" }} 2 | -------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/partials/display/json.blade.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/partials/display/string.blade.php: -------------------------------------------------------------------------------- 1 | {{ $_var_->_col_ ?: "(blank)" }} 2 | -------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/partials/display/text.blade.php: -------------------------------------------------------------------------------- 1 | {{ Str::limit($_var_->_col_, 50) ?: "(blank)"}} 2 | -------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/partials/inputs/boolean.blade.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/partials/inputs/input.blade.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/partials/inputs/json.blade.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/partials/inputs/related.blade.php: -------------------------------------------------------------------------------- 1 | 2 | Create new _label_ 3 | -------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/partials/inputs/select.blade.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/partials/inputs/textarea.blade.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/partials/render/breadcrumbs.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/partials/render/cards.blade.php: -------------------------------------------------------------------------------- 1 |
2 | 3 | @@foreach ($_vars_ as $_var_) 4 |
5 |
6 |
_title_ #@{{ $_var_->id }}
7 |

@{{ $_var_->_readable_ }}

8 |
9 | 16 |
17 | @@endforeach 18 | 19 |
-------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/partials/render/chat.blade.php: -------------------------------------------------------------------------------- 1 | @@for($i = 0, $_var_ = $_vars_[0]; $i < count($_vars_); $i++, $_var_ = $_vars_[$i]) 2 |
3 | photo 4 | 5 |
6 |
7 |

8 | _title_ #@{{ $_var_->id }} 9 | 12 mins ago 10 |

11 |
12 | @{{ $_var_->_readable_ }} 13 |
14 |
15 |
16 | 17 | @@endfor 18 | -------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/partials/render/form.blade.php: -------------------------------------------------------------------------------- 1 | @foreach($fields as $field) 2 | {!! $input($field) !!} 3 | @endforeach 4 | -------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/partials/render/show.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | @foreach ($fields as $field) 8 | 9 | 10 | 11 | 12 | @endforeach 13 | @if($hasTimestamps) 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | @endif 23 | 24 |
ID:@{{$_var_->id}}
{{ $field->name }}:{!! $display($field) !!}
Created at@{{Carbon\Carbon::parse($_var_->created_at)->format('d/m/Y H:i:s')}}
Updated at@{{Carbon\Carbon::parse($_var_->updated_at)->format('d/m/Y H:i:s')}}
25 | -------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/partials/render/table.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | @foreach($fields as $field) 5 | 6 | @endforeach 7 | 8 | 9 | 10 | 11 | @@foreach ($_vars_ as $_var_) 12 | 13 | @foreach($fields as $field) 14 | 15 | @endforeach 16 | 17 | 24 | 25 | @@endforeach 26 | 27 |
{{ $field->name }}Actions
{!! $display($field) !!} 18 | @if(!empty($hasSoftDelete)) 19 | {!! $render('buttons/actions-trash') !!} 20 | @else 21 | {!! $render('buttons/actions') !!} 22 | @endif 23 |
28 | -------------------------------------------------------------------------------- /src/template/stubs/views/larastrap/show.blade.php: -------------------------------------------------------------------------------- 1 | @extends('_route_.layout') 2 | 3 | @section('_vars_.content') 4 |
5 |
6 |
7 | 11 | 12 | Back 13 |
14 | 15 |
16 | _show_ 17 |
18 | 19 | 27 |
28 |
29 | @endsection 30 | -------------------------------------------------------------------------------- /src/template/stubs/views/tailwind/create-edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('_route_.layout') 2 | 3 | @section('_vars_.content') 4 |
5 |
6 |
7 |
    8 | _breadcrumbs_ 9 |
10 |
11 |
12 |
13 | @method(isset($_var_?->id) ? 'PUT' : 'POST') 14 | @csrf 15 |
16 | _edit_ 17 |
18 |
19 |
20 | Cancel 21 | 22 |
23 |
24 |
25 |
26 |
27 |
28 | @endsection 29 | -------------------------------------------------------------------------------- /src/template/stubs/views/tailwind/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends('_route_.layout') 2 | 3 | @section('_vars_.content') 4 |
5 |
6 |
7 |
    8 | _breadcrumbs_ 9 |
10 |
11 | 12 |
13 |
14 |
15 | @csrf 16 | _create_ 17 |
18 | 19 |
20 |
21 | @lang('Cancel') 22 | 23 |
24 |
25 |
26 |
27 |
28 |
29 | @endsection 30 | -------------------------------------------------------------------------------- /src/template/stubs/views/tailwind/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('_route_.layout') 2 | 3 | @section('_vars_.content') 4 |
5 |
6 |
7 |
    8 | _breadcrumbs_ 9 |
10 |
11 |
12 |
13 | @method('PUT') 14 | @csrf 15 |
16 | _edit_ 17 |
18 |
19 |
20 | Cancel 21 | 22 |
23 |
24 |
25 |
26 |
27 |
28 | @endsection 29 | -------------------------------------------------------------------------------- /src/template/stubs/views/tailwind/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('_route_.layout') 2 | 3 | @section('_vars_.content') 4 |
5 |
6 |
7 |
    8 | _breadcrumbs_ 9 |
10 |
11 |
12 | 13 | 14 |
15 |
16 |
17 |
18 | _index_ 19 | 20 | {{ $_vars_->withQueryString()->links() }} 21 |
22 | 25 |
26 |
27 | @endsection 28 | -------------------------------------------------------------------------------- /src/template/stubs/views/tailwind/layout.blade.php: -------------------------------------------------------------------------------- 1 | @extends('_layout_') 2 | 3 | @section('_section_') 4 | @if(isset($showErrors)) 5 | @if ($errors->any()) 6 |
7 | 17 |
18 | @endif 19 | 20 | @if (session('success')) 21 |
22 | 28 |
29 | @endif 30 | 31 | @if (session('error')) 32 |
33 | 39 |
40 | @endif 41 | @endif 42 | 43 | @yield('_vars_.content') 44 | @endsection 45 | -------------------------------------------------------------------------------- /src/template/stubs/views/tailwind/partials/buttons/actions-trash.blade.php: -------------------------------------------------------------------------------- 1 | @@if($_var_->trashed()) 2 |
3 |
4 | @@csrf 5 | @@method('PUT') 6 | 7 |
8 |
9 | @@csrf 10 | @@method('DELETE') 11 | 12 |
13 |
14 | @@else 15 | {!! $render('buttons/actions') !!} 16 | @@endif 17 | -------------------------------------------------------------------------------- /src/template/stubs/views/tailwind/partials/buttons/actions.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @@lang('Show') 3 | @@lang('Edit') 4 |
5 | @@csrf 6 | @@method('DELETE') 7 | 8 |
9 |
-------------------------------------------------------------------------------- /src/template/stubs/views/tailwind/partials/display/boolean.blade.php: -------------------------------------------------------------------------------- 1 | {{ $_var_->_col_ ? "Yes" : "No" }} 2 | -------------------------------------------------------------------------------- /src/template/stubs/views/tailwind/partials/display/json.blade.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/template/stubs/views/tailwind/partials/display/string.blade.php: -------------------------------------------------------------------------------- 1 | {{ $_var_->_col_ ?: "(blank)" }} 2 | -------------------------------------------------------------------------------- /src/template/stubs/views/tailwind/partials/display/text.blade.php: -------------------------------------------------------------------------------- 1 | {{ Str::limit($_var_->_col_, 50) ?: "(blank)"}} 2 | -------------------------------------------------------------------------------- /src/template/stubs/views/tailwind/partials/inputs/boolean.blade.php: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 |
6 |
7 | 8 | 9 |
10 |
11 | -------------------------------------------------------------------------------- /src/template/stubs/views/tailwind/partials/inputs/input.blade.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/template/stubs/views/tailwind/partials/inputs/json.blade.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/template/stubs/views/tailwind/partials/inputs/related.blade.php: -------------------------------------------------------------------------------- 1 |
2 | 8 | 9 | New 10 |
11 | -------------------------------------------------------------------------------- /src/template/stubs/views/tailwind/partials/inputs/select.blade.php: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /src/template/stubs/views/tailwind/partials/inputs/textarea.blade.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/template/stubs/views/tailwind/partials/render/breadcrumbs.blade.php: -------------------------------------------------------------------------------- 1 |
  • 2 | 3 | 4 | 5 | 6 | {!! $anchortext !!} 7 | 8 |
  • -------------------------------------------------------------------------------- /src/template/stubs/views/tailwind/partials/render/cards.blade.php: -------------------------------------------------------------------------------- 1 |
    2 | 3 | @@foreach ($_vars_ as $_var_) 4 |
    5 |
    6 |
    _title_ #@{{ $_var_->id }}
    7 |

    @{{ $_var_->_readable_ }}

    8 |
    9 |
    10 | @if(!empty($hasSoftDelete)) 11 | {!! $render('buttons/actions-trash') !!} 12 | @else 13 | {!! $render('buttons/actions') !!} 14 | @endif 15 |
    16 |
    17 | @@endforeach 18 | 19 |
    -------------------------------------------------------------------------------- /src/template/stubs/views/tailwind/partials/render/chat.blade.php: -------------------------------------------------------------------------------- 1 |
    2 | @@for($i = 0, $_var_ = $_vars_[0]; $i < count($_vars_); $i++, $_var_ = $_vars_[$i]) 3 | @@if($i % 2) 4 |
    5 |
    6 |
    7 |
    @{{ $_var_->_readable_ }}
    8 |
    9 | My profile 10 |
    11 |
    12 | @@else 13 |
    14 |
    15 |
    16 |
    @{{ $_var_->_readable_ }}
    17 |
    18 | My profile 19 |
    20 |
    21 | @@endif 22 | @@endfor 23 |
    -------------------------------------------------------------------------------- /src/template/stubs/views/tailwind/partials/render/form.blade.php: -------------------------------------------------------------------------------- 1 | @foreach($fields as $field) 2 |
    3 |
    4 | 5 | {!! $input($field) !!} 6 | {!! $err($field) !!} 7 |
    8 |
    9 | @endforeach 10 | -------------------------------------------------------------------------------- /src/template/stubs/views/tailwind/partials/render/show.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | @foreach ($fields as $field) 8 | 9 | 10 | 11 | 12 | @endforeach 13 | @if($hasTimestamps) 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | @endif 23 | 24 |
    ID:@{{$_var_->id}}
    {{ $field->name }}:{!! $display($field) !!}
    Created at@{{Carbon\Carbon::parse($_var_->created_at)->format('d/m/Y H:i:s')}}
    Updated at@{{Carbon\Carbon::parse($_var_->updated_at)->format('d/m/Y H:i:s')}}
    25 | -------------------------------------------------------------------------------- /src/template/stubs/views/tailwind/partials/render/table.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | @foreach($fields as $field) 5 | 6 | @endforeach 7 | 8 | 9 | 10 | 11 | @@foreach ($_vars_ as $_var_) 12 | 13 | @foreach($fields as $field) 14 | 18 | @endforeach 19 | 20 | 27 | 28 | @@endforeach 29 | 30 |
    15 | {{ $field->name }} 16 | {!! $display($field) !!} 17 | 21 | @if(!empty($hasSoftDelete)) 22 | {!! $render('buttons/actions-trash') !!} 23 | @else 24 | {!! $render('buttons/actions') !!} 25 | @endif 26 |
    31 | -------------------------------------------------------------------------------- /src/template/stubs/views/tailwind/show.blade.php: -------------------------------------------------------------------------------- 1 | @extends('_route_.layout') 2 | 3 | @section('_vars_.content') 4 |
    5 |
    6 |
    7 |
      8 | _breadcrumbs_ 9 |
    10 | 11 | Back 12 |
    13 | 14 |
    15 | _show_ 16 |
    17 | 18 |
    19 | @lang('Edit') 20 |
    21 | @csrf 22 | @method('DELETE') 23 | 24 |
    25 |
    26 |
    27 |
    28 | @endsection 29 | --------------------------------------------------------------------------------