├── resources ├── stubs │ ├── install │ │ ├── resources │ │ │ ├── sass │ │ │ │ ├── _variables.scss.stub │ │ │ │ └── app.scss.stub │ │ │ ├── js │ │ │ │ └── app.js.stub │ │ │ └── .DS_Store │ │ ├── .DS_Store │ │ ├── app │ │ │ ├── .DS_Store │ │ │ ├── Http │ │ │ │ ├── .DS_Store │ │ │ │ └── Livewire │ │ │ │ │ ├── .DS_Store │ │ │ │ │ ├── Layouts │ │ │ │ │ ├── Logo.php.stub │ │ │ │ │ └── Navbar.php.stub │ │ │ │ │ ├── Auth │ │ │ │ │ ├── Logout.php.stub │ │ │ │ │ ├── PasswordForgot.php.stub │ │ │ │ │ ├── Profile.php.stub │ │ │ │ │ ├── Register.php.stub │ │ │ │ │ ├── Login.php.stub │ │ │ │ │ └── PasswordReset.php.stub │ │ │ │ │ ├── Home.php.stub │ │ │ │ │ ├── Welcome.php.stub │ │ │ │ │ └── Users │ │ │ │ │ ├── Read.php.stub │ │ │ │ │ ├── Create.php.stub │ │ │ │ │ ├── Update.php.stub │ │ │ │ │ └── Index.php.stub │ │ │ └── Models │ │ │ │ └── User.php.stub │ │ ├── database │ │ │ ├── .DS_Store │ │ │ ├── seeders │ │ │ │ └── DatabaseSeeder.php.stub │ │ │ └── factories │ │ │ │ └── UserFactory.php.stub │ │ ├── routes │ │ │ └── web.php.stub │ │ ├── webpack.mix.js.stub │ │ └── package.json.stub │ ├── .DS_Store │ ├── crud │ │ ├── .DS_Store │ │ ├── app │ │ │ ├── .DS_Store │ │ │ ├── Http │ │ │ │ ├── .DS_Store │ │ │ │ └── Livewire │ │ │ │ │ ├── .DS_Store │ │ │ │ │ └── DummyModels │ │ │ │ │ ├── Read.php.stub │ │ │ │ │ ├── Create.php.stub │ │ │ │ │ ├── Update.php.stub │ │ │ │ │ └── Index.php.stub │ │ │ └── Models │ │ │ │ └── DummyModel.php.stub │ │ └── database │ │ │ └── factories │ │ │ └── DummyFactory.php.stub │ ├── swift │ │ └── DummyComponent.php.stub │ ├── crudtrait │ │ ├── database │ │ │ └── factories │ │ │ │ └── DummyFactory.php.stub │ │ └── app │ │ │ ├── Http │ │ │ └── Livewire │ │ │ │ └── DummyModels │ │ │ │ ├── Crud.php.stub │ │ │ │ ├── Create.php.stub │ │ │ │ ├── Read.php.stub │ │ │ │ ├── Update.php.stub │ │ │ │ └── Index.php.stub │ │ │ └── Models │ │ │ └── DummyModel.php.stub │ ├── swiftmodel │ │ ├── database │ │ │ └── factories │ │ │ │ └── DummyFactory.php.stub │ │ └── app │ │ │ └── Models │ │ │ └── DummyModel.php.stub │ ├── page │ │ └── DummyComponent.php.stub │ └── password-forgot │ │ └── app │ │ └── Http │ │ └── Livewire │ │ └── Auth │ │ ├── PasswordForgot.php.stub │ │ ├── Login.php.stub │ │ └── PasswordReset.php.stub ├── views │ ├── components │ │ ├── image.blade.php │ │ ├── linebreak.blade.php │ │ ├── horizontal-rule.blade.php │ │ ├── livewire.blade.php │ │ ├── code.blade.php │ │ ├── pre.blade.php │ │ ├── link.blade.php │ │ ├── col.blade.php │ │ ├── div.blade.php │ │ ├── form.blade.php │ │ ├── list-item.blade.php │ │ ├── paragraph.blade.php │ │ ├── span.blade.php │ │ ├── table-row.blade.php │ │ ├── label.blade.php │ │ ├── table-data.blade.php │ │ ├── table-header.blade.php │ │ ├── table-body.blade.php │ │ ├── table-head.blade.php │ │ ├── icon.blade.php │ │ ├── list.blade.php │ │ ├── heading.blade.php │ │ ├── iframe.blade.php │ │ ├── nav.blade.php │ │ ├── row.blade.php │ │ ├── badge.blade.php │ │ ├── nav-link.blade.php │ │ ├── navbar.blade.php │ │ ├── button.blade.php │ │ ├── container.blade.php │ │ ├── form-row.blade.php │ │ ├── nav-item.blade.php │ │ ├── navbar-nav.blade.php │ │ ├── button-group.blade.php │ │ ├── list-group.blade.php │ │ ├── navbar-brand.blade.php │ │ ├── breadcrumb-item.blade.php │ │ ├── button-toolbar.blade.php │ │ ├── list-group-item.blade.php │ │ ├── navbar-collapse.blade.php │ │ ├── breadcrumb.blade.php │ │ ├── form-group.blade.php │ │ ├── progress-bar.blade.php │ │ ├── dropdown.blade.php │ │ ├── nav-dropdown.blade.php │ │ ├── blockquote.blade.php │ │ ├── table.blade.php │ │ ├── pagination.blade.php │ │ ├── navbar-toggler.blade.php │ │ ├── alert.blade.php │ │ ├── input.blade.php │ │ ├── card.blade.php │ │ ├── textarea.blade.php │ │ ├── select.blade.php │ │ ├── input-group.blade.php │ │ ├── modal.blade.php │ │ ├── checkbox.blade.php │ │ ├── radio.blade.php │ │ └── file.blade.php │ ├── livewire │ │ └── swift-component.blade.php │ └── layouts │ │ └── app.blade.php ├── .DS_Store ├── lang │ └── en │ │ └── swift.php ├── sass │ └── swift.scss └── js │ └── swift.js ├── .DS_Store ├── src ├── Components │ ├── LinebreakComponent.php │ ├── NavLinkComponent.php │ ├── NavbarBrandComponent.php │ ├── HorizontalRuleComponent.php │ ├── NavDropdownComponent.php │ ├── NavbarTogglerComponent.php │ ├── TextareaComponent.php │ ├── CodeComponent.php │ ├── DivComponent.php │ ├── PreComponent.php │ ├── SpanComponent.php │ ├── FormRowComponent.php │ ├── NavItemComponent.php │ ├── BreadcrumbComponent.php │ ├── ContainerComponent.php │ ├── NavbarNavComponent.php │ ├── PaginationComponent.php │ ├── ParagraphComponent.php │ ├── TableBodyComponent.php │ ├── ButtonGroupComponent.php │ ├── ButtonToolbarComponent.php │ ├── NavbarCollapseComponent.php │ ├── LivewireComponent.php │ ├── TableRowComponent.php │ ├── TableDataComponent.php │ ├── TableHeaderComponent.php │ ├── LabelComponent.php │ ├── RowComponent.php │ ├── ListItemComponent.php │ ├── BreadcrumbItemComponent.php │ ├── HeadingComponent.php │ ├── FormGroupComponent.php │ ├── BlockquoteComponent.php │ ├── IframeComponent.php │ ├── TableHeadComponent.php │ ├── ListGroupComponent.php │ ├── ImageComponent.php │ ├── ListComponent.php │ ├── ProgressBarComponent.php │ ├── NavComponent.php │ ├── CardComponent.php │ ├── EachComponent.php │ ├── IfComponent.php │ ├── FormComponent.php │ ├── FileComponent.php │ ├── NavbarComponent.php │ ├── InputGroupComponent.php │ ├── TableComponent.php │ ├── LinkComponent.php │ ├── BadgeComponent.php │ ├── ModalComponent.php │ ├── RadioComponent.php │ ├── CheckboxComponent.php │ ├── AlertComponent.php │ ├── SelectComponent.php │ ├── ListGroupItemComponent.php │ ├── IconComponent.php │ ├── InputComponent.php │ ├── DropdownComponent.php │ ├── ColComponent.php │ ├── BaseComponent.php │ ├── ButtonComponent.php │ └── SwiftComponent.php ├── Traits │ ├── DropdownUtilities.php │ ├── PollingUtilities.php │ ├── CollapseUtilities.php │ ├── ShadowUtilities.php │ ├── SwiftModel.php │ ├── ModelUtilities.php │ ├── OrderUtilities.php │ ├── LoadingUtilities.php │ ├── PositionUtilities.php │ ├── TableUtilities.php │ ├── SizingUtilities.php │ ├── BackgroundUtilities.php │ ├── ClickUtilities.php │ ├── FloatUtilities.php │ ├── BorderUtilities.php │ ├── JustifyUtilities.php │ ├── PaddingUtilities.php │ ├── DisplayUtilities.php │ ├── TextUtilities.php │ ├── FlexUtilities.php │ └── MarginUtilities.php ├── Commands │ ├── MakeSwiftModelCommand.php │ ├── MakeSwiftCommand.php │ ├── MakePageCommand.php │ ├── InstallPasswordForgot.php │ ├── InstallSwiftCommand.php │ ├── MakeCrudCommand.php │ ├── MakeCrudTraitCommand.php │ ├── CreatesFiles.php │ └── MigrateAutoCommand.php ├── Livewire │ ├── ThrottlesAttempts.php │ └── SwiftComponent.php └── Providers │ └── SwiftServiceProvider.php ├── config └── swift.php ├── composer.json └── routes └── web.php /resources/stubs/install/resources/sass/_variables.scss.stub: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redbastie/swift/HEAD/.DS_Store -------------------------------------------------------------------------------- /resources/views/components/image.blade.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/views/components/linebreak.blade.php: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /resources/views/components/horizontal-rule.blade.php: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /resources/views/components/livewire.blade.php: -------------------------------------------------------------------------------- 1 | @livewire($name, $data, key(uniqid())) 2 | -------------------------------------------------------------------------------- /resources/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redbastie/swift/HEAD/resources/.DS_Store -------------------------------------------------------------------------------- /resources/views/components/code.blade.php: -------------------------------------------------------------------------------- 1 | {!! $content !!} 2 | -------------------------------------------------------------------------------- /resources/views/components/pre.blade.php: -------------------------------------------------------------------------------- 1 |
{!! $content !!}
2 | -------------------------------------------------------------------------------- /resources/stubs/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redbastie/swift/HEAD/resources/stubs/.DS_Store -------------------------------------------------------------------------------- /resources/views/components/link.blade.php: -------------------------------------------------------------------------------- 1 | 2 | {!! $content !!} 3 | 4 | -------------------------------------------------------------------------------- /resources/views/components/col.blade.php: -------------------------------------------------------------------------------- 1 |
2 | {!! $content !!} 3 |
4 | -------------------------------------------------------------------------------- /resources/views/components/div.blade.php: -------------------------------------------------------------------------------- 1 |
2 | {!! $content !!} 3 |
4 | -------------------------------------------------------------------------------- /resources/views/components/form.blade.php: -------------------------------------------------------------------------------- 1 |
2 | {!! $content !!} 3 |
4 | -------------------------------------------------------------------------------- /resources/views/components/list-item.blade.php: -------------------------------------------------------------------------------- 1 |
  • 2 | {!! $content !!} 3 |
  • 4 | -------------------------------------------------------------------------------- /resources/views/components/paragraph.blade.php: -------------------------------------------------------------------------------- 1 |

    2 | {!! $content !!} 3 |

    4 | -------------------------------------------------------------------------------- /resources/views/components/span.blade.php: -------------------------------------------------------------------------------- 1 | 2 | {!! $content !!} 3 | 4 | -------------------------------------------------------------------------------- /resources/views/components/table-row.blade.php: -------------------------------------------------------------------------------- 1 | 2 | {!! $content !!} 3 | 4 | -------------------------------------------------------------------------------- /resources/stubs/crud/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redbastie/swift/HEAD/resources/stubs/crud/.DS_Store -------------------------------------------------------------------------------- /resources/stubs/install/resources/js/app.js.stub: -------------------------------------------------------------------------------- 1 | require('../../vendor/redbastie/swift/resources/js/swift'); 2 | -------------------------------------------------------------------------------- /resources/views/components/label.blade.php: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /resources/views/components/table-data.blade.php: -------------------------------------------------------------------------------- 1 | 2 | {!! $content !!} 3 | 4 | -------------------------------------------------------------------------------- /resources/views/components/table-header.blade.php: -------------------------------------------------------------------------------- 1 | 2 | {!! $content !!} 3 | 4 | -------------------------------------------------------------------------------- /resources/stubs/install/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redbastie/swift/HEAD/resources/stubs/install/.DS_Store -------------------------------------------------------------------------------- /resources/views/components/table-body.blade.php: -------------------------------------------------------------------------------- 1 | 2 | {!! $content !!} 3 | 4 | -------------------------------------------------------------------------------- /resources/views/components/table-head.blade.php: -------------------------------------------------------------------------------- 1 | 2 | {!! $content !!} 3 | 4 | -------------------------------------------------------------------------------- /resources/stubs/crud/app/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redbastie/swift/HEAD/resources/stubs/crud/app/.DS_Store -------------------------------------------------------------------------------- /resources/views/components/icon.blade.php: -------------------------------------------------------------------------------- 1 | merge(['class' => 'fa' . $style . ' fa-' . $name]) }}> 2 | -------------------------------------------------------------------------------- /resources/views/components/list.blade.php: -------------------------------------------------------------------------------- 1 | <{{ $type }} {{ $attributes }}> 2 | {!! $content !!} 3 | 4 | -------------------------------------------------------------------------------- /resources/stubs/install/app/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redbastie/swift/HEAD/resources/stubs/install/app/.DS_Store -------------------------------------------------------------------------------- /resources/views/components/heading.blade.php: -------------------------------------------------------------------------------- 1 | 2 | {!! $content !!} 3 | 4 | -------------------------------------------------------------------------------- /resources/stubs/crud/app/Http/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redbastie/swift/HEAD/resources/stubs/crud/app/Http/.DS_Store -------------------------------------------------------------------------------- /resources/views/components/iframe.blade.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/views/components/nav.blade.php: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /resources/views/components/row.blade.php: -------------------------------------------------------------------------------- 1 |
    merge(['class' => 'row']) }}> 2 | {!! $content !!} 3 |
    4 | -------------------------------------------------------------------------------- /resources/stubs/install/app/Http/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redbastie/swift/HEAD/resources/stubs/install/app/Http/.DS_Store -------------------------------------------------------------------------------- /resources/stubs/install/database/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redbastie/swift/HEAD/resources/stubs/install/database/.DS_Store -------------------------------------------------------------------------------- /resources/stubs/install/resources/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redbastie/swift/HEAD/resources/stubs/install/resources/.DS_Store -------------------------------------------------------------------------------- /resources/views/components/badge.blade.php: -------------------------------------------------------------------------------- 1 | merge(['class' => 'badge']) }}> 2 | {!! $content !!} 3 | 4 | -------------------------------------------------------------------------------- /resources/views/components/nav-link.blade.php: -------------------------------------------------------------------------------- 1 | merge(['class' => 'nav-link']) }}> 2 | {!! $content !!} 3 | 4 | -------------------------------------------------------------------------------- /resources/views/components/navbar.blade.php: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /resources/views/components/button.blade.php: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /resources/views/components/container.blade.php: -------------------------------------------------------------------------------- 1 |
    merge(['class' => 'container']) }}> 2 | {!! $content !!} 3 |
    4 | -------------------------------------------------------------------------------- /resources/views/components/form-row.blade.php: -------------------------------------------------------------------------------- 1 |
    merge(['class' => 'form-row']) }}> 2 | {!! $content !!} 3 |
    4 | -------------------------------------------------------------------------------- /resources/views/components/nav-item.blade.php: -------------------------------------------------------------------------------- 1 |
  • merge(['class' => 'nav-item']) }}> 2 | {!! $content !!} 3 |
  • 4 | -------------------------------------------------------------------------------- /resources/views/components/navbar-nav.blade.php: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /resources/stubs/crud/app/Http/Livewire/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redbastie/swift/HEAD/resources/stubs/crud/app/Http/Livewire/.DS_Store -------------------------------------------------------------------------------- /resources/views/components/button-group.blade.php: -------------------------------------------------------------------------------- 1 |
    merge(['class' => 'btn-group']) }}> 2 | {!! $content !!} 3 |
    4 | -------------------------------------------------------------------------------- /resources/views/components/list-group.blade.php: -------------------------------------------------------------------------------- 1 |
    merge(['class' => 'list-group']) }}> 2 | {!! $content !!} 3 |
    4 | -------------------------------------------------------------------------------- /resources/views/components/navbar-brand.blade.php: -------------------------------------------------------------------------------- 1 | merge(['class' => 'navbar-brand']) }}> 2 | {!! $content !!} 3 | 4 | -------------------------------------------------------------------------------- /resources/stubs/install/app/Http/Livewire/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redbastie/swift/HEAD/resources/stubs/install/app/Http/Livewire/.DS_Store -------------------------------------------------------------------------------- /resources/views/components/breadcrumb-item.blade.php: -------------------------------------------------------------------------------- 1 |
  • merge(['class' => 'breadcrumb-item']) }}> 2 | {!! $content !!} 3 |
  • 4 | -------------------------------------------------------------------------------- /resources/views/components/button-toolbar.blade.php: -------------------------------------------------------------------------------- 1 |
    merge(['class' => 'btn-toolbar']) }}> 2 | {!! $content !!} 3 |
    4 | -------------------------------------------------------------------------------- /resources/views/livewire/swift-component.blade.php: -------------------------------------------------------------------------------- 1 | @if($pageTitle) 2 | @section('title', $pageTitle) 3 | @endif 4 | 5 | {!! $this->view() !!} 6 | -------------------------------------------------------------------------------- /resources/views/components/list-group-item.blade.php: -------------------------------------------------------------------------------- 1 |
    merge(['class' => 'list-group-item']) }}> 2 | {!! $content !!} 3 |
    4 | -------------------------------------------------------------------------------- /src/Components/LinebreakComponent.php: -------------------------------------------------------------------------------- 1 | merge(['class' => 'collapse navbar-collapse']) }}> 2 | {!! $content !!} 3 | 4 | -------------------------------------------------------------------------------- /src/Components/NavbarBrandComponent.php: -------------------------------------------------------------------------------- 1 | 2 |
      merge(['class' => 'breadcrumb']) }}> 3 | {!! $content !!} 4 |
    5 | 6 | -------------------------------------------------------------------------------- /resources/stubs/install/webpack.mix.js.stub: -------------------------------------------------------------------------------- 1 | const mix = require('laravel-mix'); 2 | 3 | mix.js('resources/js/app.js', 'public/js') 4 | .sass('resources/sass/app.scss', 'public/css') 5 | .sourceMaps(); 6 | -------------------------------------------------------------------------------- /resources/views/components/form-group.blade.php: -------------------------------------------------------------------------------- 1 |
    merge(['class' => 'form-group']) }}> 2 | @if($label) 3 | 4 | @endif 5 | 6 | {!! $content !!} 7 |
    8 | -------------------------------------------------------------------------------- /resources/views/components/progress-bar.blade.php: -------------------------------------------------------------------------------- 1 |
    2 |
    merge(['class' => 'progress-bar']) }}> 3 | {!! $label !!} 4 |
    5 |
    6 | -------------------------------------------------------------------------------- /resources/views/components/dropdown.blade.php: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /resources/views/components/nav-dropdown.blade.php: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /config/swift.php: -------------------------------------------------------------------------------- 1 | true, 7 | 8 | // solid, regular, light, or duotone 9 | 'default_icon_style' => 'regular', 10 | 11 | ]; 12 | -------------------------------------------------------------------------------- /resources/views/components/blockquote.blade.php: -------------------------------------------------------------------------------- 1 |
    2 | {!! $content !!} 3 | 4 | @if($footer) 5 | 8 | @endif 9 |
    10 | -------------------------------------------------------------------------------- /src/Components/TextareaComponent.php: -------------------------------------------------------------------------------- 1 | attr('rows', $rows); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /resources/views/components/table.blade.php: -------------------------------------------------------------------------------- 1 | @if($responsive) 2 |
    3 | @endif 4 | 5 | merge(['class' => 'table']) }}> 6 | {!! $content !!} 7 |
    8 | 9 | @if($responsive) 10 |
    11 | @endif 12 | -------------------------------------------------------------------------------- /resources/views/components/pagination.blade.php: -------------------------------------------------------------------------------- 1 |
    2 |
    3 | {{ $models->links('livewire::simple-bootstrap') }} 4 |
    5 | 6 |
    7 | {{ $models->links('livewire::bootstrap') }} 8 |
    9 |
    10 | -------------------------------------------------------------------------------- /src/Components/CodeComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Components/DivComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Components/PreComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Components/SpanComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /resources/lang/en/swift.php: -------------------------------------------------------------------------------- 1 | 'Please correct the highlighted fields.', 7 | 8 | // shown for confirms if no message specified 9 | 'default_confirm_message' => 'Are you sure you want to delete this?', 10 | 11 | ]; 12 | -------------------------------------------------------------------------------- /src/Components/FormRowComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Components/NavItemComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /resources/views/components/navbar-toggler.blade.php: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /src/Components/BreadcrumbComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Components/ContainerComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Components/NavbarNavComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Components/PaginationComponent.php: -------------------------------------------------------------------------------- 1 | models = $models; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Components/ParagraphComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Components/TableBodyComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Components/ButtonGroupComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Components/ButtonToolbarComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Components/NavbarCollapseComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /resources/stubs/install/database/seeders/DatabaseSeeder.php.stub: -------------------------------------------------------------------------------- 1 | create([ 13 | 'email' => 'user@example.com', 14 | ]); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /resources/views/components/alert.blade.php: -------------------------------------------------------------------------------- 1 |
    merge(['class' => 'alert' . ($dismissable ? ' alert-dismissable' : '')]) }}> 2 | @if($dismissable) 3 | 6 | @endif 7 | 8 | {!! $content !!} 9 |
    10 | -------------------------------------------------------------------------------- /src/Components/LivewireComponent.php: -------------------------------------------------------------------------------- 1 | name = $name; 15 | $this->data = $data; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /resources/stubs/swift/DummyComponent.php.stub: -------------------------------------------------------------------------------- 1 | model)->definition($this->faker); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Components/TableRowComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /resources/stubs/crud/database/factories/DummyFactory.php.stub: -------------------------------------------------------------------------------- 1 | model)->definition($this->faker); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Components/TableDataComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /resources/stubs/crudtrait/database/factories/DummyFactory.php.stub: -------------------------------------------------------------------------------- 1 | model)->definition($this->faker); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /resources/stubs/swiftmodel/database/factories/DummyFactory.php.stub: -------------------------------------------------------------------------------- 1 | model)->definition($this->faker); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Components/TableHeaderComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Traits/DropdownUtilities.php: -------------------------------------------------------------------------------- 1 | class('dropdown-toggle'); 10 | $this->attr('data-toggle', 'dropdown'); 11 | 12 | return $this; 13 | } 14 | 15 | public function dropdownItem() 16 | { 17 | return $this->class('dropdown-item'); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Components/LabelComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | 16 | public function for($for) 17 | { 18 | return $this->attr('for', $for); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Components/RowComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | 16 | public function noGutters() 17 | { 18 | return $this->class('no-gutters'); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Traits/PollingUtilities.php: -------------------------------------------------------------------------------- 1 | attr('wire:poll' . ($ms ? '.' . $ms . 'ms' : null), ''); 10 | } 11 | 12 | public function pollAction($action, $ms = null) 13 | { 14 | return $this->attr('wire:poll' . ($ms ? '.' . $ms . 'ms' : null), $action); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Components/ListItemComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | 16 | public function inline() 17 | { 18 | return $this->class('list-inline-item'); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Traits/CollapseUtilities.php: -------------------------------------------------------------------------------- 1 | attr('data-target', '.' . $class); 10 | $this->attr('data-toggle', 'collapse'); 11 | 12 | return $this; 13 | } 14 | 15 | public function collapse($class) 16 | { 17 | return $this->class('collapse ' . $class); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /resources/stubs/install/app/Http/Livewire/Layouts/Logo.php.stub: -------------------------------------------------------------------------------- 1 | brand()->textPrimary(), 14 | config('app.name') 15 | ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Components/BreadcrumbItemComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | 16 | public function active($active = true) 17 | { 18 | return $active ? $this->class('active') : $this; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Components/HeadingComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 15 | } 16 | 17 | public function size($size) 18 | { 19 | $this->size = $size; 20 | 21 | return $this; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Components/FormGroupComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 15 | } 16 | 17 | public function label(...$content) 18 | { 19 | $this->label = implode(PHP_EOL, func_get_args()); 20 | 21 | return $this; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /resources/stubs/install/app/Http/Livewire/Auth/Logout.php.stub: -------------------------------------------------------------------------------- 1 | dropdownItem()->click('logout'); 13 | } 14 | 15 | public function logout() 16 | { 17 | auth()->logout(); 18 | 19 | $this->redirect('/'); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Components/BlockquoteComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 15 | } 16 | 17 | public function footer(...$content) 18 | { 19 | $this->footer = implode(PHP_EOL, func_get_args()); 20 | 21 | return $this; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /resources/stubs/page/DummyComponent.php.stub: -------------------------------------------------------------------------------- 1 | src = $src; 14 | } 15 | 16 | public function width($width) 17 | { 18 | return $this->attr('width', $width); 19 | } 20 | 21 | public function height($height) 22 | { 23 | return $this->attr('height', $height); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Traits/ShadowUtilities.php: -------------------------------------------------------------------------------- 1 | class('shadow'); 10 | } 11 | 12 | public function shadowSm() 13 | { 14 | return $this->class('shadow-sm'); 15 | } 16 | 17 | public function shadowLg() 18 | { 19 | return $this->class('shadow-lg'); 20 | } 21 | 22 | public function shadowNone() 23 | { 24 | return $this->class('shadow-none'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Components/TableHeadComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | 16 | public function light() 17 | { 18 | return $this->class('thead-light'); 19 | } 20 | 21 | public function dark() 22 | { 23 | return $this->class('thead-dark'); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /resources/stubs/crudtrait/app/Http/Livewire/DummyModels/Crud.php.stub: -------------------------------------------------------------------------------- 1 | label('Name')->modelDefer(), 15 | ); 16 | } 17 | 18 | protected function rules() 19 | { 20 | return [ 21 | 'name' => ['required'], 22 | ]; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /resources/views/components/input.blade.php: -------------------------------------------------------------------------------- 1 | @if($label) 2 |
    3 | 4 | @endif 5 | 6 | merge(['class' => 'form-control' . ($errors->has($name) ? ' is-invalid' : '')]) }}> 7 | 8 | @error($name) {{ $message }} @enderror 9 | 10 | @if($help) 11 | {!! $help !!} 12 | @endif 13 | 14 | @if($label) 15 |
    16 | @endif 17 | -------------------------------------------------------------------------------- /src/Components/ListGroupComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | 16 | public function flush() 17 | { 18 | return $this->class('list-group-flush'); 19 | } 20 | 21 | public function horizontal() 22 | { 23 | return $this->class('list-group-horizontal'); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /resources/views/components/card.blade.php: -------------------------------------------------------------------------------- 1 |
    merge(['class' => 'card']) }}> 2 | @if($header) 3 |
    4 | {!! $header !!} 5 |
    6 | @endif 7 | 8 | @if($image) 9 | 10 | @endif 11 | 12 | @if($body) 13 |
    14 | {!! $body !!} 15 |
    16 | @endif 17 | 18 | @if($footer) 19 | 22 | @endif 23 |
    24 | -------------------------------------------------------------------------------- /resources/views/components/textarea.blade.php: -------------------------------------------------------------------------------- 1 | @if($label) 2 |
    3 | 4 | @endif 5 | 6 | 7 | 8 | @error($name) {{ $message }} @enderror 9 | 10 | @if($help) 11 | {!! $help !!} 12 | @endif 13 | 14 | @if($label) 15 |
    16 | @endif 17 | -------------------------------------------------------------------------------- /src/Commands/MakeSwiftModelCommand.php: -------------------------------------------------------------------------------- 1 | argument = $this->argument('model'); 16 | $this->stubDir = __DIR__ . '/../../resources/stubs/swiftmodel'; 17 | 18 | $this->createFiles(); 19 | $this->info($this->argument . ' swift model generated!'); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Components/ImageComponent.php: -------------------------------------------------------------------------------- 1 | attr('src', $src); 12 | } 13 | 14 | public function alt($alt) 15 | { 16 | return $this->attr('alt', $alt); 17 | } 18 | 19 | public function fluid() 20 | { 21 | return $this->class('img-fluid'); 22 | } 23 | 24 | public function thumbnail() 25 | { 26 | return $this->class('img-thumbnail'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Commands/MakeSwiftCommand.php: -------------------------------------------------------------------------------- 1 | argument = $this->argument('component'); 16 | $this->stubDir = __DIR__ . '/../../resources/stubs/swift'; 17 | $this->targetDir = 'app/Http/Livewire'; 18 | 19 | $this->createFiles(); 20 | $this->info($this->argument . ' component generated!'); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Commands/MakePageCommand.php: -------------------------------------------------------------------------------- 1 | argument = $this->argument('component'); 16 | $this->stubDir = __DIR__ . '/../../resources/stubs/page'; 17 | $this->targetDir = 'app/Http/Livewire'; 18 | 19 | $this->createFiles(); 20 | $this->info($this->argument . ' page component generated!'); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Commands/InstallPasswordForgot.php: -------------------------------------------------------------------------------- 1 | stubDir = __DIR__ . '/../../resources/stubs/password-forgot'; 16 | 17 | if ($this->confirm('This will replace your login component. Continue?')) { 18 | $this->createFiles(); 19 | $this->info('Password forgot components installed!'); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /resources/views/layouts/app.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | @yield('title') | {{ config('app.name', 'Laravel') }} 9 | 10 | @livewireScripts 11 | 12 | @stack('scripts') 13 | 14 | @livewireStyles 15 | 16 | 17 | 18 | {{ $slot }} 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Traits/SwiftModel.php: -------------------------------------------------------------------------------- 1 | getTable()); 17 | } 18 | 19 | public function migration(Blueprint $table) 20 | { 21 | $table->id(); 22 | $table->timestamps(); 23 | } 24 | 25 | public function definition(Generator $faker) 26 | { 27 | return []; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Traits/ModelUtilities.php: -------------------------------------------------------------------------------- 1 | attr('wire:model', 'model.' . $this->name); 10 | } 11 | 12 | public function modelDebounce($ms = 500) 13 | { 14 | return $this->attr('wire:model.debounce.' . $ms . 'ms', 'model.' . $this->name); 15 | } 16 | 17 | public function modelDefer() 18 | { 19 | return $this->attr('wire:model.defer', 'model.' . $this->name); 20 | } 21 | 22 | public function modelLazy() 23 | { 24 | return $this->attr('wire:model.lazy', 'model.' . $this->name); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /resources/sass/swift.scss: -------------------------------------------------------------------------------- 1 | $body-bg: #f8f9fa !default; 2 | $card-cap-bg: #ffffff !default; 3 | $input-placeholder-color: #adb5bd !default; 4 | $input-group-addon-bg: #ffffff !default; 5 | $font-size-base: 0.9rem !default; 6 | $border-radius: 0.5rem !default; 7 | $border-radius-sm: $border-radius !default; 8 | $border-radius-lg: $border-radius !default; 9 | $custom-checkbox-indicator-border-radius: 0.25rem !default; 10 | $enable-validation-icons: false !default; 11 | 12 | @import '~bootstrap/scss/bootstrap'; 13 | @import '~bs4-toast/dist/toast.min.css'; 14 | 15 | .cursor-pointer { 16 | cursor: pointer; 17 | } 18 | 19 | .toast { 20 | overflow: hidden; 21 | border-radius: $border-radius; 22 | } 23 | -------------------------------------------------------------------------------- /src/Components/ListComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 15 | } 16 | 17 | public function ordered() 18 | { 19 | $this->type = 'ol'; 20 | 21 | return $this; 22 | } 23 | 24 | public function unstyled() 25 | { 26 | return $this->class('list-unstyled'); 27 | } 28 | 29 | public function inline() 30 | { 31 | return $this->class('list-inline'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Traits/OrderUtilities.php: -------------------------------------------------------------------------------- 1 | class('order-' . $order); 10 | } 11 | 12 | public function orderSm($orderSm) 13 | { 14 | return $this->class('order-sm-' . $orderSm); 15 | } 16 | 17 | public function orderMd($orderMd) 18 | { 19 | return $this->class('order-md-' . $orderMd); 20 | } 21 | 22 | public function orderLg($orderLg) 23 | { 24 | return $this->class('order-lg-' . $orderLg); 25 | } 26 | 27 | public function orderXl($orderXl) 28 | { 29 | return $this->class('order-xl-' . $orderXl); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /resources/stubs/crud/app/Models/DummyModel.php.stub: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('name'); 18 | $table->timestamp('created_at')->nullable(); 19 | $table->timestamp('updated_at')->nullable(); 20 | } 21 | 22 | public function definition(Generator $faker) 23 | { 24 | return [ 25 | 'name' => $faker->name, 26 | ]; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Components/ProgressBarComponent.php: -------------------------------------------------------------------------------- 1 | percent = $percent; 15 | } 16 | 17 | public function label($label) 18 | { 19 | $this->label = $label; 20 | 21 | return $this; 22 | } 23 | 24 | public function striped() 25 | { 26 | return $this->class('progress-bar-striped'); 27 | } 28 | 29 | public function animated() 30 | { 31 | return $this->class('progress-bar-animated'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /resources/stubs/crudtrait/app/Models/DummyModel.php.stub: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('name'); 18 | $table->timestamp('created_at')->nullable(); 19 | $table->timestamp('updated_at')->nullable(); 20 | } 21 | 22 | public function definition(Generator $faker) 23 | { 24 | return [ 25 | 'name' => $faker->name, 26 | ]; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /resources/stubs/swiftmodel/app/Models/DummyModel.php.stub: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('name'); 18 | $table->timestamp('created_at')->nullable(); 19 | $table->timestamp('updated_at')->nullable(); 20 | } 21 | 22 | public function definition(Generator $faker) 23 | { 24 | return [ 25 | 'name' => $faker->name, 26 | ]; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Components/NavComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | 16 | public function tabs() 17 | { 18 | return $this->class('nav-tabs'); 19 | } 20 | 21 | public function pills() 22 | { 23 | return $this->class('nav-pills'); 24 | } 25 | 26 | public function fill() 27 | { 28 | return $this->class('nav-fill'); 29 | } 30 | 31 | public function justified() 32 | { 33 | return $this->class('nav-justified'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /resources/stubs/install/app/Http/Livewire/Home.php.stub: -------------------------------------------------------------------------------- 1 | header($this->pageTitle) 23 | ->body('You are logged in!') 24 | )->md(5))->justifyContentCenter())->py(4) 25 | ); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /resources/views/components/select.blade.php: -------------------------------------------------------------------------------- 1 | @if($label) 2 |
    3 | 4 | @endif 5 | 6 | 13 | 14 | @error($name) {{ $message }} @enderror 15 | 16 | @if($help) 17 | {!! $help !!} 18 | @endif 19 | 20 | @if($label) 21 |
    22 | @endif 23 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "redbastie/swift", 3 | "description": "A SwiftUI-inspired spin on Laravel Livewire.", 4 | "homepage": "https://github.com/redbastie/swift", 5 | "license": "MIT", 6 | "authors": [ 7 | { 8 | "name": "Kevin Dion", 9 | "email": "redbastie@icloud.com", 10 | "role": "Developer" 11 | } 12 | ], 13 | "require": { 14 | "doctrine/dbal": "^2.10", 15 | "laravel/framework": "^8.0", 16 | "livewire/livewire": "^2.0" 17 | }, 18 | "autoload": { 19 | "psr-4": { 20 | "Redbastie\\Swift\\": "src" 21 | } 22 | }, 23 | "extra": { 24 | "laravel": { 25 | "providers": [ 26 | "Redbastie\\Swift\\Providers\\SwiftServiceProvider" 27 | ] 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /resources/views/components/input-group.blade.php: -------------------------------------------------------------------------------- 1 | @if($label) 2 |
    3 | 4 | @endif 5 | 6 |
    merge(['class' => 'input-group']) }}> 7 | @if($prepend) 8 |
    9 |
    10 | {!! $prepend !!} 11 |
    12 |
    13 | @endif 14 | 15 | {!! $content !!} 16 | 17 | @if($append) 18 |
    19 |
    20 | {!! $append !!} 21 |
    22 |
    23 | @endif 24 |
    25 | 26 | @if($label) 27 |
    28 | @endif 29 | -------------------------------------------------------------------------------- /resources/views/components/modal.blade.php: -------------------------------------------------------------------------------- 1 | 20 | -------------------------------------------------------------------------------- /src/Components/CardComponent.php: -------------------------------------------------------------------------------- 1 | header = implode(PHP_EOL, func_get_args()); 15 | 16 | return $this; 17 | } 18 | 19 | public function image($image) 20 | { 21 | $this->image = $image; 22 | 23 | return $this; 24 | } 25 | 26 | public function body(...$content) 27 | { 28 | $this->body = implode(PHP_EOL, func_get_args()); 29 | 30 | return $this; 31 | } 32 | 33 | public function footer(...$content) 34 | { 35 | $this->footer = implode(PHP_EOL, func_get_args()); 36 | 37 | return $this; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Components/EachComponent.php: -------------------------------------------------------------------------------- 1 | items = $items; 14 | $this->callback = $callback; 15 | } 16 | 17 | public function empty(...$content) 18 | { 19 | $this->empty = implode(PHP_EOL, func_get_args()); 20 | 21 | return $this; 22 | } 23 | 24 | public function __toString() 25 | { 26 | if (count($this->items) == 0) { 27 | return (string)$this->empty; 28 | } 29 | 30 | $string = ''; 31 | $callback = $this->callback; 32 | 33 | foreach ($this->items as $key => $item) { 34 | $string .= $callback($item, $key); 35 | } 36 | 37 | return $string; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Components/IfComponent.php: -------------------------------------------------------------------------------- 1 | conditions[] = [$condition, $callback]; 14 | } 15 | 16 | public function elseif($condition, $callback) 17 | { 18 | $this->conditions[] = [$condition, $callback]; 19 | 20 | return $this; 21 | } 22 | 23 | public function else($callback) 24 | { 25 | $this->conditions[] = [true, $callback]; 26 | 27 | return $this; 28 | } 29 | 30 | public function __toString() 31 | { 32 | foreach ($this->conditions as $condition) { 33 | if ($condition[0]) { 34 | $callback = $condition[1]; 35 | 36 | return (string)$callback(); 37 | } 38 | } 39 | 40 | return ''; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Components/FormComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | 16 | public function inline() 17 | { 18 | return $this->class('form-inline'); 19 | } 20 | 21 | public function submit($submit) 22 | { 23 | return $this->attr('wire:submit', $submit); 24 | } 25 | 26 | public function submitPrevent($submitPrevent) 27 | { 28 | return $this->attr('wire:submit.prevent', $submitPrevent); 29 | } 30 | 31 | public function submitSelf($submitSelf) 32 | { 33 | return $this->attr('wire:submit.self', $submitSelf); 34 | } 35 | 36 | public function submitStop($submitStop) 37 | { 38 | return $this->attr('wire:submit.stop', $submitStop); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /routes/web.php: -------------------------------------------------------------------------------- 1 | group(function () { 7 | $filesystem = new Filesystem; 8 | $dir = app_path('Http/Livewire'); 9 | 10 | if ($filesystem->exists($dir)) { 11 | foreach ($filesystem->allFiles($dir) as $file) { 12 | $name = 'App\\Http\\Livewire\\' . str_replace(['/', '.php'], ['\\', ''], $file->getRelativePathname()); 13 | $reflection = new ReflectionClass($name); 14 | 15 | if ($reflection->hasProperty('routeUri')) { 16 | $class = app($name); 17 | 18 | if ($class->routeUri) { 19 | $route = Route::get($class->routeUri, $name); 20 | if ($class->routeName) $route->name($class->routeName); 21 | if ($class->routeMiddleware) $route->middleware($class->routeMiddleware); 22 | } 23 | } 24 | } 25 | } 26 | }); 27 | -------------------------------------------------------------------------------- /resources/views/components/checkbox.blade.php: -------------------------------------------------------------------------------- 1 | @if($label) 2 |
    3 | 4 | @endif 5 | 6 |
    7 | merge([ 8 | 'id' => $id = $attributes->get('id', $name . '-' . uniqid()), 9 | 'class' => 'custom-control-input' . ($errors->has($name) ? ' is-invalid' : '') 10 | ]) }}> 11 | 12 | 13 | 14 | @error($name) {{ $message }} @enderror 15 |
    16 | 17 | @if($help) 18 | {!! $help !!} 19 | @endif 20 | 21 | @if($label) 22 |
    23 | @endif 24 | -------------------------------------------------------------------------------- /resources/views/components/radio.blade.php: -------------------------------------------------------------------------------- 1 | @if($label) 2 |
    3 | 4 | @endif 5 | 6 | @foreach($options as $radioValue => $radioLabel) 7 |
    8 | merge(['class' => 'custom-control-input' . ($errors->has($name) ? ' is-invalid' : '')]) }}> 10 | 11 | 12 |
    13 | @endforeach 14 | 15 | @error($name) {{ $message }} @enderror 16 | 17 | @if($help) 18 | {!! $help !!} 19 | @endif 20 | 21 | @if($label) 22 |
    23 | @endif 24 | -------------------------------------------------------------------------------- /src/Traits/LoadingUtilities.php: -------------------------------------------------------------------------------- 1 | attr('wire:loading', ''); 10 | } 11 | 12 | public function loadingRemove() 13 | { 14 | return $this->attr('wire:loading.remove', ''); 15 | } 16 | 17 | public function loadingClass($class) 18 | { 19 | return $this->attr('wire:loading.class', $class); 20 | } 21 | 22 | public function loadingClassRemove($class) 23 | { 24 | return $this->attr('wire:loading.class.remove', $class); 25 | } 26 | 27 | public function loadingAttr($attr) 28 | { 29 | return $this->attr('wire:loading.attr', $attr); 30 | } 31 | 32 | public function loadingAttrRemove($attr) 33 | { 34 | return $this->attr('wire:loading.attr.remove', $attr); 35 | } 36 | 37 | public function loadingTarget($loadingTarget) 38 | { 39 | return $this->attr('wire:target', $loadingTarget); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Traits/PositionUtilities.php: -------------------------------------------------------------------------------- 1 | class('position-static'); 10 | } 11 | 12 | public function positionRelative() 13 | { 14 | return $this->class('position-relative'); 15 | } 16 | 17 | public function positionAbsolute() 18 | { 19 | return $this->class('position-absolute'); 20 | } 21 | 22 | public function positionFixed() 23 | { 24 | return $this->class('position-fixed'); 25 | } 26 | 27 | public function positionSticky() 28 | { 29 | return $this->class('position-sticky'); 30 | } 31 | 32 | public function fixedTop() 33 | { 34 | return $this->class('fixed-top'); 35 | } 36 | 37 | public function fixedBottom() 38 | { 39 | return $this->class('fixed-bottom'); 40 | } 41 | 42 | public function stickyTop() 43 | { 44 | return $this->class('sticky-top'); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /resources/js/swift.js: -------------------------------------------------------------------------------- 1 | try { 2 | window.Popper = require('popper.js').default; 3 | window.$ = window.jQuery = require('jquery'); 4 | 5 | require('bootstrap'); 6 | } catch (e) { 7 | console.log(e); 8 | } 9 | 10 | require('bs4-toast'); 11 | 12 | $.toastDefaults = { 13 | position: 'top-right', 14 | dismissible: true, 15 | stackable: false, 16 | pauseDelayOnHover: true, 17 | style: {toast: '', info: '', success: '', warning: '', error: ''} 18 | }; 19 | 20 | Livewire.on('toastSuccess', (message) => { 21 | $.toast({ 22 | type: 'success', 23 | title: 'Success', 24 | content: message, 25 | delay: 3000, 26 | }); 27 | }); 28 | 29 | Livewire.on('toastError', (message) => { 30 | $.toast({ 31 | type: 'error', 32 | title: 'Error', 33 | content: message, 34 | delay: 3000, 35 | }); 36 | }); 37 | 38 | Livewire.on('showModal', (id) => { 39 | $('#' + id).modal('show'); 40 | }); 41 | 42 | Livewire.on('hideModal', (id) => { 43 | $('#' + id).modal('hide'); 44 | }); 45 | -------------------------------------------------------------------------------- /src/Components/FileComponent.php: -------------------------------------------------------------------------------- 1 | name = $name; 21 | } 22 | 23 | public function label(...$content) 24 | { 25 | $this->label = implode(PHP_EOL, func_get_args()); 26 | 27 | return $this; 28 | } 29 | 30 | public function placeholder(...$content) 31 | { 32 | $this->placeholder = implode(PHP_EOL, func_get_args()); 33 | 34 | return $this; 35 | } 36 | 37 | public function help(...$content) 38 | { 39 | $this->help = implode(PHP_EOL, func_get_args()); 40 | 41 | return $this; 42 | } 43 | 44 | public function multiple() 45 | { 46 | return $this->attr('multiple', ''); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Traits/TableUtilities.php: -------------------------------------------------------------------------------- 1 | class('table-active'); 10 | } 11 | 12 | public function primary() 13 | { 14 | return $this->class('table-primary'); 15 | } 16 | 17 | public function secondary() 18 | { 19 | return $this->class('table-secondary'); 20 | } 21 | 22 | public function success() 23 | { 24 | return $this->class('table-success'); 25 | } 26 | 27 | public function info() 28 | { 29 | return $this->class('table-info'); 30 | } 31 | 32 | public function danger() 33 | { 34 | return $this->class('table-danger'); 35 | } 36 | 37 | public function warning() 38 | { 39 | return $this->class('table-warning'); 40 | } 41 | 42 | public function light() 43 | { 44 | return $this->class('table-light'); 45 | } 46 | 47 | public function dark() 48 | { 49 | return $this->class('table-dark'); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Commands/InstallSwiftCommand.php: -------------------------------------------------------------------------------- 1 | stubDir = __DIR__ . '/../../resources/stubs/install'; 17 | 18 | $this->createFiles(); 19 | 20 | $userMigration = 'database/migrations/2014_10_12_000000_create_users_table.php'; 21 | 22 | if ($this->filesystem->exists($userMigration)) { 23 | $this->filesystem->delete($userMigration); 24 | $this->info('Deleted file: ' . $userMigration); 25 | } 26 | 27 | Artisan::call('migrate:auto --fresh --seed', [], $this->getOutput()); 28 | 29 | exec('npm install && npm run dev'); 30 | 31 | $this->info('Swift installed: ' . config('app.url') . ''); 32 | $this->warn('Login using user@example.com:password'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Components/NavbarComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | 16 | public function expand() 17 | { 18 | return $this->class('navbar-expand'); 19 | } 20 | 21 | public function expandSm() 22 | { 23 | return $this->class('navbar-expand-sm'); 24 | } 25 | 26 | public function expandMd() 27 | { 28 | return $this->class('navbar-expand-md'); 29 | } 30 | 31 | public function expandLg() 32 | { 33 | return $this->class('navbar-expand-lg'); 34 | } 35 | 36 | public function expandXl() 37 | { 38 | return $this->class('navbar-expand-xl'); 39 | } 40 | 41 | public function light() 42 | { 43 | return $this->class('navbar-light'); 44 | } 45 | 46 | public function dark() 47 | { 48 | return $this->class('navbar-dark'); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Components/InputGroupComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 17 | } 18 | 19 | public function label(...$content) 20 | { 21 | $this->label = implode(PHP_EOL, func_get_args()); 22 | 23 | return $this; 24 | } 25 | 26 | public function prepend(...$content) 27 | { 28 | $this->prepend = implode(PHP_EOL, func_get_args()); 29 | 30 | return $this; 31 | } 32 | 33 | public function append(...$content) 34 | { 35 | $this->append = implode(PHP_EOL, func_get_args()); 36 | 37 | return $this; 38 | } 39 | 40 | public function sm() 41 | { 42 | return $this->class('input-group-sm'); 43 | } 44 | 45 | public function lg() 46 | { 47 | return $this->class('input-group-lg'); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Components/TableComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 15 | } 16 | 17 | public function responsive() 18 | { 19 | $this->responsive = true; 20 | 21 | return $this; 22 | } 23 | 24 | public function dark() 25 | { 26 | return $this->class('table-dark'); 27 | } 28 | 29 | public function striped() 30 | { 31 | return $this->class('table-striped'); 32 | } 33 | 34 | public function bordered() 35 | { 36 | return $this->class('table-bordered'); 37 | } 38 | 39 | public function borderless() 40 | { 41 | return $this->class('table-borderless'); 42 | } 43 | 44 | public function hover() 45 | { 46 | return $this->class('table-hover'); 47 | } 48 | 49 | public function sm() 50 | { 51 | return $this->class('table-sm'); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Traits/SizingUtilities.php: -------------------------------------------------------------------------------- 1 | class('w-' . $w); 10 | } 11 | 12 | public function wAuto() 13 | { 14 | return $this->class('w-auto'); 15 | } 16 | 17 | public function h($h) 18 | { 19 | return $this->class('h-' . $h); 20 | } 21 | 22 | public function hAuto() 23 | { 24 | return $this->class('h-auto'); 25 | } 26 | 27 | public function mwFull() 28 | { 29 | return $this->class('mw-100'); 30 | } 31 | 32 | public function mhFull() 33 | { 34 | return $this->class('mh-100'); 35 | } 36 | 37 | public function minVwFull() 38 | { 39 | return $this->class('min-vw-100'); 40 | } 41 | 42 | public function minVhFull() 43 | { 44 | return $this->class('min-vh-100'); 45 | } 46 | 47 | public function vwFull() 48 | { 49 | return $this->class('vw-100'); 50 | } 51 | 52 | public function vhFull() 53 | { 54 | return $this->class('vh-100'); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Components/LinkComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | $this->attr('href', '#'); 15 | } 16 | 17 | public function href($href) 18 | { 19 | return $this->attr('href', $href); 20 | } 21 | 22 | public function target($target) 23 | { 24 | return $this->attr('target', $target); 25 | } 26 | 27 | public function active($active = true) 28 | { 29 | return $active ? $this->class('active') : $this; 30 | } 31 | 32 | public function disabled($disabled = true) 33 | { 34 | return $disabled ? $this->class('disabled') : $this; 35 | } 36 | 37 | public function collapseToggle($class) 38 | { 39 | $this->attr('href', '.' . $class); 40 | $this->attr('data-toggle', 'collapse'); 41 | 42 | return $this; 43 | } 44 | 45 | public function stretched() 46 | { 47 | return $this->class('stretched-link'); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Traits/BackgroundUtilities.php: -------------------------------------------------------------------------------- 1 | class('bg-primary'); 10 | } 11 | 12 | public function bgSecondary() 13 | { 14 | return $this->class('bg-secondary'); 15 | } 16 | 17 | public function bgSuccess() 18 | { 19 | return $this->class('bg-success'); 20 | } 21 | 22 | public function bgInfo() 23 | { 24 | return $this->class('bg-info'); 25 | } 26 | 27 | public function bgDanger() 28 | { 29 | return $this->class('bg-danger'); 30 | } 31 | 32 | public function bgWarning() 33 | { 34 | return $this->class('bg-warning'); 35 | } 36 | 37 | public function bgLight() 38 | { 39 | return $this->class('bg-light'); 40 | } 41 | 42 | public function bgDark() 43 | { 44 | return $this->class('bg-dark'); 45 | } 46 | 47 | public function bgWhite() 48 | { 49 | return $this->class('bg-white'); 50 | } 51 | 52 | public function bgTransparent() 53 | { 54 | return $this->class('bg-transparent'); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /resources/stubs/install/app/Models/User.php.stub: -------------------------------------------------------------------------------- 1 | 'datetime']; 18 | 19 | public function migration(Blueprint $table) 20 | { 21 | $table->id(); 22 | $table->string('name'); 23 | $table->string('email')->unique(); 24 | $table->string('password'); 25 | $table->rememberToken(); 26 | $table->timestamp('created_at')->nullable(); 27 | $table->timestamp('updated_at')->nullable(); 28 | } 29 | 30 | public function definition(Generator $faker) 31 | { 32 | return [ 33 | 'name' => $faker->name, 34 | 'email' => $faker->unique()->safeEmail, 35 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 36 | 'remember_token' => Str::random(10), 37 | ]; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Components/BadgeComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | 16 | public function primary() 17 | { 18 | return $this->class('badge-primary'); 19 | } 20 | 21 | public function secondary() 22 | { 23 | return $this->class('badge-secondary'); 24 | } 25 | 26 | public function success() 27 | { 28 | return $this->class('badge-success'); 29 | } 30 | 31 | public function info() 32 | { 33 | return $this->class('badge-info'); 34 | } 35 | 36 | public function danger() 37 | { 38 | return $this->class('badge-danger'); 39 | } 40 | 41 | public function warning() 42 | { 43 | return $this->class('badge-warning'); 44 | } 45 | 46 | public function light() 47 | { 48 | return $this->class('badge-light'); 49 | } 50 | 51 | public function dark() 52 | { 53 | return $this->class('badge-dark'); 54 | } 55 | 56 | public function pill() 57 | { 58 | return $this->class('badge-pill'); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/Components/ModalComponent.php: -------------------------------------------------------------------------------- 1 | id = $id; 18 | } 19 | 20 | public function heading(...$content) 21 | { 22 | $this->heading = implode(PHP_EOL, func_get_args()); 23 | 24 | return $this; 25 | } 26 | 27 | public function body(...$content) 28 | { 29 | $this->body = implode(PHP_EOL, func_get_args()); 30 | 31 | return $this; 32 | } 33 | 34 | public function footer(...$content) 35 | { 36 | $this->footer = implode(PHP_EOL, func_get_args()); 37 | 38 | return $this; 39 | } 40 | 41 | public function fade() 42 | { 43 | $this->fade = true; 44 | 45 | return $this; 46 | } 47 | 48 | public function sm() 49 | { 50 | return $this->class('modal-sm'); 51 | } 52 | 53 | public function lg() 54 | { 55 | return $this->class('modal-lg'); 56 | } 57 | 58 | public function xl() 59 | { 60 | return $this->class('modal-xl'); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Components/RadioComponent.php: -------------------------------------------------------------------------------- 1 | name = $name; 23 | } 24 | 25 | public function options($options) 26 | { 27 | $this->options = Arr::isAssoc($options) ? $options : array_combine($options, $options); 28 | 29 | return $this; 30 | } 31 | 32 | public function label(...$content) 33 | { 34 | $this->label = implode(PHP_EOL, func_get_args()); 35 | 36 | return $this; 37 | } 38 | 39 | public function help(...$content) 40 | { 41 | $this->help = implode(PHP_EOL, func_get_args()); 42 | 43 | return $this; 44 | } 45 | 46 | public function inline() 47 | { 48 | $this->inline = true; 49 | 50 | return $this; 51 | } 52 | 53 | public function disabled($disabled = true) 54 | { 55 | return $disabled ? $this->attr('disabled', '') : $this; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /resources/stubs/install/app/Http/Livewire/Welcome.php.stub: -------------------------------------------------------------------------------- 1 | mb(3), 19 | S::paragraph('Welcome to your Swift app!')->lead(), 20 | 21 | S::if(auth()->guest(), function () { 22 | return S::list( 23 | S::listItem(S::link('Login')->href(route('login')))->inline(), 24 | S::if(Route::has('register'), function () { 25 | return S::listItem(S::link('Register')->href(route('register')))->inline(); 26 | }) 27 | )->inline(); 28 | })->else(function () { 29 | return S::list( 30 | S::listItem(S::link('Home')->href(route('home')))->inline(), 31 | )->inline(); 32 | }) 33 | )->auto())->alignItemsCenter()->justifyContentCenter()->textCenter()->minVhFull()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /resources/stubs/install/package.json.stub: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "npm run development", 5 | "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", 6 | "watch": "npm run development -- --watch", 7 | "watch-poll": "npm run watch -- --watch-poll", 8 | "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js", 9 | "prod": "npm run production", 10 | "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" 11 | }, 12 | "devDependencies": { 13 | "@fortawesome/fontawesome-free": "^5.15.1", 14 | "axios": "^0.19", 15 | "bootstrap": "^4.0.0", 16 | "bs4-toast": "^1.1.0", 17 | "cross-env": "^7.0", 18 | "jquery": "^3.2", 19 | "laravel-mix": "^5.0.7", 20 | "lodash": "^4.17.19", 21 | "popper.js": "^1.12", 22 | "resolve-url-loader": "^3.1.0", 23 | "sass": "^1.15.2", 24 | "sass-loader": "^8.0.0", 25 | "vue-template-compiler": "^2.6.12" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /resources/stubs/install/app/Http/Livewire/Users/Read.php.stub: -------------------------------------------------------------------------------- 1 | fade() 18 | ->heading('User') 19 | ->body( 20 | S::each($this->user ? $this->user->toArray() : [], function ($value, $key) { 21 | return S::div( 22 | S::label(Str::title(str_replace('_', ' ', Str::snake($key))))->textMuted(), 23 | 24 | is_array($value) ? 25 | S::pre(json_encode($value, JSON_PRETTY_PRINT)) : 26 | S::paragraph($value ?? 'N/A') 27 | ); 28 | }) 29 | ) 30 | ->footer( 31 | S::button('Close')->secondary()->click('$emit', 'hideModal', 'read-user-modal') 32 | ); 33 | } 34 | 35 | public function showReadUserModal(User $user) 36 | { 37 | $this->user = $user; 38 | $this->emit('showModal', 'read-user-modal'); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /resources/stubs/crudtrait/app/Http/Livewire/DummyModels/Create.php.stub: -------------------------------------------------------------------------------- 1 | fade() 19 | ->heading('Create DummyTitle') 20 | ->body($this->formFields()) 21 | ->footer( 22 | S::button('Cancel')->secondary()->click('$emit', 'hideModal', 'create-dummy-route-modal'), 23 | S::button('Save')->submit()->primary() 24 | ) 25 | )->submitPrevent('save'); 26 | } 27 | 28 | public function showCreateDummyModelModal() 29 | { 30 | $this->reset('model'); 31 | $this->emit('showModal', 'create-dummy-route-modal'); 32 | } 33 | 34 | public function save() 35 | { 36 | $validatedData = $this->validate(); 37 | 38 | DummyModel::query()->create($validatedData); 39 | 40 | $this->emit('hideModal', 'create-dummy-route-modal'); 41 | $this->emit('toastSuccess', 'DummyTitle created!'); 42 | $this->emit('$refresh'); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Components/CheckboxComponent.php: -------------------------------------------------------------------------------- 1 | name = $name; 23 | } 24 | 25 | public function label(...$content) 26 | { 27 | $this->label = implode(PHP_EOL, func_get_args()); 28 | 29 | return $this; 30 | } 31 | 32 | public function checkboxLabel(...$content) 33 | { 34 | $this->checkboxLabel = implode(PHP_EOL, func_get_args()); 35 | 36 | return $this; 37 | } 38 | 39 | public function help(...$content) 40 | { 41 | $this->help = implode(PHP_EOL, func_get_args()); 42 | 43 | return $this; 44 | } 45 | 46 | public function switch() 47 | { 48 | $this->type = 'switch'; 49 | 50 | return $this; 51 | } 52 | 53 | public function inline() 54 | { 55 | $this->inline = true; 56 | 57 | return $this; 58 | } 59 | 60 | public function disabled($disabled = true) 61 | { 62 | return $disabled ? $this->attr('disabled', '') : $this; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/Components/AlertComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 15 | } 16 | 17 | public function dismissable() 18 | { 19 | $this->dismissable = true; 20 | 21 | return $this; 22 | } 23 | 24 | public function fade() 25 | { 26 | return $this->class('fade show'); 27 | } 28 | 29 | public function primary() 30 | { 31 | return $this->class('alert-primary'); 32 | } 33 | 34 | public function secondary() 35 | { 36 | return $this->class('alert-secondary'); 37 | } 38 | 39 | public function success() 40 | { 41 | return $this->class('alert-success'); 42 | } 43 | 44 | public function info() 45 | { 46 | return $this->class('alert-info'); 47 | } 48 | 49 | public function danger() 50 | { 51 | return $this->class('alert-danger'); 52 | } 53 | 54 | public function warning() 55 | { 56 | return $this->class('alert-warning'); 57 | } 58 | 59 | public function light() 60 | { 61 | return $this->class('alert-light'); 62 | } 63 | 64 | public function dark() 65 | { 66 | return $this->class('alert-dark'); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /resources/stubs/crud/app/Http/Livewire/DummyModels/Read.php.stub: -------------------------------------------------------------------------------- 1 | fade() 18 | ->heading('DummyTitle') 19 | ->body( 20 | S::each($this->dummyVariable ? $this->dummyVariable->toArray() : [], function ($value, $key) { 21 | return S::div( 22 | S::label(Str::title(str_replace('_', ' ', Str::snake($key))))->textMuted(), 23 | 24 | is_array($value) ? 25 | S::pre(json_encode($value, JSON_PRETTY_PRINT)) : 26 | S::paragraph($value ?? 'N/A') 27 | ); 28 | }) 29 | ) 30 | ->footer( 31 | S::button('Close')->secondary()->click('$emit', 'hideModal', 'read-dummy-route-modal') 32 | ); 33 | } 34 | 35 | public function showReadDummyModelModal(DummyModel $dummyVariable) 36 | { 37 | $this->dummyVariable = $dummyVariable; 38 | $this->emit('showModal', 'read-dummy-route-modal'); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /resources/stubs/crudtrait/app/Http/Livewire/DummyModels/Read.php.stub: -------------------------------------------------------------------------------- 1 | fade() 18 | ->heading('DummyTitle') 19 | ->body( 20 | S::each($this->dummyVariable ? $this->dummyVariable->toArray() : [], function ($value, $key) { 21 | return S::div( 22 | S::label(Str::title(str_replace('_', ' ', Str::snake($key))))->textMuted(), 23 | 24 | is_array($value) ? 25 | S::pre(json_encode($value, JSON_PRETTY_PRINT)) : 26 | S::paragraph($value ?? 'N/A') 27 | ); 28 | }) 29 | ) 30 | ->footer( 31 | S::button('Close')->secondary()->click('$emit', 'hideModal', 'read-dummy-route-modal') 32 | ); 33 | } 34 | 35 | public function showReadDummyModelModal(DummyModel $dummyVariable) 36 | { 37 | $this->dummyVariable = $dummyVariable; 38 | $this->emit('showModal', 'read-dummy-route-modal'); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Livewire/ThrottlesAttempts.php: -------------------------------------------------------------------------------- 1 | rateLimiter()->tooManyAttempts($this->throttleKey(), $this->throttleAttempts(), $this->throttleDecayMinutes()); 13 | } 14 | 15 | protected function incrementAttempts() 16 | { 17 | $this->rateLimiter()->hit($this->throttleKey()); 18 | } 19 | 20 | protected function clearAttempts() 21 | { 22 | $this->rateLimiter()->clear($this->throttleKey()); 23 | } 24 | 25 | protected function availableInSeconds() 26 | { 27 | return $this->rateLimiter()->availableIn($this->throttleKey()); 28 | } 29 | 30 | protected function throttlePrefix() 31 | { 32 | return $this->model['email']; 33 | } 34 | 35 | protected function throttleKey() 36 | { 37 | return $this->throttlePrefix() . '|' . request()->ip(); 38 | } 39 | 40 | public function throttleAttempts() 41 | { 42 | return property_exists($this, 'throttleAttempts') ? $this->throttleAttempts : 5; 43 | } 44 | 45 | public function throttleDecayMinutes() 46 | { 47 | return property_exists($this, 'throttleDecayMinutes') ? $this->throttleDecayMinutes : 1; 48 | } 49 | 50 | protected function rateLimiter() 51 | { 52 | return app(RateLimiter::class); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /resources/views/components/file.blade.php: -------------------------------------------------------------------------------- 1 | @if($label) 2 |
    3 | 4 | @endif 5 | 6 |
    7 | merge([ 8 | 'id' => $id = $attributes->get('id', $name . '-' . uniqid()), 9 | 'class' => 'custom-file-input' . ($errors->has($name) ? ' is-invalid' : '') 10 | ]) }}> 11 | 12 | 28 | 29 | @error($name) {{ $message }} @enderror 30 |
    31 | 32 | @if($help) 33 | {!! $help !!} 34 | @endif 35 | 36 | @if($label) 37 |
    38 | @endif 39 | -------------------------------------------------------------------------------- /src/Commands/MakeCrudCommand.php: -------------------------------------------------------------------------------- 1 | argument = $this->argument('model'); 17 | $this->stubDir = __DIR__ . '/../../resources/stubs/crud'; 18 | 19 | $this->createFiles(); 20 | 21 | $navbar = 'app/Http/Livewire/Layouts/Navbar.php'; 22 | 23 | if ($this->filesystem->exists($navbar)) { 24 | $navbarContents = $this->filesystem->get($navbar); 25 | $navItem = "S::navItem(S::navLink('" . $this->replaces['DummyTitles'] . "')->href(route('" . $this->replaces['dummy-routes'] . "'))),"; 26 | 27 | if (!Str::contains($navbarContents, $navItem)) { 28 | $hook = '// crud command hook'; 29 | preg_match('/(.*)' . str_replace('/', '\/', $hook) . '/', $navbarContents, $indent); 30 | 31 | $this->filesystem->put($navbar, str_replace($hook, $navItem . PHP_EOL . $indent[1] . $hook, $this->filesystem->get($navbar))); 32 | $this->info('Nav item inserted: ' . $navbar); 33 | } 34 | } 35 | 36 | $this->info($this->argument . ' CRUD generated!'); 37 | $this->warn("Don't forget to update the new model migration and run the migrate:auto command."); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /resources/stubs/crudtrait/app/Http/Livewire/DummyModels/Update.php.stub: -------------------------------------------------------------------------------- 1 | fade() 19 | ->heading('Update DummyTitle') 20 | ->body($this->formFields()) 21 | ->footer( 22 | S::button('Cancel')->secondary()->click('$emit', 'hideModal', 'update-dummy-route-modal'), 23 | S::button('Save')->submit()->primary() 24 | ) 25 | )->submitPrevent('save'); 26 | } 27 | 28 | public function showUpdateDummyModelModal(DummyModel $dummyVariable) 29 | { 30 | $this->dummyVariable = $dummyVariable; 31 | $this->model = $dummyVariable->toArray(); 32 | $this->emit('showModal', 'update-dummy-route-modal'); 33 | } 34 | 35 | public function save() 36 | { 37 | $validatedData = $this->validate(); 38 | 39 | $this->dummyVariable->update($validatedData); 40 | 41 | $this->emit('hideModal', 'update-dummy-route-modal'); 42 | $this->emit('toastSuccess', 'DummyTitle updated!'); 43 | $this->emit('$refresh'); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /resources/stubs/crud/app/Http/Livewire/DummyModels/Create.php.stub: -------------------------------------------------------------------------------- 1 | fade() 17 | ->heading('Create DummyTitle') 18 | ->body( 19 | S::input('name')->label('Name')->modelDefer(), 20 | ) 21 | ->footer( 22 | S::button('Cancel')->secondary()->click('$emit', 'hideModal', 'create-dummy-route-modal'), 23 | S::button('Save')->submit()->primary() 24 | ) 25 | )->submitPrevent('save'); 26 | } 27 | 28 | public function showCreateDummyModelModal() 29 | { 30 | $this->reset('model'); 31 | $this->emit('showModal', 'create-dummy-route-modal'); 32 | } 33 | 34 | public function save() 35 | { 36 | $validatedData = $this->validate([ 37 | 'name' => ['required'], 38 | ]); 39 | 40 | DummyModel::query()->create($validatedData); 41 | 42 | $this->emit('hideModal', 'create-dummy-route-modal'); 43 | $this->emit('toastSuccess', 'DummyTitle created!'); 44 | $this->emit('$refresh'); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Traits/ClickUtilities.php: -------------------------------------------------------------------------------- 1 | attr($attr, $value); 21 | $this->class('cursor-pointer'); 22 | 23 | return $this; 24 | } 25 | 26 | public function click($action, ...$params) 27 | { 28 | return $this->clickHandler('wire:click', $action, ...$params); 29 | } 30 | 31 | public function clickPrevent($action, ...$params) 32 | { 33 | return $this->clickHandler('wire:click.prevent', $action, ...$params); 34 | } 35 | 36 | public function clickStop($action, ...$params) 37 | { 38 | return $this->clickHandler('wire:click.stop', $action, ...$params); 39 | } 40 | 41 | public function clickSelf($action, ...$params) 42 | { 43 | return $this->clickHandler('wire:click.self', $action, ...$params); 44 | } 45 | 46 | public function confirm($message = null) 47 | { 48 | $message = $message ?? trans('swift::swift.default_confirm_message'); 49 | 50 | return $this->attr('onclick', "confirm('$message') || event.stopImmediatePropagation()"); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Commands/MakeCrudTraitCommand.php: -------------------------------------------------------------------------------- 1 | argument = $this->argument('model'); 17 | $this->stubDir = __DIR__ . '/../../resources/stubs/crudtrait'; 18 | 19 | $this->createFiles(); 20 | 21 | $navbar = 'app/Http/Livewire/Layouts/Navbar.php'; 22 | 23 | if ($this->filesystem->exists($navbar)) { 24 | $navbarContents = $this->filesystem->get($navbar); 25 | $navItem = "S::navItem(S::navLink('" . $this->replaces['DummyTitles'] . "')->href(route('" . $this->replaces['dummy-routes'] . "'))),"; 26 | 27 | if (!Str::contains($navbarContents, $navItem)) { 28 | $hook = '// crud command hook'; 29 | preg_match('/(.*)' . str_replace('/', '\/', $hook) . '/', $navbarContents, $indent); 30 | 31 | $this->filesystem->put($navbar, str_replace($hook, $navItem . PHP_EOL . $indent[1] . $hook, $this->filesystem->get($navbar))); 32 | $this->info('Nav item inserted: ' . $navbar); 33 | } 34 | } 35 | 36 | $this->info($this->argument . ' CRUD + Trait generated!'); 37 | $this->warn("Don't forget to update the new model migration and run the migrate:auto command."); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Components/SelectComponent.php: -------------------------------------------------------------------------------- 1 | name = $name; 23 | } 24 | 25 | public function options($options) 26 | { 27 | $this->options = Arr::isAssoc($options) ? $options : array_combine($options, $options); 28 | 29 | return $this; 30 | } 31 | 32 | public function label(...$content) 33 | { 34 | $this->label = implode(PHP_EOL, func_get_args()); 35 | 36 | return $this; 37 | } 38 | 39 | public function placeholder($placeholder) 40 | { 41 | $this->placeholder = $placeholder; 42 | 43 | return $this; 44 | } 45 | 46 | public function help(...$content) 47 | { 48 | $this->help = implode(PHP_EOL, func_get_args()); 49 | 50 | return $this; 51 | } 52 | 53 | public function sm() 54 | { 55 | return $this->class('custom-select-sm'); 56 | } 57 | 58 | public function lg() 59 | { 60 | return $this->class('custom-select-lg'); 61 | } 62 | 63 | public function disabled($disabled = true) 64 | { 65 | return $disabled ? $this->attr('disabled', '') : $this; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /resources/stubs/crud/app/Http/Livewire/DummyModels/Update.php.stub: -------------------------------------------------------------------------------- 1 | fade() 18 | ->heading('Update DummyTitle') 19 | ->body( 20 | S::input('name')->label('Name')->modelDefer(), 21 | ) 22 | ->footer( 23 | S::button('Cancel')->secondary()->click('$emit', 'hideModal', 'update-dummy-route-modal'), 24 | S::button('Save')->submit()->primary() 25 | ) 26 | )->submitPrevent('save'); 27 | } 28 | 29 | public function showUpdateDummyModelModal(DummyModel $dummyVariable) 30 | { 31 | $this->dummyVariable = $dummyVariable; 32 | $this->model = $dummyVariable->toArray(); 33 | $this->emit('showModal', 'update-dummy-route-modal'); 34 | } 35 | 36 | public function save() 37 | { 38 | $validatedData = $this->validate([ 39 | 'name' => ['required'], 40 | ]); 41 | 42 | $this->dummyVariable->update($validatedData); 43 | 44 | $this->emit('hideModal', 'update-dummy-route-modal'); 45 | $this->emit('toastSuccess', 'DummyTitle updated!'); 46 | $this->emit('$refresh'); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Components/ListGroupItemComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | 16 | public function primary() 17 | { 18 | return $this->class('list-group-item-primary'); 19 | } 20 | 21 | public function secondary() 22 | { 23 | return $this->class('list-group-item-secondary'); 24 | } 25 | 26 | public function success() 27 | { 28 | return $this->class('list-group-item-success'); 29 | } 30 | 31 | public function info() 32 | { 33 | return $this->class('list-group-item-info'); 34 | } 35 | 36 | public function danger() 37 | { 38 | return $this->class('list-group-item-danger'); 39 | } 40 | 41 | public function warning() 42 | { 43 | return $this->class('list-group-item-warning'); 44 | } 45 | 46 | public function light() 47 | { 48 | return $this->class('list-group-item-light'); 49 | } 50 | 51 | public function dark() 52 | { 53 | return $this->class('list-group-item-dark'); 54 | } 55 | 56 | public function action() 57 | { 58 | return $this->class('list-group-item-action'); 59 | } 60 | 61 | public function active($active = true) 62 | { 63 | return $active ? $this->class('active') : $this; 64 | } 65 | 66 | public function disabled($disabled = true) 67 | { 68 | return $disabled ? $this->class('disabled') : $this; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/Livewire/SwiftComponent.php: -------------------------------------------------------------------------------- 1 | layout('swift::layouts.app'); 24 | } 25 | 26 | public function validate($rules = null, $messages = [], $attributes = []) 27 | { 28 | [$rules, $messages, $attributes] = $this->providedOrGlobalRulesMessagesAndAttributes($rules, $messages, $attributes); 29 | $validator = Validator::make($this->model, $rules, $messages, $attributes); 30 | 31 | if (config('swift.toast_validation_error') && $validator->fails()) { 32 | $this->emit('toastError', trans('swift::swift.validation_error_message')); 33 | } 34 | 35 | $validatedData = $validator->validate(); 36 | $this->resetErrorBag(); 37 | 38 | return $validatedData; 39 | } 40 | 41 | public function updatedModelSearch() 42 | { 43 | $this->resetPage(); 44 | } 45 | 46 | public function addModelArrayItem($name) 47 | { 48 | $this->model[$name][] = []; 49 | } 50 | 51 | public function removeModelArrayItem($name, $key) 52 | { 53 | unset($this->model[$name][$key]); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/Components/IconComponent.php: -------------------------------------------------------------------------------- 1 | name = $name; 15 | $this->{config('swift.default_icon_style')}(); 16 | } 17 | 18 | public function solid() 19 | { 20 | $this->style = 's'; 21 | 22 | return $this; 23 | } 24 | 25 | public function regular() 26 | { 27 | $this->style = 'r'; 28 | 29 | return $this; 30 | } 31 | 32 | public function light() 33 | { 34 | $this->style = 'l'; 35 | 36 | return $this; 37 | } 38 | 39 | public function duotone() 40 | { 41 | $this->style = 'd'; 42 | 43 | return $this; 44 | } 45 | 46 | public function brand() 47 | { 48 | $this->style = 'b'; 49 | 50 | return $this; 51 | } 52 | 53 | public function fw() 54 | { 55 | return $this->class('fa-fw'); 56 | } 57 | 58 | public function xs() 59 | { 60 | return $this->class('fa-xs'); 61 | } 62 | 63 | public function sm() 64 | { 65 | return $this->class('fa-sm'); 66 | } 67 | 68 | public function lg() 69 | { 70 | return $this->class('fa-lg'); 71 | } 72 | 73 | public function x($x) 74 | { 75 | return $this->class('fa-' . $x . 'x'); 76 | } 77 | 78 | public function spin() 79 | { 80 | return $this->class('fa-spin'); 81 | } 82 | 83 | public function pulse() 84 | { 85 | return $this->class('fa-pulse'); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/Components/InputComponent.php: -------------------------------------------------------------------------------- 1 | name = $name; 20 | $this->attr('type', 'text'); 21 | } 22 | 23 | public function type($type) 24 | { 25 | return $this->attr('type', $type); 26 | } 27 | 28 | public function label(...$content) 29 | { 30 | $this->label = implode(PHP_EOL, func_get_args()); 31 | 32 | return $this; 33 | } 34 | 35 | public function help(...$content) 36 | { 37 | $this->help = implode(PHP_EOL, func_get_args()); 38 | 39 | return $this; 40 | } 41 | 42 | public function placeholder($placeholder) 43 | { 44 | return $this->attr('placeholder', $placeholder); 45 | } 46 | 47 | public function sm() 48 | { 49 | return $this->class('form-control-sm'); 50 | } 51 | 52 | public function lg() 53 | { 54 | return $this->class('form-control-lg'); 55 | } 56 | 57 | public function disabled($disabled = true) 58 | { 59 | return $disabled ? $this->attr('disabled', '') : $this; 60 | } 61 | 62 | public function readonly($readonly = true) 63 | { 64 | return $readonly ? $this->attr('readonly', '') : $this; 65 | } 66 | 67 | public function keydown($key, $action) 68 | { 69 | $this->class('cursor-pointer'); 70 | $this->attr('wire:keydown.' . $key, $action); 71 | 72 | return $this; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/Components/DropdownComponent.php: -------------------------------------------------------------------------------- 1 | toggle = implode(PHP_EOL, func_get_args()); 18 | 19 | return $this; 20 | } 21 | 22 | public function items(...$content) 23 | { 24 | $this->items = implode(PHP_EOL, func_get_args()); 25 | 26 | return $this; 27 | } 28 | 29 | public function right() 30 | { 31 | return $this->class('dropdown-menu-right'); 32 | } 33 | 34 | public function smRight() 35 | { 36 | return $this->class('dropdown-menu-sm-right'); 37 | } 38 | 39 | public function mdRight() 40 | { 41 | return $this->class('dropdown-menu-md-right'); 42 | } 43 | 44 | public function lgRight() 45 | { 46 | return $this->class('dropdown-menu-lg-right'); 47 | } 48 | 49 | public function xlRight() 50 | { 51 | return $this->class('dropdown-menu-xl-right'); 52 | } 53 | 54 | public function left() 55 | { 56 | return $this->class('dropdown-menu-left'); 57 | } 58 | 59 | public function smLeft() 60 | { 61 | return $this->class('dropdown-menu-sm-left'); 62 | } 63 | 64 | public function mdLeft() 65 | { 66 | return $this->class('dropdown-menu-md-left'); 67 | } 68 | 69 | public function lgLeft() 70 | { 71 | return $this->class('dropdown-menu-lg-left'); 72 | } 73 | 74 | public function xlLeft() 75 | { 76 | return $this->class('dropdown-menu-xl-left'); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/Traits/FloatUtilities.php: -------------------------------------------------------------------------------- 1 | class('float-left'); 10 | } 11 | 12 | public function floatSmLeft() 13 | { 14 | return $this->class('float-sm-left'); 15 | } 16 | 17 | public function floatMdLeft() 18 | { 19 | return $this->class('float-md-left'); 20 | } 21 | 22 | public function floatLgtLeft() 23 | { 24 | return $this->class('float-lg-left'); 25 | } 26 | 27 | public function floatXlLeft() 28 | { 29 | return $this->class('float-xl-left'); 30 | } 31 | 32 | public function floatRight() 33 | { 34 | return $this->class('float-right'); 35 | } 36 | 37 | public function floatSmRight() 38 | { 39 | return $this->class('float-sm-right'); 40 | } 41 | 42 | public function floatMdRight() 43 | { 44 | return $this->class('float-md-right'); 45 | } 46 | 47 | public function floatLgtRight() 48 | { 49 | return $this->class('float-lg-right'); 50 | } 51 | 52 | public function floatXlRight() 53 | { 54 | return $this->class('float-xl-right'); 55 | } 56 | 57 | public function floatNone() 58 | { 59 | return $this->class('float-none'); 60 | } 61 | 62 | public function floatSmNone() 63 | { 64 | return $this->class('float-sm-none'); 65 | } 66 | 67 | public function floatMdNone() 68 | { 69 | return $this->class('float-md-none'); 70 | } 71 | 72 | public function floatLgtNone() 73 | { 74 | return $this->class('float-lg-none'); 75 | } 76 | 77 | public function floatXlNone() 78 | { 79 | return $this->class('float-xl-none'); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/Providers/SwiftServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->runningInConsole()) { 20 | $this->commands([ 21 | InstallPasswordForgot::class, 22 | InstallSwiftCommand::class, 23 | MakeCrudCommand::class, 24 | MakeCrudTraitCommand::class, 25 | MakePageCommand::class, 26 | MakeSwiftCommand::class, 27 | MakeSwiftModelCommand::class, 28 | MigrateAutoCommand::class, 29 | ]); 30 | } 31 | 32 | $this->publishes([__DIR__ . '/../../config/swift.php' => config_path('swift.php')]); 33 | 34 | $this->loadViewsFrom(__DIR__ . '/../../resources/views', 'swift'); 35 | $this->publishes([__DIR__ . '/../../resources/views' => resource_path('views/vendor/swift')]); 36 | 37 | $this->loadTranslationsFrom(__DIR__ . '/../../resources/lang', 'swift'); 38 | $this->publishes([__DIR__ . '/../../resources/lang' => resource_path('lang/vendor/swift')]); 39 | 40 | $this->loadRoutesFrom(__DIR__ . '/../../routes/web.php'); 41 | } 42 | 43 | public function register() 44 | { 45 | $this->mergeConfigFrom(__DIR__ . '/../../config/swift.php', 'swift'); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /resources/stubs/install/app/Http/Livewire/Auth/PasswordForgot.php.stub: -------------------------------------------------------------------------------- 1 | header($this->pageTitle) 25 | ->body( 26 | S::if($this->status == Password::RESET_LINK_SENT, function () { 27 | return S::paragraph(trans($this->status))->mb(0); 28 | })->else(function () { 29 | return S::form( 30 | S::input('email')->type('email')->label('Email')->modelDefer(), 31 | S::button('Send Password Reset Link')->submit()->primary()->block() 32 | )->submitPrevent('sendResetLink'); 33 | }) 34 | ) 35 | )->md(5))->justifyContentCenter())->py(4) 36 | ); 37 | } 38 | 39 | public function sendResetLink() 40 | { 41 | $validatedData = $this->validate([ 42 | 'email' => ['required', 'email'], 43 | ]); 44 | 45 | $this->status = Password::sendResetLink($validatedData); 46 | 47 | if ($this->status != Password::RESET_LINK_SENT) { 48 | $this->addError('email', trans($this->status)); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /resources/stubs/password-forgot/app/Http/Livewire/Auth/PasswordForgot.php.stub: -------------------------------------------------------------------------------- 1 | header($this->pageTitle) 25 | ->body( 26 | S::if($this->status == Password::RESET_LINK_SENT, function () { 27 | return S::paragraph(trans($this->status))->mb(0); 28 | })->else(function () { 29 | return S::form( 30 | S::input('email')->type('email')->label('Email')->modelDefer(), 31 | S::button('Send Password Reset Link')->submit()->primary()->block() 32 | )->submitPrevent('sendResetLink'); 33 | }) 34 | ) 35 | )->md(5))->justifyContentCenter())->py(4) 36 | ); 37 | } 38 | 39 | public function sendResetLink() 40 | { 41 | $validatedData = $this->validate([ 42 | 'email' => ['required', 'email'], 43 | ]); 44 | 45 | $this->status = Password::sendResetLink($validatedData); 46 | 47 | if ($this->status != Password::RESET_LINK_SENT) { 48 | $this->addError('email', trans($this->status)); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /resources/stubs/install/app/Http/Livewire/Auth/Profile.php.stub: -------------------------------------------------------------------------------- 1 | model = auth()->user()->toArray(); 14 | } 15 | 16 | public function view() 17 | { 18 | return S::form( 19 | S::modal('profile-modal')->fade() 20 | ->heading('Profile') 21 | ->body( 22 | S::input('name')->label('Name')->modelDefer(), 23 | S::input('email')->type('email')->label('Email')->modelDefer(), 24 | S::input('password')->type('password')->label('Password')->modelDefer(), 25 | S::input('password_confirmation')->type('password')->label('Confirm Password')->modelDefer(), 26 | ) 27 | ->footer( 28 | S::button('Cancel')->secondary()->click('$emit', 'hideModal', 'profile-modal'), 29 | S::button('Save')->submit()->primary() 30 | ) 31 | )->submitPrevent('save'); 32 | } 33 | 34 | public function save() 35 | { 36 | $validatedData = $this->validate([ 37 | 'name' => ['required'], 38 | 'email' => ['required', 'email', Rule::unique('users')->ignore(auth()->user())], 39 | 'password' => ['nullable', 'confirmed'], 40 | ]); 41 | 42 | if (!empty($validatedData['password'])) { 43 | $validatedData['password'] = bcrypt($validatedData['password']); 44 | } 45 | 46 | auth()->user()->update($validatedData); 47 | 48 | $this->emit('hideModal', 'profile-modal'); 49 | $this->emit('toastSuccess', 'Profile saved!'); 50 | $this->emit('$refresh'); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /resources/stubs/install/app/Http/Livewire/Users/Create.php.stub: -------------------------------------------------------------------------------- 1 | fade() 17 | ->heading('Create User') 18 | ->body( 19 | S::input('name')->label('Name')->modelDefer(), 20 | S::input('email')->type('email')->label('Email')->modelDefer(), 21 | S::input('password')->type('password')->label('Password')->modelDefer(), 22 | S::input('password_confirmation')->type('password')->label('Confirm Password')->modelDefer(), 23 | ) 24 | ->footer( 25 | S::button('Cancel')->secondary()->click('$emit', 'hideModal', 'create-user-modal'), 26 | S::button('Save')->submit()->primary() 27 | ) 28 | )->submitPrevent('save'); 29 | } 30 | 31 | public function showCreateUserModal() 32 | { 33 | $this->reset('model'); 34 | $this->emit('showModal', 'create-user-modal'); 35 | } 36 | 37 | public function save() 38 | { 39 | $validatedData = $this->validate([ 40 | 'name' => ['required'], 41 | 'email' => ['required', 'email', 'unique:users'], 42 | 'password' => ['required', 'confirmed'], 43 | ]); 44 | 45 | $validatedData['password'] = bcrypt($validatedData['password']); 46 | 47 | User::query()->create($validatedData); 48 | 49 | $this->emit('hideModal', 'create-user-modal'); 50 | $this->emit('toastSuccess', 'User created!'); 51 | $this->emit('$refresh'); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /resources/stubs/install/app/Http/Livewire/Auth/Register.php.stub: -------------------------------------------------------------------------------- 1 | header($this->pageTitle) 25 | ->body( 26 | S::form( 27 | S::input('name')->label('Name')->modelDefer(), 28 | S::input('email')->type('email')->label('Email')->modelDefer(), 29 | S::input('password')->type('password')->label('Password')->modelDefer(), 30 | S::input('password_confirmation')->type('password')->label('Confirm Password')->modelDefer(), 31 | S::button('Register')->submit()->primary()->block() 32 | )->submitPrevent('register') 33 | ) 34 | )->md(5))->justifyContentCenter())->py(4) 35 | ); 36 | } 37 | 38 | public function register() 39 | { 40 | $validatedData = $this->validate([ 41 | 'name' => ['required'], 42 | 'email' => ['required', 'email', 'unique:users'], 43 | 'password' => ['required', 'confirmed'], 44 | ]); 45 | 46 | $validatedData['password'] = bcrypt($validatedData['password']); 47 | $user = User::create($validatedData); 48 | 49 | auth()->login($user); 50 | $this->redirect(RouteServiceProvider::HOME); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Components/ColComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | 16 | public function xs($xs = null) 17 | { 18 | return $this->class('col' . ($xs ? '-' . $xs : null)); 19 | } 20 | 21 | public function auto() 22 | { 23 | return $this->class('col-auto'); 24 | } 25 | 26 | public function sm($sm = null) 27 | { 28 | return $this->class('col-sm' . ($sm ? '-' . $sm : null)); 29 | } 30 | 31 | public function smAuto() 32 | { 33 | return $this->class('col-sm-auto'); 34 | } 35 | 36 | public function md($md = null) 37 | { 38 | return $this->class('col-md' . ($md ? '-' . $md : null)); 39 | } 40 | 41 | public function mdAuto() 42 | { 43 | return $this->class('col-md-auto'); 44 | } 45 | 46 | public function lg($lg = null) 47 | { 48 | return $this->class('col-lg' . ($lg ? '-' . $lg : null)); 49 | } 50 | 51 | public function lgAuto() 52 | { 53 | return $this->class('col-lg-auto'); 54 | } 55 | 56 | public function xl($xl = null) 57 | { 58 | return $this->class('col-xl' . ($xl ? '-' . $xl : null)); 59 | } 60 | 61 | public function xlAuto() 62 | { 63 | return $this->class('col-xl-auto'); 64 | } 65 | 66 | public function offset($offset) 67 | { 68 | return $this->class('offset-' . $offset); 69 | } 70 | 71 | public function offsetSm($offsetSm) 72 | { 73 | return $this->class('offset-sm-' . $offsetSm); 74 | } 75 | 76 | public function offsetMd($offsetMd) 77 | { 78 | return $this->class('offset-md-' . $offsetMd); 79 | } 80 | 81 | public function offsetLg($offsetLg) 82 | { 83 | return $this->class('offset-lg-' . $offsetLg); 84 | } 85 | 86 | public function offsetXl($offsetXl) 87 | { 88 | return $this->class('offset-xl-' . $offsetXl); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /resources/stubs/install/app/Http/Livewire/Users/Update.php.stub: -------------------------------------------------------------------------------- 1 | fade() 19 | ->heading('Update User') 20 | ->body( 21 | S::input('name')->label('Name')->modelDefer(), 22 | S::input('email')->type('email')->label('Email')->modelDefer(), 23 | S::input('password')->type('password')->label('Password')->modelDefer(), 24 | S::input('password_confirmation')->type('password')->label('Confirm Password')->modelDefer(), 25 | ) 26 | ->footer( 27 | S::button('Cancel')->secondary()->click('$emit', 'hideModal', 'update-user-modal'), 28 | S::button('Save')->submit()->primary() 29 | ) 30 | )->submitPrevent('save'); 31 | } 32 | 33 | public function showUpdateUserModal(User $user) 34 | { 35 | $this->user = $user; 36 | $this->model = $user->toArray(); 37 | $this->emit('showModal', 'update-user-modal'); 38 | } 39 | 40 | public function save() 41 | { 42 | $validatedData = $this->validate([ 43 | 'name' => ['required'], 44 | 'email' => ['required', 'email', Rule::unique('users')->ignoreModel($this->user)], 45 | 'password' => ['nullable', 'confirmed'], 46 | ]); 47 | 48 | if (!empty($validatedData['password'])) { 49 | $validatedData['password'] = bcrypt($validatedData['password']); 50 | } 51 | 52 | $this->user->update($validatedData); 53 | 54 | $this->emit('hideModal', 'update-user-modal'); 55 | $this->emit('toastSuccess', 'User updated!'); 56 | $this->emit('$refresh'); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/Commands/CreatesFiles.php: -------------------------------------------------------------------------------- 1 | filesystem = new Filesystem; 20 | $title = Str::title(str_replace('_', ' ', Str::snake($this->argument))); 21 | $titles = Str::plural($title); 22 | $this->replaces = [ 23 | 'DummyComponent' => Str::studly($title), 24 | 'DummyModels' => Str::studly($titles), 25 | 'DummyModel' => Str::studly($title), 26 | 'DummyFactory' => Str::studly($title) . 'Factory', 27 | 'DummyTitles' => $titles, 28 | 'DummyTitle' => $title, 29 | 'dummyVariables' => Str::camel($titles), 30 | 'dummyVariable' => Str::camel($title), 31 | 'dummy-routes' => Str::snake($titles, '-'), 32 | 'dummy-route' => Str::snake($title, '-'), 33 | 'Dummy quote.' => Arr::random(require __DIR__ . '/../../../../../vendor/livewire/livewire/src/Commands/the-tao.php'), 34 | ]; 35 | 36 | foreach ($this->filesystem->allFiles($this->stubDir) as $file) { 37 | $dir = $this->targetDir ? $this->targetDir . '/' : null; 38 | $fileDir = $dir . $this->replace($file->getRelativePath()); 39 | $filePath = $dir . $this->replace(Str::replaceLast('.stub', '', $file->getRelativePathname())); 40 | 41 | if ($fileDir) { 42 | $this->filesystem->ensureDirectoryExists($fileDir); 43 | } 44 | 45 | $this->filesystem->put($filePath, $this->replace($file->getContents())); 46 | 47 | $this->info('Created file: ' . $filePath); 48 | } 49 | } 50 | 51 | private function replace($content) 52 | { 53 | foreach ($this->replaces as $search => $replace) { 54 | $content = str_replace($search, $replace, $content); 55 | } 56 | 57 | return $content; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /resources/stubs/install/app/Http/Livewire/Layouts/Navbar.php.stub: -------------------------------------------------------------------------------- 1 | href(route('welcome')), 18 | S::navbarToggler(), 19 | 20 | S::if(auth()->check(), function () { 21 | return S::navbarCollapse( 22 | S::navbarNav( 23 | S::navItem(S::navLink('Home')->href(route('home'))), 24 | S::navItem(S::navLink('Users')->href(route('users'))), 25 | // crud command hook 26 | )->mrAuto(), 27 | S::navbarNav( 28 | S::navDropdown() 29 | ->toggle(S::navLink(S::icon('user-circle'), auth()->user()->name)->dropdownToggle()) 30 | ->items( 31 | S::button('Profile')->dropdownItem()->click('$emit', 'showModal', 'profile-modal'), 32 | S::livewire('auth.logout') 33 | ) 34 | ->right() 35 | )->mlAuto() 36 | ); 37 | })->else(function () { 38 | return S::navbarCollapse( 39 | S::navbarNav( 40 | S::navItem(S::navLink('Login')->href(route('login'))), 41 | S::if(Route::has('register'), function () { 42 | return S::navItem(S::navLink('Register')->href(route('register'))); 43 | }) 44 | )->mlAuto() 45 | ); 46 | }) 47 | ))->expandMd()->light(), 48 | 49 | S::if(auth()->check(), function () { 50 | return S::livewire('auth.profile'); 51 | }) 52 | ); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /resources/stubs/install/app/Http/Livewire/Auth/Login.php.stub: -------------------------------------------------------------------------------- 1 | header($this->pageTitle) 27 | ->body( 28 | S::form( 29 | S::input('email')->type('email')->label('Email')->modelDefer(), 30 | S::input('password')->type('password')->label('Password')->modelDefer(), 31 | S::row( 32 | S::col(S::formGroup(S::checkbox('remember')->modelDefer()))->xs(), 33 | S::col(S::link('Forgot Password?')->href(route('password.forgot')))->auto(), 34 | ), 35 | S::button('Login')->submit()->primary()->block() 36 | )->submitPrevent('login') 37 | ) 38 | )->md(5))->justifyContentCenter())->py(4) 39 | ); 40 | } 41 | 42 | public function login() 43 | { 44 | $validatedData = $this->validate([ 45 | 'email' => ['required', 'email'], 46 | 'password' => ['required'], 47 | ]); 48 | 49 | if ($this->hasTooManyAttempts()) { 50 | $this->addError('email', trans('auth.throttle', ['seconds' => $this->availableInSeconds()])); 51 | return; 52 | } 53 | 54 | if (!auth()->attempt($validatedData, $this->model['remember'] ?? false)) { 55 | $this->incrementAttempts(); 56 | $this->addError('email', trans('auth.failed')); 57 | return; 58 | } 59 | 60 | $this->clearAttempts(); 61 | $this->redirect(RouteServiceProvider::HOME); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /resources/stubs/password-forgot/app/Http/Livewire/Auth/Login.php.stub: -------------------------------------------------------------------------------- 1 | header($this->pageTitle) 27 | ->body( 28 | S::form( 29 | S::input('email')->type('email')->label('Email')->modelDefer(), 30 | S::input('password')->type('password')->label('Password')->modelDefer(), 31 | S::row( 32 | S::col(S::formGroup(S::checkbox('remember')->modelDefer()))->xs(), 33 | S::col(S::link('Forgot Password?')->href(route('password.forgot')))->auto(), 34 | ), 35 | S::button('Login')->submit()->primary()->block() 36 | )->submitPrevent('login') 37 | ) 38 | )->md(5))->justifyContentCenter())->py(4) 39 | ); 40 | } 41 | 42 | public function login() 43 | { 44 | $validatedData = $this->validate([ 45 | 'email' => ['required', 'email'], 46 | 'password' => ['required'], 47 | ]); 48 | 49 | if ($this->hasTooManyAttempts()) { 50 | $this->addError('email', trans('auth.throttle', ['seconds' => $this->availableInSeconds()])); 51 | return; 52 | } 53 | 54 | if (!auth()->attempt($validatedData, $this->model['remember'] ?? false)) { 55 | $this->incrementAttempts(); 56 | $this->addError('email', trans('auth.failed')); 57 | return; 58 | } 59 | 60 | $this->clearAttempts(); 61 | $this->redirect(RouteServiceProvider::HOME); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/Commands/MigrateAutoCommand.php: -------------------------------------------------------------------------------- 1 | option('fresh') ? ':fresh' : '') . ' --force'); 19 | 20 | foreach ((new Filesystem)->allFiles(app_path('Models')) as $file) { 21 | $className = 'App\\Models\\' . str_replace(['/', '.php'], ['\\', ''], $file->getRelativePathname()); 22 | $class = app($className); 23 | 24 | if (method_exists($class, 'migration')) { 25 | if (Schema::hasTable($class->getTable())) { 26 | $tempTable = 'temp_' . $class->getTable(); 27 | 28 | Schema::dropIfExists($tempTable); 29 | Schema::create($tempTable, function (Blueprint $table) use ($class) { 30 | $class->migration($table); 31 | }); 32 | 33 | $schemaManager = $class->getConnection()->getDoctrineSchemaManager(); 34 | $classTableDetails = $schemaManager->listTableDetails($class->getTable()); 35 | $tempTableDetails = $schemaManager->listTableDetails($tempTable); 36 | $tableDiff = (new Comparator)->diffTable($classTableDetails, $tempTableDetails); 37 | 38 | if ($tableDiff) { 39 | $schemaManager->alterTable($tableDiff); 40 | } 41 | 42 | Schema::drop($tempTable); 43 | } 44 | else { 45 | Schema::create($class->getTable(), function (Blueprint $table) use ($class) { 46 | $class->migration($table); 47 | }); 48 | } 49 | } 50 | } 51 | 52 | $this->info('Migration complete!'); 53 | 54 | if ($this->option('seed')) { 55 | Artisan::call('db:seed --force'); 56 | $this->info('Seeding complete!'); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /resources/stubs/install/app/Http/Livewire/Auth/PasswordReset.php.stub: -------------------------------------------------------------------------------- 1 | token = $token; 22 | $this->email = $email; 23 | } 24 | 25 | public function view() 26 | { 27 | return S::div( 28 | S::livewire('layouts.navbar'), 29 | 30 | S::container(S::row(S::col( 31 | S::card() 32 | ->header($this->pageTitle) 33 | ->body( 34 | S::form( 35 | S::input('password')->type('password')->label('Password')->modelDefer(), 36 | S::input('password_confirmation')->type('password')->label('Confirm Password')->modelDefer(), 37 | S::button('Reset Password')->submit()->primary()->block() 38 | )->submitPrevent('resetPassword') 39 | ) 40 | )->md(5))->justifyContentCenter())->py(4) 41 | ); 42 | } 43 | 44 | public function resetPassword() 45 | { 46 | $validatedData = $this->validate([ 47 | 'password' => ['required', 'confirmed'], 48 | ]); 49 | 50 | $status = Password::reset([ 51 | 'token' => $this->token, 52 | 'email' => $this->email, 53 | 'password' => $this->model['password'], 54 | 'password_confirmation' => $this->model['password_confirmation'], 55 | ], function (User $user) { 56 | $user->update(['password' => bcrypt($this->model['password'])]); 57 | auth()->login($user); 58 | }); 59 | 60 | if ($status != Password::PASSWORD_RESET) { 61 | $this->addError('password', trans($status)); 62 | return; 63 | } 64 | 65 | $this->redirect(RouteServiceProvider::HOME); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/Components/BaseComponent.php: -------------------------------------------------------------------------------- 1 | attributes = new ComponentAttributeBag; 39 | } 40 | 41 | public function attr($name, $value) 42 | { 43 | $this->attributes[$name] = $value; 44 | 45 | return $this; 46 | } 47 | 48 | public function class($class) 49 | { 50 | $this->attributes['class'] .= ' ' . $class; 51 | 52 | return $this; 53 | } 54 | 55 | public function id($id) 56 | { 57 | return $this->attr('id', $id); 58 | } 59 | 60 | public function title($title) 61 | { 62 | return $this->attr('title', $title); 63 | } 64 | 65 | public function __toString() 66 | { 67 | $view = Str::snake(Str::replaceLast('Component', '', class_basename($this)), '-'); 68 | 69 | return view('swift::components.' . $view, get_object_vars($this))->render(); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /resources/stubs/password-forgot/app/Http/Livewire/Auth/PasswordReset.php.stub: -------------------------------------------------------------------------------- 1 | token = $token; 22 | $this->email = $email; 23 | } 24 | 25 | public function view() 26 | { 27 | return S::div( 28 | S::livewire('layouts.navbar'), 29 | 30 | S::container(S::row(S::col( 31 | S::card() 32 | ->header($this->pageTitle) 33 | ->body( 34 | S::form( 35 | S::input('password')->type('password')->label('Password')->modelDefer(), 36 | S::input('password_confirmation')->type('password')->label('Confirm Password')->modelDefer(), 37 | S::button('Reset Password')->submit()->primary()->block() 38 | )->submitPrevent('resetPassword') 39 | ) 40 | )->md(5))->justifyContentCenter())->py(4) 41 | ); 42 | } 43 | 44 | public function resetPassword() 45 | { 46 | $validatedData = $this->validate([ 47 | 'password' => ['required', 'confirmed'], 48 | ]); 49 | 50 | $status = Password::reset([ 51 | 'token' => $this->token, 52 | 'email' => $this->email, 53 | 'password' => $this->model['password'], 54 | 'password_confirmation' => $this->model['password_confirmation'], 55 | ], function (User $user) { 56 | $user->update(['password' => bcrypt($this->model['password'])]); 57 | auth()->login($user); 58 | }); 59 | 60 | if ($status != Password::PASSWORD_RESET) { 61 | $this->addError('password', trans($status)); 62 | return; 63 | } 64 | 65 | $this->redirect(RouteServiceProvider::HOME); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /resources/stubs/crud/app/Http/Livewire/DummyModels/Index.php.stub: -------------------------------------------------------------------------------- 1 | model['search'])) { 22 | $query->where('name', 'like', '%' . $this->model['search'] . '%'); 23 | } 24 | 25 | return $query->orderBy('name'); 26 | } 27 | 28 | public function view() 29 | { 30 | $dummyVariables = $this->query()->paginate(); 31 | 32 | return S::div( 33 | S::livewire('layouts.navbar'), 34 | 35 | S::container( 36 | S::heading($this->pageTitle), 37 | 38 | S::row( 39 | S::col(S::input('search')->type('search')->placeholder('Search')->modelDebounce())->mdAuto()->mb(3), 40 | S::col(S::button('Create DummyTitle')->primary()->click('$emit', 'showCreateDummyModelModal'))->mdAuto()->mb(3) 41 | )->justifyContentBetween(), 42 | 43 | S::listGroup( 44 | S::each($dummyVariables, function ($dummyVariable) { 45 | return S::listGroupItem( 46 | S::row( 47 | S::col(e($dummyVariable->name))->md(), 48 | S::col( 49 | S::button(S::icon('eye'))->title('Read')->link()->p(1)->click('$emit', 'showReadDummyModelModal', $dummyVariable->id), 50 | S::button(S::icon('edit'))->title('Update')->link()->p(1)->click('$emit', 'showUpdateDummyModelModal', $dummyVariable->id), 51 | S::button(S::icon('trash-alt'))->title('Delete')->link()->p(1)->click('delete', $dummyVariable->id)->confirm(), 52 | )->mdAuto() 53 | )->alignItemsCenter() 54 | )->action(); 55 | })->empty( 56 | S::listGroupItem('No DummyTitles to display.') 57 | ) 58 | )->mb(3), 59 | 60 | S::pagination($dummyVariables) 61 | )->py(4), 62 | 63 | S::livewire('dummy-routes.create'), 64 | S::livewire('dummy-routes.read'), 65 | S::livewire('dummy-routes.update') 66 | ); 67 | } 68 | 69 | public function delete(DummyModel $dummyVariable) 70 | { 71 | $dummyVariable->delete(); 72 | $this->emit('toastSuccess', 'DummyTitle deleted!'); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /resources/stubs/crudtrait/app/Http/Livewire/DummyModels/Index.php.stub: -------------------------------------------------------------------------------- 1 | model['search'])) { 22 | $query->where('name', 'like', '%' . $this->model['search'] . '%'); 23 | } 24 | 25 | return $query->orderBy('name'); 26 | } 27 | 28 | public function view() 29 | { 30 | $dummyVariables = $this->query()->paginate(); 31 | 32 | return S::div( 33 | S::livewire('layouts.navbar'), 34 | 35 | S::container( 36 | S::heading($this->pageTitle), 37 | 38 | S::row( 39 | S::col(S::input('search')->type('search')->placeholder('Search')->modelDebounce())->mdAuto()->mb(3), 40 | S::col(S::button('Create DummyTitle')->primary()->click('$emit', 'showCreateDummyModelModal'))->mdAuto()->mb(3) 41 | )->justifyContentBetween(), 42 | 43 | S::listGroup( 44 | S::each($dummyVariables, function ($dummyVariable) { 45 | return S::listGroupItem( 46 | S::row( 47 | S::col(e($dummyVariable->name))->md(), 48 | S::col( 49 | S::button(S::icon('eye'))->title('Read')->link()->p(1)->click('$emit', 'showReadDummyModelModal', $dummyVariable->id), 50 | S::button(S::icon('edit'))->title('Update')->link()->p(1)->click('$emit', 'showUpdateDummyModelModal', $dummyVariable->id), 51 | S::button(S::icon('trash-alt'))->title('Delete')->link()->p(1)->click('delete', $dummyVariable->id)->confirm(), 52 | )->mdAuto() 53 | )->alignItemsCenter() 54 | )->action(); 55 | })->empty( 56 | S::listGroupItem('No DummyTitles to display.') 57 | ) 58 | )->mb(3), 59 | 60 | S::pagination($dummyVariables) 61 | )->py(4), 62 | 63 | S::livewire('dummy-routes.create'), 64 | S::livewire('dummy-routes.read'), 65 | S::livewire('dummy-routes.update') 66 | ); 67 | } 68 | 69 | public function delete(DummyModel $dummyVariable) 70 | { 71 | $dummyVariable->delete(); 72 | $this->emit('toastSuccess', 'DummyTitle deleted!'); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /resources/stubs/install/app/Http/Livewire/Users/Index.php.stub: -------------------------------------------------------------------------------- 1 | model['search'])) { 22 | $query->where('name', 'like', '%' . $this->model['search'] . '%'); 23 | $query->orWhere('email', 'like', '%' . $this->model['search'] . '%'); 24 | } 25 | 26 | return $query->orderBy('name'); 27 | } 28 | 29 | public function view() 30 | { 31 | $users = $this->query()->paginate(); 32 | 33 | return S::div( 34 | S::livewire('layouts.navbar'), 35 | 36 | S::container( 37 | S::heading($this->pageTitle), 38 | 39 | S::row( 40 | S::col(S::input('search')->type('search')->placeholder('Search')->modelDebounce())->mdAuto()->mb(3), 41 | S::col(S::button('Create User')->primary()->click('$emit', 'showCreateUserModal'))->mdAuto()->mb(3) 42 | )->justifyContentBetween(), 43 | 44 | S::listGroup( 45 | S::each($users, function ($user) { 46 | return S::listGroupItem( 47 | S::row( 48 | S::col( 49 | S::div(e($user->name)), 50 | S::div(e($user->email))->small()->textMuted(), 51 | )->md(), 52 | S::col( 53 | S::button(S::icon('eye'))->title('Read')->link()->p(1)->click('$emit', 'showReadUserModal', $user->id), 54 | S::button(S::icon('edit'))->title('Update')->link()->p(1)->click('$emit', 'showUpdateUserModal', $user->id), 55 | S::button(S::icon('trash-alt'))->title('Delete')->link()->p(1)->click('delete', $user->id)->confirm(), 56 | )->mdAuto() 57 | )->alignItemsCenter() 58 | )->action(); 59 | })->empty( 60 | S::listGroupItem('No users to display.') 61 | ) 62 | )->mb(3), 63 | 64 | S::pagination($users) 65 | )->py(4), 66 | 67 | S::livewire('users.create'), 68 | S::livewire('users.read'), 69 | S::livewire('users.update') 70 | ); 71 | } 72 | 73 | public function delete(User $user) 74 | { 75 | $user->delete(); 76 | $this->emit('toastSuccess', 'User deleted!'); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/Components/ButtonComponent.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | } 15 | 16 | public function submit() 17 | { 18 | return $this->attr('type', 'submit'); 19 | } 20 | 21 | public function primary() 22 | { 23 | return $this->class('btn btn-primary'); 24 | } 25 | 26 | public function secondary() 27 | { 28 | return $this->class('btn btn-secondary'); 29 | } 30 | 31 | public function success() 32 | { 33 | return $this->class('btn btn-success'); 34 | } 35 | 36 | public function info() 37 | { 38 | return $this->class('btn btn-info'); 39 | } 40 | 41 | public function danger() 42 | { 43 | return $this->class('btn btn-danger'); 44 | } 45 | 46 | public function warning() 47 | { 48 | return $this->class('btn btn-warning'); 49 | } 50 | 51 | public function light() 52 | { 53 | return $this->class('btn btn-light'); 54 | } 55 | 56 | public function dark() 57 | { 58 | return $this->class('btn btn-dark'); 59 | } 60 | 61 | public function outlinePrimary() 62 | { 63 | return $this->class('btn btn-outline-primary'); 64 | } 65 | 66 | public function outlineSecondary() 67 | { 68 | return $this->class('btn btn-outline-secondary'); 69 | } 70 | 71 | public function outlineSuccess() 72 | { 73 | return $this->class('btn btn-outline-success'); 74 | } 75 | 76 | public function outlineInfo() 77 | { 78 | return $this->class('btn btn-outline-info'); 79 | } 80 | 81 | public function outlineDanger() 82 | { 83 | return $this->class('btn btn-outline-danger'); 84 | } 85 | 86 | public function outlineWarning() 87 | { 88 | return $this->class('btn btn-outline-warning'); 89 | } 90 | 91 | public function outlineLight() 92 | { 93 | return $this->class('btn btn-outline-light'); 94 | } 95 | 96 | public function outlineDark() 97 | { 98 | return $this->class('btn btn-outline-dark'); 99 | } 100 | 101 | public function link() 102 | { 103 | return $this->class('btn btn-link'); 104 | } 105 | 106 | public function active($active = true) 107 | { 108 | return $active ? $this->class('active') : $this; 109 | } 110 | 111 | public function sm() 112 | { 113 | return $this->class('btn-sm'); 114 | } 115 | 116 | public function lg() 117 | { 118 | return $this->class('btn-lg'); 119 | } 120 | 121 | public function block() 122 | { 123 | return $this->class('btn-block'); 124 | } 125 | 126 | public function disabled($disabled = true) 127 | { 128 | return $disabled ? $this->attr('disabled', '') : $this; 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /src/Traits/BorderUtilities.php: -------------------------------------------------------------------------------- 1 | class('border' . (!is_null($border) ? '-' . $border : null)); 10 | } 11 | 12 | public function borderTop($borderTop = null) 13 | { 14 | return $this->class('border-top' . (!is_null($borderTop) ? '-' . $borderTop : null)); 15 | } 16 | 17 | public function borderRight($borderRight = null) 18 | { 19 | return $this->class('border-right' . (!is_null($borderRight) ? '-' . $borderRight : null)); 20 | } 21 | 22 | public function borderBottom($borderBottom = null) 23 | { 24 | return $this->class('border-bottom' . (!is_null($borderBottom) ? '-' . $borderBottom : null)); 25 | } 26 | 27 | public function borderLeft($borderLeft = null) 28 | { 29 | return $this->class('border-left' . (!is_null($borderLeft) ? '-' . $borderLeft : null)); 30 | } 31 | 32 | public function borderPrimary() 33 | { 34 | return $this->class('border-primary'); 35 | } 36 | 37 | public function borderSecondary() 38 | { 39 | return $this->class('border-secondary'); 40 | } 41 | 42 | public function borderSuccess() 43 | { 44 | return $this->class('border-success'); 45 | } 46 | 47 | public function borderInfo() 48 | { 49 | return $this->class('border-info'); 50 | } 51 | 52 | public function borderDanger() 53 | { 54 | return $this->class('border-danger'); 55 | } 56 | 57 | public function borderWarning() 58 | { 59 | return $this->class('border-warning'); 60 | } 61 | 62 | public function borderLight() 63 | { 64 | return $this->class('border-light'); 65 | } 66 | 67 | public function borderDark() 68 | { 69 | return $this->class('border-dark'); 70 | } 71 | 72 | public function borderWhite() 73 | { 74 | return $this->class('border-white'); 75 | } 76 | 77 | public function rounded($rounded = null) 78 | { 79 | return $this->class('rounded' . ($rounded ? '-' . $rounded : null)); 80 | } 81 | 82 | public function roundedTop() 83 | { 84 | return $this->class('rounded-top'); 85 | } 86 | 87 | public function roundedRight() 88 | { 89 | return $this->class('rounded-right'); 90 | } 91 | 92 | public function roundedBottom() 93 | { 94 | return $this->class('rounded-bottom'); 95 | } 96 | 97 | public function roundedLeft() 98 | { 99 | return $this->class('rounded-left'); 100 | } 101 | 102 | public function roundedCircle() 103 | { 104 | return $this->class('rounded-circle'); 105 | } 106 | 107 | public function roundedPill() 108 | { 109 | return $this->class('rounded-pill'); 110 | } 111 | 112 | public function roundedLg() 113 | { 114 | return $this->class('rounded-lg'); 115 | } 116 | 117 | public function roundedSm() 118 | { 119 | return $this->class('rounded-sm'); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /src/Traits/JustifyUtilities.php: -------------------------------------------------------------------------------- 1 | class('justify-content-start'); 10 | } 11 | 12 | public function justifyContentSmStart() 13 | { 14 | return $this->class('justify-content-sm-start'); 15 | } 16 | 17 | public function justifyContentMdStart() 18 | { 19 | return $this->class('justify-content-md-start'); 20 | } 21 | 22 | public function justifyContentLgStart() 23 | { 24 | return $this->class('justify-content-lg-start'); 25 | } 26 | 27 | public function justifyContentXlStart() 28 | { 29 | return $this->class('justify-content-xl-start'); 30 | } 31 | 32 | public function justifyContentEnd() 33 | { 34 | return $this->class('justify-content-end'); 35 | } 36 | 37 | public function justifyContentSmEnd() 38 | { 39 | return $this->class('justify-content-sm-end'); 40 | } 41 | 42 | public function justifyContentMdEnd() 43 | { 44 | return $this->class('justify-content-md-end'); 45 | } 46 | 47 | public function justifyContentLgEnd() 48 | { 49 | return $this->class('justify-content-lg-end'); 50 | } 51 | 52 | public function justifyContentXlEnd() 53 | { 54 | return $this->class('justify-content-xl-end'); 55 | } 56 | 57 | public function justifyContentCenter() 58 | { 59 | return $this->class('justify-content-center'); 60 | } 61 | 62 | public function justifyContentSmCenter() 63 | { 64 | return $this->class('justify-content-sm-center'); 65 | } 66 | 67 | public function justifyContentMdCenter() 68 | { 69 | return $this->class('justify-content-md-center'); 70 | } 71 | 72 | public function justifyContentLgCenter() 73 | { 74 | return $this->class('justify-content-lg-center'); 75 | } 76 | 77 | public function justifyContentXlCenter() 78 | { 79 | return $this->class('justify-content-xl-center'); 80 | } 81 | 82 | public function justifyContentBetween() 83 | { 84 | return $this->class('justify-content-between'); 85 | } 86 | 87 | public function justifyContentSmBetween() 88 | { 89 | return $this->class('justify-content-sm-between'); 90 | } 91 | 92 | public function justifyContentMdBetween() 93 | { 94 | return $this->class('justify-content-md-between'); 95 | } 96 | 97 | public function justifyContentLgBetween() 98 | { 99 | return $this->class('justify-content-lg-between'); 100 | } 101 | 102 | public function justifyContentXlBetween() 103 | { 104 | return $this->class('justify-content-xl-between'); 105 | } 106 | 107 | public function justifyContentAround() 108 | { 109 | return $this->class('justify-content-around'); 110 | } 111 | 112 | public function justifyContentSmAround() 113 | { 114 | return $this->class('justify-content-sm-around'); 115 | } 116 | 117 | public function justifyContentMdAround() 118 | { 119 | return $this->class('justify-content-md-around'); 120 | } 121 | 122 | public function justifyContentLgAround() 123 | { 124 | return $this->class('justify-content-lg-around'); 125 | } 126 | 127 | public function justifyContentXlAround() 128 | { 129 | return $this->class('justify-content-xl-around'); 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /src/Traits/PaddingUtilities.php: -------------------------------------------------------------------------------- 1 | class('p-' . $p); 10 | } 11 | 12 | public function pSm($pSm) 13 | { 14 | return $this->class('p-sm-' . $pSm); 15 | } 16 | 17 | public function pMd($pMd) 18 | { 19 | return $this->class('p-md-' . $pMd); 20 | } 21 | 22 | public function pLg($pLg) 23 | { 24 | return $this->class('p-lg-' . $pLg); 25 | } 26 | 27 | public function pXl($pXl) 28 | { 29 | return $this->class('p-xl-' . $pXl); 30 | } 31 | 32 | public function px($px) 33 | { 34 | return $this->class('px-' . $px); 35 | } 36 | 37 | public function pxSm($pxSm) 38 | { 39 | return $this->class('px-sm-' . $pxSm); 40 | } 41 | 42 | public function pxMd($pxMd) 43 | { 44 | return $this->class('px-md-' . $pxMd); 45 | } 46 | 47 | public function pxLg($pxLg) 48 | { 49 | return $this->class('px-lg-' . $pxLg); 50 | } 51 | 52 | public function pxXl($pxXl) 53 | { 54 | return $this->class('px-xl-' . $pxXl); 55 | } 56 | 57 | public function py($py) 58 | { 59 | return $this->class('py-' . $py); 60 | } 61 | 62 | public function pySm($pySm) 63 | { 64 | return $this->class('py-sm-' . $pySm); 65 | } 66 | 67 | public function pyMd($pyMd) 68 | { 69 | return $this->class('py-md-' . $pyMd); 70 | } 71 | 72 | public function pyLg($pyLg) 73 | { 74 | return $this->class('py-lg-' . $pyLg); 75 | } 76 | 77 | public function pyXl($pyXl) 78 | { 79 | return $this->class('py-xl-' . $pyXl); 80 | } 81 | 82 | public function pt($pt) 83 | { 84 | return $this->class('pt-' . $pt); 85 | } 86 | 87 | public function ptSm($ptSm) 88 | { 89 | return $this->class('pt-sm-' . $ptSm); 90 | } 91 | 92 | public function ptMd($ptMd) 93 | { 94 | return $this->class('pt-md-' . $ptMd); 95 | } 96 | 97 | public function ptLg($ptLg) 98 | { 99 | return $this->class('pt-lg-' . $ptLg); 100 | } 101 | 102 | public function ptXl($ptXl) 103 | { 104 | return $this->class('pt-xl-' . $ptXl); 105 | } 106 | 107 | public function pr($pr) 108 | { 109 | return $this->class('pr-' . $pr); 110 | } 111 | 112 | public function prSm($prSm) 113 | { 114 | return $this->class('pr-sm-' . $prSm); 115 | } 116 | 117 | public function prMd($prMd) 118 | { 119 | return $this->class('pr-md-' . $prMd); 120 | } 121 | 122 | public function prLg($prLg) 123 | { 124 | return $this->class('pr-lg-' . $prLg); 125 | } 126 | 127 | public function prXl($prXl) 128 | { 129 | return $this->class('pr-xl-' . $prXl); 130 | } 131 | 132 | public function pb($pb) 133 | { 134 | return $this->class('pb-' . $pb); 135 | } 136 | 137 | public function pbSm($pbSm) 138 | { 139 | return $this->class('pb-sm-' . $pbSm); 140 | } 141 | 142 | public function pbMd($pbMd) 143 | { 144 | return $this->class('pb-md-' . $pbMd); 145 | } 146 | 147 | public function pbLg($pbLg) 148 | { 149 | return $this->class('pb-lg-' . $pbLg); 150 | } 151 | 152 | public function pbXl($pbXl) 153 | { 154 | return $this->class('pb-xl-' . $pbXl); 155 | } 156 | 157 | public function pl($pl) 158 | { 159 | return $this->class('pl-' . $pl); 160 | } 161 | 162 | public function plSm($plSm) 163 | { 164 | return $this->class('pl-sm-' . $plSm); 165 | } 166 | 167 | public function plMd($plMd) 168 | { 169 | return $this->class('pl-md-' . $plMd); 170 | } 171 | 172 | public function plLg($plLg) 173 | { 174 | return $this->class('pl-lg-' . $plLg); 175 | } 176 | 177 | public function plXl($plXl) 178 | { 179 | return $this->class('pl-xl-' . $plXl); 180 | } 181 | } 182 | -------------------------------------------------------------------------------- /src/Traits/DisplayUtilities.php: -------------------------------------------------------------------------------- 1 | class('d-none'); 10 | } 11 | 12 | public function dSmNone() 13 | { 14 | return $this->class('d-sm-none'); 15 | } 16 | 17 | public function dMdNone() 18 | { 19 | return $this->class('d-md-none'); 20 | } 21 | 22 | public function dLgNone() 23 | { 24 | return $this->class('d-lg-none'); 25 | } 26 | 27 | public function dXlNone() 28 | { 29 | return $this->class('d-xl-none'); 30 | } 31 | 32 | public function dInline() 33 | { 34 | return $this->class('d-inline'); 35 | } 36 | 37 | public function dSmInline() 38 | { 39 | return $this->class('d-sm-inline'); 40 | } 41 | 42 | public function dMdInline() 43 | { 44 | return $this->class('d-md-inline'); 45 | } 46 | 47 | public function dLgInline() 48 | { 49 | return $this->class('d-lg-inline'); 50 | } 51 | 52 | public function dXlInline() 53 | { 54 | return $this->class('d-xl-inline'); 55 | } 56 | 57 | public function dInlineBlock() 58 | { 59 | return $this->class('d-inline-block'); 60 | } 61 | 62 | public function dSmInlineBlock() 63 | { 64 | return $this->class('d-sm-inline-block'); 65 | } 66 | 67 | public function dMdInlineBlock() 68 | { 69 | return $this->class('d-md-inline-block'); 70 | } 71 | 72 | public function dLgInlineBlock() 73 | { 74 | return $this->class('d-lg-inline-block'); 75 | } 76 | 77 | public function dXlInlineBlock() 78 | { 79 | return $this->class('d-xl-inline-block'); 80 | } 81 | 82 | public function dBlock() 83 | { 84 | return $this->class('d-block'); 85 | } 86 | 87 | public function dSmBlock() 88 | { 89 | return $this->class('d-sm-block'); 90 | } 91 | 92 | public function dMdBlock() 93 | { 94 | return $this->class('d-md-block'); 95 | } 96 | 97 | public function dLgBlock() 98 | { 99 | return $this->class('d-lg-block'); 100 | } 101 | 102 | public function dXlBlock() 103 | { 104 | return $this->class('d-xl-block'); 105 | } 106 | 107 | public function dTable() 108 | { 109 | return $this->class('d-table'); 110 | } 111 | 112 | public function dSmTable() 113 | { 114 | return $this->class('d-sm-table'); 115 | } 116 | 117 | public function dMdTable() 118 | { 119 | return $this->class('d-md-table'); 120 | } 121 | 122 | public function dLgTable() 123 | { 124 | return $this->class('d-lg-table'); 125 | } 126 | 127 | public function dXlTable() 128 | { 129 | return $this->class('d-xl-table'); 130 | } 131 | 132 | public function dTableCell() 133 | { 134 | return $this->class('d-table-cell'); 135 | } 136 | 137 | public function dSmTableCell() 138 | { 139 | return $this->class('d-sm-table-cell'); 140 | } 141 | 142 | public function dMdTableCell() 143 | { 144 | return $this->class('d-md-table-cell'); 145 | } 146 | 147 | public function dLgTableCell() 148 | { 149 | return $this->class('d-lg-table-cell'); 150 | } 151 | 152 | public function dXlTableCell() 153 | { 154 | return $this->class('d-xl-table-cell'); 155 | } 156 | 157 | public function dTableRow() 158 | { 159 | return $this->class('d-table-row'); 160 | } 161 | 162 | public function dSmTableRow() 163 | { 164 | return $this->class('d-sm-table-row'); 165 | } 166 | 167 | public function dMdTableRow() 168 | { 169 | return $this->class('d-md-table-row'); 170 | } 171 | 172 | public function dLgTableRow() 173 | { 174 | return $this->class('d-lg-table-row'); 175 | } 176 | 177 | public function dXlTableRow() 178 | { 179 | return $this->class('d-xl-table-row'); 180 | } 181 | 182 | public function show() 183 | { 184 | return $this->class('show'); 185 | } 186 | 187 | public function hide() 188 | { 189 | return $this->class('hide'); 190 | } 191 | 192 | public function visible() 193 | { 194 | return $this->class('visible'); 195 | } 196 | 197 | public function invisible() 198 | { 199 | return $this->class('invisible'); 200 | } 201 | 202 | public function overflowAuto() 203 | { 204 | return $this->class('overflow-auto'); 205 | } 206 | 207 | public function overflowHidden() 208 | { 209 | return $this->class('overflow-hidden'); 210 | } 211 | } 212 | -------------------------------------------------------------------------------- /src/Traits/TextUtilities.php: -------------------------------------------------------------------------------- 1 | class('text-justify'); 10 | } 11 | 12 | public function textSmJustify() 13 | { 14 | return $this->class('text-sm-justify'); 15 | } 16 | 17 | public function textMdJustify() 18 | { 19 | return $this->class('text-md-justify'); 20 | } 21 | 22 | public function textLgJustify() 23 | { 24 | return $this->class('text-lg-justify'); 25 | } 26 | 27 | public function textXlJustify() 28 | { 29 | return $this->class('text-xl-justify'); 30 | } 31 | 32 | public function textLeft() 33 | { 34 | return $this->class('text-left'); 35 | } 36 | 37 | public function textSmLeft() 38 | { 39 | return $this->class('text-sm-left'); 40 | } 41 | 42 | public function textMdLeft() 43 | { 44 | return $this->class('text-md-left'); 45 | } 46 | 47 | public function textLgLeft() 48 | { 49 | return $this->class('text-lg-left'); 50 | } 51 | 52 | public function textXlLeft() 53 | { 54 | return $this->class('text-xl-left'); 55 | } 56 | 57 | public function textCenter() 58 | { 59 | return $this->class('text-center'); 60 | } 61 | 62 | public function textSmCenter() 63 | { 64 | return $this->class('text-sm-center'); 65 | } 66 | 67 | public function textMdCenter() 68 | { 69 | return $this->class('text-md-center'); 70 | } 71 | 72 | public function textLgCenter() 73 | { 74 | return $this->class('text-lg-center'); 75 | } 76 | 77 | public function textXlCenter() 78 | { 79 | return $this->class('text-xl-center'); 80 | } 81 | 82 | public function textRight() 83 | { 84 | return $this->class('text-right'); 85 | } 86 | 87 | public function textSmRight() 88 | { 89 | return $this->class('text-sm-right'); 90 | } 91 | 92 | public function textMdRight() 93 | { 94 | return $this->class('text-md-right'); 95 | } 96 | 97 | public function textLgRight() 98 | { 99 | return $this->class('text-lg-right'); 100 | } 101 | 102 | public function textXlRight() 103 | { 104 | return $this->class('text-xl-right'); 105 | } 106 | 107 | public function textWrap() 108 | { 109 | return $this->class('text-wrap'); 110 | } 111 | 112 | public function textNowrap() 113 | { 114 | return $this->class('text-nowrap'); 115 | } 116 | 117 | public function textTruncate() 118 | { 119 | return $this->class('text-truncate'); 120 | } 121 | 122 | public function textBreak() 123 | { 124 | return $this->class('text-break'); 125 | } 126 | 127 | public function textLowercase() 128 | { 129 | return $this->class('text-lowercase'); 130 | } 131 | 132 | public function textUppercase() 133 | { 134 | return $this->class('text-uppercase'); 135 | } 136 | 137 | public function textCapitalize() 138 | { 139 | return $this->class('text-capitalize'); 140 | } 141 | 142 | public function textMonospace() 143 | { 144 | return $this->class('text-monospace'); 145 | } 146 | 147 | public function textReset() 148 | { 149 | return $this->class('text-reset'); 150 | } 151 | 152 | public function textDecorationNone() 153 | { 154 | return $this->class('text-decoration-none'); 155 | } 156 | 157 | public function textPrimary() 158 | { 159 | return $this->class('text-primary'); 160 | } 161 | 162 | public function textSecondary() 163 | { 164 | return $this->class('text-secondary'); 165 | } 166 | 167 | public function textSuccess() 168 | { 169 | return $this->class('text-success'); 170 | } 171 | 172 | public function textInfo() 173 | { 174 | return $this->class('text-info'); 175 | } 176 | 177 | public function textDanger() 178 | { 179 | return $this->class('text-danger'); 180 | } 181 | 182 | public function textWarning() 183 | { 184 | return $this->class('text-warning'); 185 | } 186 | 187 | public function textLight() 188 | { 189 | return $this->class('text-light'); 190 | } 191 | 192 | public function textDark() 193 | { 194 | return $this->class('text-dark'); 195 | } 196 | 197 | public function textMuted() 198 | { 199 | return $this->class('text-muted'); 200 | } 201 | 202 | public function textWhite() 203 | { 204 | return $this->class('text-white'); 205 | } 206 | 207 | public function fontWeightBold() 208 | { 209 | return $this->class('font-weight-bold'); 210 | } 211 | 212 | public function fontWeightBolder() 213 | { 214 | return $this->class('font-weight-bolder'); 215 | } 216 | 217 | public function fontWeightNormal() 218 | { 219 | return $this->class('font-weight-normal'); 220 | } 221 | 222 | public function fontWeightLight() 223 | { 224 | return $this->class('font-weight-light'); 225 | } 226 | 227 | public function fontWeightLighter() 228 | { 229 | return $this->class('font-weight-lighter'); 230 | } 231 | 232 | public function fontItalic() 233 | { 234 | return $this->class('font-italic'); 235 | } 236 | 237 | public function display($display) 238 | { 239 | return $this->class('display-' . $display); 240 | } 241 | 242 | public function lead() 243 | { 244 | return $this->class('lead'); 245 | } 246 | 247 | public function small() 248 | { 249 | return $this->class('small'); 250 | } 251 | } 252 | -------------------------------------------------------------------------------- /src/Traits/FlexUtilities.php: -------------------------------------------------------------------------------- 1 | class('d-flex'); 10 | } 11 | 12 | public function dSmFlex() 13 | { 14 | return $this->class('d-sm-flex'); 15 | } 16 | 17 | public function dMdFlex() 18 | { 19 | return $this->class('d-md-flex'); 20 | } 21 | 22 | public function dLgFlex() 23 | { 24 | return $this->class('d-lg-flex'); 25 | } 26 | 27 | public function dXlFlex() 28 | { 29 | return $this->class('d-xl-flex'); 30 | } 31 | 32 | public function dInlineFlex() 33 | { 34 | return $this->class('d-inline-flex'); 35 | } 36 | 37 | public function dSmInlineFlex() 38 | { 39 | return $this->class('d-sm-inline-flex'); 40 | } 41 | 42 | public function dMdInlineFlex() 43 | { 44 | return $this->class('d-md-inline-flex'); 45 | } 46 | 47 | public function dLgInlineFlex() 48 | { 49 | return $this->class('d-lg-inline-flex'); 50 | } 51 | 52 | public function dXlInlineFlex() 53 | { 54 | return $this->class('d-xl-inline-flex'); 55 | } 56 | 57 | public function flexRow() 58 | { 59 | return $this->class('flex-row'); 60 | } 61 | 62 | public function flexSmRow() 63 | { 64 | return $this->class('flex-sm-row'); 65 | } 66 | 67 | public function flexMdRow() 68 | { 69 | return $this->class('flex-md-row'); 70 | } 71 | 72 | public function flexLgRow() 73 | { 74 | return $this->class('flex-lg-row'); 75 | } 76 | 77 | public function flexXlRow() 78 | { 79 | return $this->class('flex-xl-row'); 80 | } 81 | 82 | public function flexRowReverse() 83 | { 84 | return $this->class('flex-row-reverse'); 85 | } 86 | 87 | public function flexSmRowReverse() 88 | { 89 | return $this->class('flex-sm-row-reverse'); 90 | } 91 | 92 | public function flexMdRowReverse() 93 | { 94 | return $this->class('flex-md-row-reverse'); 95 | } 96 | 97 | public function flexLgRowReverse() 98 | { 99 | return $this->class('flex-lg-row-reverse'); 100 | } 101 | 102 | public function flexXlRowReverse() 103 | { 104 | return $this->class('flex-xl-row-reverse'); 105 | } 106 | 107 | public function flexColumn() 108 | { 109 | return $this->class('flex-column'); 110 | } 111 | 112 | public function flexSmColumn() 113 | { 114 | return $this->class('flex-sm-column'); 115 | } 116 | 117 | public function flexMdColumn() 118 | { 119 | return $this->class('flex-md-column'); 120 | } 121 | 122 | public function flexLgColumn() 123 | { 124 | return $this->class('flex-lg-column'); 125 | } 126 | 127 | public function flexXlColumn() 128 | { 129 | return $this->class('flex-xl-column'); 130 | } 131 | 132 | public function flexColumnReverse() 133 | { 134 | return $this->class('flex-column-reverse'); 135 | } 136 | 137 | public function flexSmColumnReverse() 138 | { 139 | return $this->class('flex-sm-column-reverse'); 140 | } 141 | 142 | public function flexMdColumnReverse() 143 | { 144 | return $this->class('flex-md-column-reverse'); 145 | } 146 | 147 | public function flexLgColumnReverse() 148 | { 149 | return $this->class('flex-lg-column-reverse'); 150 | } 151 | 152 | public function flexXlColumnReverse() 153 | { 154 | return $this->class('flex-xl-column-reverse'); 155 | } 156 | 157 | public function flexFill() 158 | { 159 | return $this->class('flex-fill'); 160 | } 161 | 162 | public function flexSmFill() 163 | { 164 | return $this->class('flex-sm-fill'); 165 | } 166 | 167 | public function flexMdFill() 168 | { 169 | return $this->class('flex-md-fill'); 170 | } 171 | 172 | public function flexLgFill() 173 | { 174 | return $this->class('flex-lg-fill'); 175 | } 176 | 177 | public function flexXlFill() 178 | { 179 | return $this->class('flex-xl-fill'); 180 | } 181 | 182 | public function flexGrow($flexGrow) 183 | { 184 | return $this->class('flex-grow-' . $flexGrow); 185 | } 186 | 187 | public function flexSmGrow($flexSmGrow) 188 | { 189 | return $this->class('flex-sm-grow-' . $flexSmGrow); 190 | } 191 | 192 | public function flexMdGrow($flexMdGrow) 193 | { 194 | return $this->class('flex-md-grow-' . $flexMdGrow); 195 | } 196 | 197 | public function flexLgGrow($flexLgGrow) 198 | { 199 | return $this->class('flex-lg-grow-' . $flexLgGrow); 200 | } 201 | 202 | public function flexXlGrow($flexXlGrow) 203 | { 204 | return $this->class('flex-xl-grow-' . $flexXlGrow); 205 | } 206 | 207 | public function flexShrink($flexShrink) 208 | { 209 | return $this->class('flex-shrink-' . $flexShrink); 210 | } 211 | 212 | public function flexSmShrink($flexSmShrink) 213 | { 214 | return $this->class('flex-sm-shrink-' . $flexSmShrink); 215 | } 216 | 217 | public function flexMdShrink($flexMdShrink) 218 | { 219 | return $this->class('flex-md-shrink-' . $flexMdShrink); 220 | } 221 | 222 | public function flexLgShrink($flexLgShrink) 223 | { 224 | return $this->class('flex-lg-shrink-' . $flexLgShrink); 225 | } 226 | 227 | public function flexXlShrink($flexXlShrink) 228 | { 229 | return $this->class('flex-xl-shrink-' . $flexXlShrink); 230 | } 231 | 232 | public function flexNowrap() 233 | { 234 | return $this->class('flex-nowrap'); 235 | } 236 | 237 | public function flexSmNowrap() 238 | { 239 | return $this->class('flex-sm-nowrap'); 240 | } 241 | 242 | public function flexMdNowrap() 243 | { 244 | return $this->class('flex-md-nowrap'); 245 | } 246 | 247 | public function flexLgNowrap() 248 | { 249 | return $this->class('flex-lg-nowrap'); 250 | } 251 | 252 | public function flexXlNowrap() 253 | { 254 | return $this->class('flex-xl-nowrap'); 255 | } 256 | 257 | public function flexWrap() 258 | { 259 | return $this->class('flex-wrap'); 260 | } 261 | 262 | public function flexSmWrap() 263 | { 264 | return $this->class('flex-sm-wrap'); 265 | } 266 | 267 | public function flexMdWrap() 268 | { 269 | return $this->class('flex-md-wrap'); 270 | } 271 | 272 | public function flexLgWrap() 273 | { 274 | return $this->class('flex-lg-wrap'); 275 | } 276 | 277 | public function flexXlWrap() 278 | { 279 | return $this->class('flex-xl-wrap'); 280 | } 281 | 282 | public function flexWrapReverse() 283 | { 284 | return $this->class('flex-wrap-reverse'); 285 | } 286 | 287 | public function flexSmWrapReverse() 288 | { 289 | return $this->class('flex-sm-wrap-reverse'); 290 | } 291 | 292 | public function flexMdWrapReverse() 293 | { 294 | return $this->class('flex-md-wrap-reverse'); 295 | } 296 | 297 | public function flexLgWrapReverse() 298 | { 299 | return $this->class('flex-lg-wrap-reverse'); 300 | } 301 | 302 | public function flexXlWrapReverse() 303 | { 304 | return $this->class('flex-xl-wrap-reverse'); 305 | } 306 | } 307 | -------------------------------------------------------------------------------- /src/Traits/MarginUtilities.php: -------------------------------------------------------------------------------- 1 | class('m-' . $m); 10 | } 11 | 12 | public function mAuto() 13 | { 14 | return $this->class('m-auto'); 15 | } 16 | 17 | public function mSm($mSm) 18 | { 19 | return $this->class('m-sm-' . $mSm); 20 | } 21 | 22 | public function mSmAuto() 23 | { 24 | return $this->class('m-sm-auto'); 25 | } 26 | 27 | public function mMd($mMd) 28 | { 29 | return $this->class('m-md-' . $mMd); 30 | } 31 | 32 | public function mMdAuto() 33 | { 34 | return $this->class('m-md-auto'); 35 | } 36 | 37 | public function mLg($mLg) 38 | { 39 | return $this->class('m-lg-' . $mLg); 40 | } 41 | 42 | public function mLgAuto() 43 | { 44 | return $this->class('m-lg-auto'); 45 | } 46 | 47 | public function mXl($mXl) 48 | { 49 | return $this->class('m-xl-' . $mXl); 50 | } 51 | 52 | public function mXlAuto() 53 | { 54 | return $this->class('m-xl-auto'); 55 | } 56 | 57 | public function mx($mx) 58 | { 59 | return $this->class('mx-' . $mx); 60 | } 61 | 62 | public function mxAuto() 63 | { 64 | return $this->class('mx-auto'); 65 | } 66 | 67 | public function mxSm($mxSm) 68 | { 69 | return $this->class('mx-sm-' . $mxSm); 70 | } 71 | 72 | public function mxSmAuto() 73 | { 74 | return $this->class('mx-sm-auto'); 75 | } 76 | 77 | public function mxMd($mxMd) 78 | { 79 | return $this->class('mx-md-' . $mxMd); 80 | } 81 | 82 | public function mxMdAuto() 83 | { 84 | return $this->class('mx-md-auto'); 85 | } 86 | 87 | public function mxLg($mxLg) 88 | { 89 | return $this->class('mx-lg-' . $mxLg); 90 | } 91 | 92 | public function mxLgAuto() 93 | { 94 | return $this->class('mx-lg-auto'); 95 | } 96 | 97 | public function mxXl($mxXl) 98 | { 99 | return $this->class('mx-xl-' . $mxXl); 100 | } 101 | 102 | public function mxXlAuto() 103 | { 104 | return $this->class('mx-xl-auto'); 105 | } 106 | 107 | public function my($my) 108 | { 109 | return $this->class('my-' . $my); 110 | } 111 | 112 | public function myAuto() 113 | { 114 | return $this->class('my-auto'); 115 | } 116 | 117 | public function mySm($mySm) 118 | { 119 | return $this->class('my-sm-' . $mySm); 120 | } 121 | 122 | public function mySmAuto() 123 | { 124 | return $this->class('my-sm-auto'); 125 | } 126 | 127 | public function myMd($myMd) 128 | { 129 | return $this->class('my-md-' . $myMd); 130 | } 131 | 132 | public function myMdAuto() 133 | { 134 | return $this->class('my-md-auto'); 135 | } 136 | 137 | public function myLg($myLg) 138 | { 139 | return $this->class('my-lg-' . $myLg); 140 | } 141 | 142 | public function myLgAuto() 143 | { 144 | return $this->class('my-lg-auto'); 145 | } 146 | 147 | public function myXl($myXl) 148 | { 149 | return $this->class('my-xl-' . $myXl); 150 | } 151 | 152 | public function myXlAuto() 153 | { 154 | return $this->class('my-xl-auto'); 155 | } 156 | 157 | public function mt($mt) 158 | { 159 | return $this->class('mt-' . $mt); 160 | } 161 | 162 | public function mtAuto() 163 | { 164 | return $this->class('mt-auto'); 165 | } 166 | 167 | public function mtSm($mtSm) 168 | { 169 | return $this->class('mt-sm-' . $mtSm); 170 | } 171 | 172 | public function mtSmAuto() 173 | { 174 | return $this->class('mt-sm-auto'); 175 | } 176 | 177 | public function mtMd($mtMd) 178 | { 179 | return $this->class('mt-md-' . $mtMd); 180 | } 181 | 182 | public function mtMdAuto() 183 | { 184 | return $this->class('mt-md-auto'); 185 | } 186 | 187 | public function mtLg($mtLg) 188 | { 189 | return $this->class('mt-lg-' . $mtLg); 190 | } 191 | 192 | public function mtLgAuto() 193 | { 194 | return $this->class('mt-lg-auto'); 195 | } 196 | 197 | public function mtXl($mtXl) 198 | { 199 | return $this->class('mt-xl-' . $mtXl); 200 | } 201 | 202 | public function mtXlAuto() 203 | { 204 | return $this->class('mt-xl-auto'); 205 | } 206 | 207 | public function mr($mr) 208 | { 209 | return $this->class('mr-' . $mr); 210 | } 211 | 212 | public function mrAuto() 213 | { 214 | return $this->class('mr-auto'); 215 | } 216 | 217 | public function mrSm($mrSm) 218 | { 219 | return $this->class('mr-sm-' . $mrSm); 220 | } 221 | 222 | public function mrSmAuto() 223 | { 224 | return $this->class('mr-sm-auto'); 225 | } 226 | 227 | public function mrMd($mrMd) 228 | { 229 | return $this->class('mr-md-' . $mrMd); 230 | } 231 | 232 | public function mrMdAuto() 233 | { 234 | return $this->class('mr-md-auto'); 235 | } 236 | 237 | public function mrLg($mrLg) 238 | { 239 | return $this->class('mr-lg-' . $mrLg); 240 | } 241 | 242 | public function mrLgAuto() 243 | { 244 | return $this->class('mr-lg-auto'); 245 | } 246 | 247 | public function mrXl($mrXl) 248 | { 249 | return $this->class('mr-xl-' . $mrXl); 250 | } 251 | 252 | public function mrXlAuto() 253 | { 254 | return $this->class('mr-xl-auto'); 255 | } 256 | 257 | public function mb($mb) 258 | { 259 | return $this->class('mb-' . $mb); 260 | } 261 | 262 | public function mbAuto() 263 | { 264 | return $this->class('mb-auto'); 265 | } 266 | 267 | public function mbSm($mbSm) 268 | { 269 | return $this->class('mb-sm-' . $mbSm); 270 | } 271 | 272 | public function mbSmAuto() 273 | { 274 | return $this->class('mb-sm-auto'); 275 | } 276 | 277 | public function mbMd($mbMd) 278 | { 279 | return $this->class('mb-md-' . $mbMd); 280 | } 281 | 282 | public function mbMdAuto() 283 | { 284 | return $this->class('mb-md-auto'); 285 | } 286 | 287 | public function mbLg($mbLg) 288 | { 289 | return $this->class('mb-lg-' . $mbLg); 290 | } 291 | 292 | public function mbLgAuto() 293 | { 294 | return $this->class('mb-lg-auto'); 295 | } 296 | 297 | public function mbXl($mbXl) 298 | { 299 | return $this->class('mb-xl-' . $mbXl); 300 | } 301 | 302 | public function mbXlAuto() 303 | { 304 | return $this->class('mb-xl-auto'); 305 | } 306 | 307 | public function ml($ml) 308 | { 309 | return $this->class('ml-' . $ml); 310 | } 311 | 312 | public function mlAuto() 313 | { 314 | return $this->class('ml-auto'); 315 | } 316 | 317 | public function mlSm($mlSm) 318 | { 319 | return $this->class('ml-sm-' . $mlSm); 320 | } 321 | 322 | public function mlSmAuto() 323 | { 324 | return $this->class('ml-sm-auto'); 325 | } 326 | 327 | public function mlMd($mlMd) 328 | { 329 | return $this->class('ml-md-' . $mlMd); 330 | } 331 | 332 | public function mlMdAuto() 333 | { 334 | return $this->class('ml-md-auto'); 335 | } 336 | 337 | public function mlLg($mlLg) 338 | { 339 | return $this->class('ml-lg-' . $mlLg); 340 | } 341 | 342 | public function mlLgAuto() 343 | { 344 | return $this->class('ml-lg-auto'); 345 | } 346 | 347 | public function mlXl($mlXl) 348 | { 349 | return $this->class('ml-xl-' . $mlXl); 350 | } 351 | 352 | public function mlXlAuto() 353 | { 354 | return $this->class('ml-xl-auto'); 355 | } 356 | } 357 | -------------------------------------------------------------------------------- /src/Components/SwiftComponent.php: -------------------------------------------------------------------------------- 1 | render(); 317 | } 318 | } 319 | --------------------------------------------------------------------------------