├── .gitignore ├── .php_cs ├── .scrutinizer.yml ├── .travis.yml ├── LICENSE.md ├── README.md ├── composer.json ├── docs ├── Concept.md ├── Concept.pdf ├── Customization │ ├── breadcrumbs.md │ ├── dashboard.md │ ├── navigation.md │ └── templates.md ├── Features │ ├── media.md │ ├── multilanguage.md │ ├── settings.md │ └── translations.md ├── Forms │ ├── forms.md │ ├── savers.md │ └── validation.md ├── GettingStarted │ ├── configuration.md │ ├── installation.md │ └── resources.md ├── Listing │ ├── actions.md │ ├── exportable.md │ ├── filters.md │ ├── finder.md │ ├── grid.md │ ├── pagination.md │ ├── presenters.md │ ├── sortables.md │ └── view.md ├── README.md ├── _config.yml ├── _navbar.md ├── _sidebar.md ├── app.png ├── images │ ├── dashboard │ │ ├── dashboard.jpg │ │ ├── overview.jpg │ │ └── registrations.jpg │ ├── form │ │ ├── edit.jpg │ │ └── media.png │ ├── index │ │ ├── batch_actions.jpg │ │ ├── breadcrumbs.jpg │ │ ├── columns.jpg │ │ ├── exports.jpg │ │ ├── filters.jpg │ │ ├── pagination.jpg │ │ ├── presenters.jpg │ │ ├── scopes.jpg │ │ ├── single_actions.jpg │ │ ├── sortables.jpg │ │ └── view_widgets.jpg │ ├── navigation │ │ ├── groups.jpg │ │ ├── sidebar.jpg │ │ └── tools.jpg │ └── plugins │ │ ├── media.png │ │ ├── multilingual.png │ │ ├── settings.jpg │ │ └── translations.png └── index.html ├── favicon.ico ├── phpunit.xml ├── publishes ├── Dashboard │ ├── BlankPanel.php │ ├── DatabasePanel.php │ ├── GoogleAnalyticsPanel.php │ └── MembersPanel.php ├── Modules │ └── Users.php ├── Providers │ └── AdminServiceProvider.php ├── config.php ├── mix │ ├── .babelrc │ ├── .gitignore │ ├── .gitkeep │ ├── editors.js │ ├── package.json │ ├── resources │ │ ├── .gitkeep │ │ ├── images │ │ │ ├── admin.png │ │ │ ├── bg.jpg │ │ │ └── dot.png │ │ ├── js │ │ │ ├── app.js │ │ │ ├── bootstrap.js │ │ │ ├── components │ │ │ │ ├── DropZone.vue │ │ │ │ ├── FileActions.vue │ │ │ │ ├── FileInfo.vue │ │ │ │ ├── Files.vue │ │ │ │ ├── Folders.vue │ │ │ │ ├── InstantSearch.vue │ │ │ │ ├── MediaCarousel.vue │ │ │ │ ├── MediaLibrary.vue │ │ │ │ ├── MediaManager.vue │ │ │ │ ├── MediaPagination.vue │ │ │ │ ├── fields │ │ │ │ │ ├── DateTimePicker.vue │ │ │ │ │ └── many_to_many │ │ │ │ │ │ └── TagList.vue │ │ │ │ ├── index.js │ │ │ │ ├── partials │ │ │ │ │ ├── ModalFooter.vue │ │ │ │ │ ├── ModalHeader.vue │ │ │ │ │ └── index.js │ │ │ │ └── popups │ │ │ │ │ ├── MkDir.vue │ │ │ │ │ ├── Move.vue │ │ │ │ │ ├── Rename.vue │ │ │ │ │ └── index.js │ │ │ ├── editors │ │ │ │ ├── ckeditor.js │ │ │ │ ├── markdown.js │ │ │ │ ├── medium.js │ │ │ │ ├── tinymce.js │ │ │ │ └── tinymce │ │ │ │ │ └── plugins │ │ │ │ │ └── image │ │ │ │ │ ├── index.js │ │ │ │ │ └── plugin.js │ │ │ ├── media │ │ │ │ ├── Api.js │ │ │ │ ├── axios.js │ │ │ │ └── store │ │ │ │ │ ├── Response.js │ │ │ │ │ ├── Selection.js │ │ │ │ │ ├── Storage.js │ │ │ │ │ └── index.js │ │ │ ├── theme.js │ │ │ └── vendor.js │ │ ├── less │ │ │ └── glyphicons.less │ │ └── sass │ │ │ ├── _angular.scss │ │ │ ├── _dropzone.scss │ │ │ ├── _helpers.scss │ │ │ ├── _quirk.scss │ │ │ ├── _scaffold_filters.scss │ │ │ ├── _scaffold_index_actions.scss │ │ │ ├── app.scss │ │ │ ├── editors │ │ │ ├── markdown.scss │ │ │ └── medium.scss │ │ │ └── vendor.scss │ └── webpack.mix.js ├── routes.php ├── translations │ └── en │ │ ├── actions.php │ │ ├── buttons.php │ │ ├── columns.php │ │ ├── dashboard.php │ │ ├── enums.php │ │ ├── errors.php │ │ ├── hints.php │ │ ├── media.php │ │ ├── messages.php │ │ ├── module.php │ │ └── scopes.php └── views │ ├── .gitkeep │ ├── auth │ └── login.blade.php │ ├── components │ ├── index │ │ ├── index.blade.php │ │ └── table.blade.php │ └── table │ │ ├── group.blade.php │ │ ├── header.blade.php │ │ ├── row.blade.php │ │ └── spacer.blade.php │ ├── dashboard │ ├── database.blade.php │ ├── google_analytics.blade.php │ ├── members.blade.php │ └── widgets.blade.php │ ├── edit │ ├── actions.blade.php │ ├── create.blade.php │ ├── index.blade.php │ ├── row.blade.php │ └── scripts.blade.php │ ├── errors │ └── 404.blade.php │ ├── fields │ ├── belongs_to │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── view.blade.php │ ├── belongs_to_many │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── view.blade.php │ ├── boolean │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── view.blade.php │ ├── checkbox │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── view.blade.php │ ├── date │ │ ├── edit.blade.php │ │ └── index.blade.php │ ├── date_time │ │ ├── edit.blade.php │ │ └── index.blade.php │ ├── email │ │ ├── edit.blade.php │ │ └── index.blade.php │ ├── enum │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── view.blade.php │ ├── file │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── view.blade.php │ ├── has_many │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── view.blade.php │ ├── has_one │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── view.blade.php │ ├── hidden │ │ └── edit.blade.php │ ├── image │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── view.blade.php │ ├── key │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── view.blade.php │ ├── link │ │ ├── edit.blade.php │ │ └── index.blade.php │ ├── media │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── view.blade.php │ ├── number │ │ └── edit.blade.php │ ├── password │ │ └── edit.blade.php │ ├── phone │ │ ├── edit.blade.php │ │ └── index.blade.php │ ├── radio │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── view.blade.php │ ├── text │ │ └── edit.blade.php │ ├── textarea │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── view.blade.php │ ├── time │ │ ├── edit.blade.php │ │ └── index.blade.php │ └── translatable │ │ └── edit.blade.php │ ├── filters │ ├── date.blade.php │ ├── date_range.blade.php │ ├── enum.blade.php │ ├── number.blade.php │ └── text.blade.php │ ├── index │ ├── batch.blade.php │ ├── cell.blade.php │ ├── create.blade.php │ ├── export.blade.php │ ├── filters.blade.php │ ├── header.blade.php │ ├── index.blade.php │ ├── media.blade.php │ ├── paginator.blade.php │ ├── row.blade.php │ ├── row_actions.blade.php │ └── scopes.blade.php │ ├── layouts │ ├── app.blade.php │ ├── dashboard.blade.php │ ├── exportable.blade.php │ ├── popup.blade.php │ ├── print.blade.php │ └── settings.blade.php │ ├── media │ ├── index.blade.php │ ├── partials │ │ ├── actions.blade.php │ │ ├── dropzone.blade.php │ │ ├── file_info.blade.php │ │ ├── files.blade.php │ │ ├── folders.blade.php │ │ └── modals │ │ │ ├── _footer.blade.php │ │ │ ├── _header.blade.php │ │ │ ├── mkdir.blade.php │ │ │ ├── move.blade.php │ │ │ └── rename.blade.php │ └── scripts.blade.php │ ├── menus │ ├── sidebar.blade.php │ └── tools.blade.php │ ├── partials │ ├── actions.blade.php │ ├── breadcrumbs.blade.php │ ├── forms │ │ └── errors.blade.php │ ├── messages.blade.php │ ├── scripts.blade.php │ └── styles.blade.php │ ├── scripts │ └── editors.blade.php │ ├── translations │ └── index.blade.php │ └── view │ ├── create.blade.php │ ├── index.blade.php │ └── model.blade.php ├── sponsors.md ├── src ├── Actions │ ├── Collection.php │ ├── RemoveSelected.php │ └── SaveOrder.php ├── ActionsManager.php ├── AdminRequest.php ├── Annotations │ └── ScopeFilter.php ├── Architect.php ├── ArchitectRoutes.php ├── Auth │ └── SuperAdminRule.php ├── AuthUserProvider.php ├── Chain.php ├── Collection │ ├── Group.php │ └── Mutable.php ├── Console │ ├── ActionMakeCommand.php │ ├── ActionsMakeCommand.php │ ├── AdministratorCreateCommand.php │ ├── BreadcrumbsMakeCommand.php │ ├── FinderMakeCommand.php │ ├── LanguagesMakeCommand.php │ ├── PanelMakeCommand.php │ ├── PublishCommand.php │ ├── ResourceMakeCommand.php │ ├── SaverMakeCommand.php │ ├── SettingsMakeCommand.php │ ├── TemplateMakeCommand.php │ └── stubs │ │ ├── action.batch.stub │ │ ├── action.single.stub │ │ ├── actions.stub │ │ ├── breadcrumbs.stub │ │ ├── dashboard.panel.simple.stub │ │ ├── dashboard.panel.stub │ │ ├── finder.plain.stub │ │ ├── finder.stub │ │ ├── module.languages.stub │ │ ├── module.settings.stub │ │ ├── module.stub │ │ ├── saver.stub │ │ └── template.stub ├── Contracts │ ├── ActionsManager.php │ ├── AutoTranslatable.php │ ├── Chainable.php │ ├── Filter.php │ ├── Filter │ │ └── Searchable.php │ ├── Form │ │ ├── Element.php │ │ ├── HiddenElement.php │ │ ├── Queryable.php │ │ ├── Relationship.php │ │ └── Validable.php │ ├── Guard.php │ ├── Module.php │ ├── Module │ │ ├── Configurable.php │ │ ├── Editable.php │ │ ├── Exportable.php │ │ ├── Filtrable.php │ │ ├── Navigable.php │ │ ├── Queryable.php │ │ ├── Sortable.php │ │ └── Validable.php │ ├── QueryBuilder.php │ ├── Services │ │ ├── CrudActions.php │ │ ├── Finder.php │ │ ├── Saver.php │ │ ├── TemplateProvider.php │ │ └── Widgetable.php │ └── Sortable.php ├── Controllers │ ├── AdminController.php │ ├── AuthController.php │ ├── BatchController.php │ ├── DashboardController.php │ ├── MediaController.php │ ├── ScaffoldController.php │ ├── SettingsController.php │ └── TranslationsController.php ├── Dashboard │ ├── Factory.php │ ├── Manager.php │ ├── Panel.php │ ├── Panels │ │ ├── BlankPanel.php │ │ ├── DatabasePanel.php │ │ ├── GoogleAnalyticsPanel.php │ │ └── MembersPanel.php │ └── Row.php ├── Decorators │ └── Grid.php ├── Events │ └── TranslationsChanged.php ├── Exception.php ├── Exceptions │ ├── PermissionDeniedException.php │ ├── UnknownFieldTypeException.php │ └── WrongFieldAttributeException.php ├── Field │ ├── BelongsTo.php │ ├── BelongsToMany.php │ ├── Boolean.php │ ├── Checkbox.php │ ├── Date.php │ ├── DateTime.php │ ├── Detectors │ │ ├── AbstractDetector.php │ │ ├── BooleanDetector.php │ │ ├── CastedEnumDetector.php │ │ ├── DateTimeDetector.php │ │ ├── EmailDetector.php │ │ ├── EnumDetector.php │ │ ├── LinkDetector.php │ │ ├── NumberDetector.php │ │ ├── PasswordDetector.php │ │ ├── PhoneDetector.php │ │ ├── PrimaryKeyDetector.php │ │ ├── RankableDetector.php │ │ ├── TextDetector.php │ │ └── TextareaDetector.php │ ├── Email.php │ ├── Enum.php │ ├── Field.php │ ├── File.php │ ├── HasMany.php │ ├── HasOne.php │ ├── Hidden.php │ ├── Id.php │ ├── Image.php │ ├── Link.php │ ├── Media.php │ ├── Number.php │ ├── Password.php │ ├── Phone.php │ ├── Radio.php │ ├── Rank.php │ ├── Section.php │ ├── Text.php │ ├── Textarea.php │ ├── Time.php │ ├── Traits │ │ ├── AcceptsCustomFormat.php │ │ ├── AppliesSorting.php │ │ ├── HandlesRelation.php │ │ ├── HandlesVisibility.php │ │ ├── HasEmptyValue.php │ │ ├── HasValuePresenter.php │ │ └── SupportsMultipleValues.php │ └── Translatable.php ├── Filter.php ├── Filter │ ├── Date.php │ ├── DateRange.php │ ├── Enum.php │ ├── Filter.php │ ├── Number.php │ └── Text.php ├── Filters │ ├── Assembler.php │ └── Scope.php ├── Form │ └── Collection │ │ └── Mutable.php ├── Media │ ├── File.php │ ├── Icons.php │ └── MimeType.php ├── Middleware │ ├── AuthProvider.php │ ├── Authenticate.php │ ├── ProtectMedia.php │ ├── Resources.php │ ├── SanitizePaths.php │ └── Web.php ├── Modules │ ├── Faked.php │ └── Users.php ├── Navigation │ └── Presenters │ │ └── Bootstrap │ │ ├── NavbarPresenter.php │ │ └── SidebarMenuPresenter.php ├── PermissionChecker.php ├── Providers │ ├── ArtisanServiceProvider.php │ ├── ContainersServiceProvider.php │ ├── EventServiceProvider.php │ └── Handlers │ │ ├── PasswordsManager.php │ │ └── RouteManager.php ├── Requests │ ├── LoginRequest.php │ └── UpdateRequest.php ├── Scaffolding.php ├── Schema.php ├── ServiceProvider.php ├── Services │ ├── Breadcrumbs.php │ ├── Breadcrumbs │ │ └── EloquentPresenter.php │ ├── CrudActions.php │ ├── FileStorage.php │ ├── Finder.php │ ├── MediaLibraryProvider.php │ ├── Saver.php │ ├── Sorter.php │ ├── Template.php │ ├── Translations │ │ ├── Exporter.php │ │ ├── Finder.php │ │ └── Reader.php │ └── TranslationsManager.php ├── Traits │ ├── Actions │ │ ├── ActionSkeleton.php │ │ ├── BatchSkeleton.php │ │ └── Skeleton.php │ ├── AutoTranslatesInstances.php │ ├── CallableTrait.php │ ├── Collection │ │ └── ElementContainer.php │ ├── ContainsConfig.php │ ├── ExportsCollection.php │ ├── Form │ │ ├── ExecutesQuery.php │ │ ├── HasHtmlAttributes.php │ │ └── SupportsListTypes.php │ ├── MethodsCollector.php │ ├── Module │ │ ├── AllowFormats.php │ │ ├── AllowsNavigation.php │ │ ├── HasColumns.php │ │ ├── HasFilters.php │ │ ├── HasForm.php │ │ ├── HasOptions.php │ │ ├── HasSortable.php │ │ ├── ValidatesForm.php │ │ └── ValidatesOptions.php │ ├── Policy │ │ └── GrantsSuperPrivileges.php │ ├── ResolvesClasses.php │ ├── SessionGuardHelper.php │ ├── SortableTrait.php │ ├── SortsObjectsCollection.php │ └── Stringify.php └── helpers.php └── tests ├── Actions ├── CollectionTest.php ├── RemoveSelectedTest.php └── SaveOrderTest.php ├── Auth └── SuperAdminRuleTest.php ├── Collection ├── GroupTest.php └── MutableTest.php ├── Columns └── ElementTest.php ├── Controllers ├── AdminControllerTest.php └── AuthControllerTest.php ├── CoreTestCase.php ├── CreatesElement.php ├── Filter └── FilterElementTest.php ├── Form └── Collection │ └── FormCollectionMutableTest.php ├── MocksObjects.php └── bootstrap.php /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | composer.phar 3 | composer.lock 4 | .DS_Store 5 | .idea 6 | .phpunit.result.cache -------------------------------------------------------------------------------- /.scrutinizer.yml: -------------------------------------------------------------------------------- 1 | filter: 2 | excluded_paths: [tests/*] 3 | 4 | checks: 5 | php: 6 | remove_extra_empty_lines: true 7 | remove_php_closing_tag: true 8 | remove_trailing_whitespace: true 9 | fix_use_statements: 10 | remove_unused: true 11 | preserve_multiple: false 12 | preserve_blanklines: true 13 | order_alphabetically: true 14 | fix_php_opening_tag: true 15 | fix_linefeed: true 16 | fix_line_ending: true 17 | fix_identation_4spaces: true 18 | fix_doc_comments: true 19 | 20 | tools: 21 | external_code_coverage: true -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | env: 4 | global: 5 | - setup=stable 6 | 7 | matrix: 8 | fast_finish: true 9 | include: 10 | - php: 7.2 11 | # - php: 7.2 12 | # env: setup=lowest 13 | 14 | sudo: false 15 | 16 | cache: 17 | directories: 18 | - $HOME/.composer/cache 19 | 20 | before_install: 21 | - sudo apt-get install -y wget 22 | - travis_retry composer self-update 23 | 24 | install: 25 | - if [[ $setup = 'stable' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-stable --no-suggest; fi 26 | - if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-lowest --prefer-stable --no-suggest; fi 27 | 28 | script: 29 | - vendor/bin/phpunit --coverage-clover coverage.clover 30 | - wget https://scrutinizer-ci.com/ocular.phar 31 | - php ocular.phar code-coverage:upload --access-token="586a391e0912058c530126f8ebe237e7881c4010b61687d05706ab597c0a7a66" --format=php-clover coverage.clover 32 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Admin Architect 4 | 5 | > Permission is hereby granted, free of charge, to any person obtaining a copy 6 | > of this software and associated documentation files (the "Software"), to deal 7 | > in the Software without restriction, including without limitation the rights 8 | > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | > copies of the Software, and to permit persons to whom the Software is 10 | > furnished to do so, subject to the following conditions: 11 | > 12 | > The above copyright notice and this permission notice shall be included in 13 | > all copies or substantial portions of the Software. 14 | > 15 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | > THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Admin Architect 2 | 3 | [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/adminarchitect/core/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/adminarchitect/core/?branch=master) 4 | [![Latest Version on Packagist][ico-version]][link-packagist] 5 | [![Total Downloads][ico-downloads]][link-downloads] 6 | [![Latest Stable Version][ico-stable]][link-stable] 7 | [![Software License][ico-license]](LICENSE.md) 8 | [![Build Status](https://travis-ci.com/adminarchitect/core.svg?branch=master)](https://travis-ci.com/adminarchitect/core) 9 | 10 | Missing Laravel Administration Framework. It's like ActiveAdmin for Laravel. 11 | 12 | ### Docs 13 | 14 | [Follow the documentation.](http://docs.adminarchitect.com) 15 | 16 | ### License 17 | 18 | The Admin Architect is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). 19 | 20 | [ico-version]: https://img.shields.io/packagist/v/adminarchitect/core.svg?style=flat-square 21 | [ico-downloads]: https://img.shields.io/packagist/dt/adminarchitect/core.svg?style=flat-square 22 | [ico-stable]: https://poser.pugx.org/adminarchitect/core/version 23 | [ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square 24 | 25 | [link-packagist]: https://packagist.org/packages/adminarchitect/core 26 | [link-downloads]: https://packagist.org/packages/adminarchitect/core 27 | [link-stable]: https://packagist.org/packages/adminarchitect/core 28 | -------------------------------------------------------------------------------- /docs/Concept.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/Concept.pdf -------------------------------------------------------------------------------- /docs/Customization/breadcrumbs.md: -------------------------------------------------------------------------------- 1 | ## Breadcrumbs 2 | 3 | ![Admin Architect - Breadcrumbs](http://docs.adminarchitect.com/images/index/breadcrumbs.jpg) 4 | 5 | To build breadcrumbs Admin Architect uses [Laravel Breadcrumbs](https://github.com/davejamesmiller/laravel-breadcrumbs) package. 6 | 7 | Please checkout its documentation if you have any questions. 8 | 9 | As like as Template you are free to change the way how breadcrumbs are rendered by replacing default Breadcrumbs instance by your own: 10 | 11 | ```bash 12 | php artisan administrator:breadcrumbs Users 13 | ``` -------------------------------------------------------------------------------- /docs/Customization/templates.md: -------------------------------------------------------------------------------- 1 | ## Templates 2 | 3 | Sometimes, while developing complex applications, you'll need to change the default layout or partial view: Maybe you'll want to inline javascript, of add dynamic behavior for index page, or your edit/create form requires custom javascript libraries for more customization... 4 | 5 | Admin Architect comes with a solution called `Template`: All rendered pages are separated in a `replaceable` blocks. 6 | 7 | Template is registered per Resource, so if you want to customise your `index` view for `Users` resource, just create new template: 8 | 9 | ```bash 10 | php artisan administrator:template Users 11 | ``` 12 | 13 | ```php 14 | class Users extends Template implements TemplateProvider 15 | { 16 | /** 17 | * Scaffold index templates 18 | * 19 | * @param $partial 20 | * @return mixed array|string 21 | */ 22 | public function index($partial = 'index') 23 | { 24 | $partials = array_merge( 25 | parent::index(null), 26 | [ 27 | 'index' => 'admin.users.custom_index' 28 | ] 29 | ); 30 | 31 | return (null === $partial ? $partials : $partials[$partial]); 32 | } 33 | } 34 | ``` 35 | 36 | Admin Architect will search for a view `resources/views/admin/users/custom_index.blade.php` for index screen. 37 | 38 | For more details please checkout the Template class: `Terranet\Administrator\Services\Template`; 39 | -------------------------------------------------------------------------------- /docs/Features/media.md: -------------------------------------------------------------------------------- 1 | ## File Manager (Experimental) 2 | 3 | ![Admin Architect - Media](http://docs.adminarchitect.com/images/plugins/media.png) 4 | 5 | Very often you need the way to upload & attach various files to your web pages. 6 | For these purposes Admin Architect comes with a `File Manager` tool. 7 | 8 | To activate the `File Manager`, just set the `'file_manager' => true` in the `config/administrator.php`, 9 | also you're able to configure the main storage by setting `paths.media` option. 10 | 11 | `File Manager` allows you to create/rename/delete files & folders, upload/preview/download files. 12 | 13 | ### Bonus 14 | `File Manager`, `TinyMCE Image` & `Eloquent MediaLibrary` are connected altogether. 15 | So any image uploaded from `Media Library` or `TinyMCE Image`, will be available in `File Manager` -------------------------------------------------------------------------------- /docs/Features/settings.md: -------------------------------------------------------------------------------- 1 | ## Settings 2 | 3 | * *requires adminarchitect/options package* 4 | 5 | ![Admin Architect - Settings](http://docs.adminarchitect.com/images/plugins/settings.jpg) 6 | 7 | ### Installation 8 | 9 | In order to support settings within Admin Architect interface you'll need to install the `adminarchitect/options` package. 10 | 11 | Note: After installing it be sure the `Terranet\Options\ServiceProvider` is connected `before` the `Terranet\Administrator\ServiceProvider` in `config/app.php`. 12 | 13 | To create Options module run `php artisan administrator:resource:settings`. 14 | 15 | ### Storage 16 | 17 | To store application settings, `adminarchitect/options` module needs a table: 18 | 19 | Run the command `php artisan options:table` to create options table migration. 20 | 21 | Now, run `php artisan migrate` to create the table. 22 | 23 | ### Manage settings 24 | 25 | Add a setting by running `php artisan options:make []` 26 | 27 | Remove a setting by running `php artisan options:remove ` 28 | 29 | Enjoy! -------------------------------------------------------------------------------- /docs/Features/translations.md: -------------------------------------------------------------------------------- 1 | ## Translations Manager 2 | 3 | ![Admin Architect - Translations Manager](http://docs.adminarchitect.com/images/plugins/translations.png) 4 | 5 | Laravel translations come in a Developer friendly format - PHP arrays. But for real customers it's a simple nightmare! 6 | Admin Architect comes with a simple solution that allows your customers change translations any time. 7 | 8 | P.S. an event `\Terranet\Administrator\Events\TranslationsChanged` is fired when translations changed. 9 | It allows you to monitor the changes: run some tasks, like export to JS, etc... any time translations changed. -------------------------------------------------------------------------------- /docs/Forms/savers.md: -------------------------------------------------------------------------------- 1 | # Savers 2 | 3 | Admin Architect does a huge work to persist your model, presented by a Form. 4 | 5 | It also handles Images, Files, RelationShips, Translations, Media, etc... 6 | 7 | But somethimes it is not enough, you need a way to store your form data differently. 8 | 9 | For these cases we provide a Resource-dedicated service called: `Saver` 10 | 11 | ## Create saver 12 | 13 | Let's store our users differently 14 | 15 | ```bash 16 | php artisan administrator:saver Users 17 | ``` 18 | 19 | The Savers are stored in a `app\Http\Terranet\Administrator\Savers` directory 20 | There is one single public method `sync()` and a bunch of protected methods you might wish to verwrite. 21 | 22 | Let's say, we need to create a log record, once a User were saved: 23 | 24 | Note! Yes, we know, there is a better way to do it (using events, queued jobs, etc...), but just for a demonstration purpose, let's do it this way... 25 | 26 | ```php 27 | public function sync() 28 | { 29 | # preserve parent functionality 30 | parent::sync(); 31 | 32 | $admin = auth('admin')->user(); 33 | 34 | UserLog::create([ 35 | 'edited_by' => $admin->id, 36 | 'action' => 'save', 37 | 'data' => $this->request->all() 38 | ]); 39 | 40 | $this->repository->editors()->attach( 41 | $admin 42 | ); 43 | } 44 | ``` -------------------------------------------------------------------------------- /docs/Forms/validation.md: -------------------------------------------------------------------------------- 1 | ## Form Validation 2 | 3 | In order to validate the create/edit forms, Admin Architect provides a `Validable` interface with a single required method `rules`. 4 | 5 | Adding validation rules is nothing new, you can validate your forms, like you do it for regular Laravel Form Requests. 6 | 7 | Optionally you can define a `messages` method for custom validation messages. 8 | 9 | Let's say, your `app\Http\Terranet\Administrator\Modules\Users` module might have the following validation rules: 10 | ```php 11 | public function rules() 12 | { 13 | # rules, discovered by AA based on the table scheme. 14 | $discovered = $this->scaffoldRules(); 15 | 16 | $minDate = '...'; 17 | 18 | # add avatar validation rules. 19 | return array_merge($discovered, [ 20 | 'birth_date' => "date|after:{$someDate}", 21 | 'avatar' => 'image|dimensions:min_width=300,min_height=300|max:1024', 22 | ]); 23 | } 24 | 25 | # [optional] 26 | public function messages() 27 | { 28 | return [ 29 | 'avatar' => 'Can not process the :attribute. Please check the sizes.', 30 | ]; 31 | } 32 | ``` -------------------------------------------------------------------------------- /docs/Listing/finder.md: -------------------------------------------------------------------------------- 1 | ## Finder 2 | 3 | Every single Resource uses a class, called `Finder` - service that fetches (finds) the model's item(s). 4 | 5 | For simple resources it is more then enough, but, there are a lot of cases when you'll need your custom way to fetch the items. 6 | 7 | ### Create a finder 8 | 9 | To define a new way to find items, create a custom `Finder`. 10 | 11 | _Note! for simplicity follow the same naming convention - Give the same name as for Resource._ 12 | 13 | Let's say for our users Resource we need a different results. 14 | 15 | ```bash 16 | php artisan administrator:finder Users 17 | ``` 18 | 19 | Finder provides 2 important methods you migth wish to overwrite: 20 | 21 | * `fetchAll()` - finds all items, according with Scopes & Filters sets. 22 | * `find()` - finds a single item when it is going to be Edited or Deleted, etc... 23 | 24 | Note! instead of overwriting `fetchAll()` method, we recommend to overwrite the `getQuery()` method, which is used in different parts of Admin Architect, like Exportable collections. 25 | so, to complete our example: 26 | 27 | ```php 28 | # let's assume we need only active users in our grid 29 | protected function getQuery() 30 | { 31 | # calling the parent::getQuery() method is crucial part here 32 | # because it includes assembling of Scopes, Filters, Sortables, etc... 33 | return parent::getQuery()->whereNull('locked_at'); 34 | } 35 | ``` 36 | 37 | Now, the resulted collection of users will contain only active users. -------------------------------------------------------------------------------- /docs/Listing/pagination.md: -------------------------------------------------------------------------------- 1 | ## Pagination 2 | 3 | Like any other administration framework, Admin Architect provides a simple way to split big collections to pages. 4 | 5 | ![Admin Architect - Pagination](http://docs.adminarchitect.com/images/index/pagination.jpg) 6 | 7 | You can set the number of records fetched by default per resources: 8 | 9 | Default pagination perPage value is 20. 10 | 11 | if you want to change this value just rewrite `perPage` method in your Resource class. 12 | 13 | ``` 14 | public function perPage() 15 | { 16 | return 10; 17 | } 18 | ``` -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | ## Admin Architect 2 | ![Admin Architect](/app.png) 3 | 4 | > **Appreciate your time!** 5 | > 6 | > Your code can change the world! Stop spending weeks for building backend panels. 7 | > Replace your development cycle with a set of modern toolkits 8 | 9 | 10 | Admin Architect is a framework for creating administration interfaces. 11 | It abstracts common business application patterns to make it simple for developers to implement beautiful and elegant interfaces with very little effort. 12 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /docs/_navbar.md: -------------------------------------------------------------------------------- 1 | - [Homepage](http://adminarchitect.com) 2 | - [Get Started](/) 3 | - [Github](https://github.com/adminarchitect/core) 4 | - [Donate](https://www.patreon.com/adminarchitect) -------------------------------------------------------------------------------- /docs/_sidebar.md: -------------------------------------------------------------------------------- 1 | - Getting started 2 | - [Installation](GettingStarted/installation.md) 3 | - [Configuration](GettingStarted/configuration.md) 4 | - [Resources](GettingStarted/resources.md) 5 | 6 | - Listing Resources 7 | - [Grid](Listing/grid.md) 8 | - [Filtering Collection](Listing/filters.md) 9 | - [Actions](Listing/actions.md) 10 | - [Fetching Grid Items](Listing/finder.md) 11 | - [Pagination](Listing/pagination.md) 12 | - [Export Collections](Listing/exportable.md) 13 | - [Sort Collections](Listing/sortables.md) 14 | - [View Grid Item](Listing/view.md) 15 | - [Presenters](Listing/presenters.md) 16 | 17 | - Create/Edit Resource 18 | - [Forms](Forms/forms.md) 19 | - [Persisting Forms](Forms/savers.md) 20 | - [Form Validation](Forms/validation.md) 21 | 22 | - Customization 23 | - [Navigation](Customization/navigation.md) 24 | - [Dashboard](Customization/dashboard.md) 25 | - [Breadcrumbs](Customization/breadcrumbs.md) 26 | - [Custom Views](Customization/templates.md) 27 | 28 | - Features 29 | - [Settings](Features/settings.md) 30 | - [Multilingual Support](Features/multilanguage.md) 31 | - [File Manager](Features/media.md) 32 | - [Translations Manager](Features/translations.md) -------------------------------------------------------------------------------- /docs/app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/app.png -------------------------------------------------------------------------------- /docs/images/dashboard/dashboard.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/images/dashboard/dashboard.jpg -------------------------------------------------------------------------------- /docs/images/dashboard/overview.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/images/dashboard/overview.jpg -------------------------------------------------------------------------------- /docs/images/dashboard/registrations.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/images/dashboard/registrations.jpg -------------------------------------------------------------------------------- /docs/images/form/edit.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/images/form/edit.jpg -------------------------------------------------------------------------------- /docs/images/form/media.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/images/form/media.png -------------------------------------------------------------------------------- /docs/images/index/batch_actions.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/images/index/batch_actions.jpg -------------------------------------------------------------------------------- /docs/images/index/breadcrumbs.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/images/index/breadcrumbs.jpg -------------------------------------------------------------------------------- /docs/images/index/columns.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/images/index/columns.jpg -------------------------------------------------------------------------------- /docs/images/index/exports.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/images/index/exports.jpg -------------------------------------------------------------------------------- /docs/images/index/filters.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/images/index/filters.jpg -------------------------------------------------------------------------------- /docs/images/index/pagination.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/images/index/pagination.jpg -------------------------------------------------------------------------------- /docs/images/index/presenters.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/images/index/presenters.jpg -------------------------------------------------------------------------------- /docs/images/index/scopes.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/images/index/scopes.jpg -------------------------------------------------------------------------------- /docs/images/index/single_actions.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/images/index/single_actions.jpg -------------------------------------------------------------------------------- /docs/images/index/sortables.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/images/index/sortables.jpg -------------------------------------------------------------------------------- /docs/images/index/view_widgets.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/images/index/view_widgets.jpg -------------------------------------------------------------------------------- /docs/images/navigation/groups.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/images/navigation/groups.jpg -------------------------------------------------------------------------------- /docs/images/navigation/sidebar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/images/navigation/sidebar.jpg -------------------------------------------------------------------------------- /docs/images/navigation/tools.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/images/navigation/tools.jpg -------------------------------------------------------------------------------- /docs/images/plugins/media.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/images/plugins/media.png -------------------------------------------------------------------------------- /docs/images/plugins/multilingual.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/images/plugins/multilingual.png -------------------------------------------------------------------------------- /docs/images/plugins/settings.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/images/plugins/settings.jpg -------------------------------------------------------------------------------- /docs/images/plugins/translations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/docs/images/plugins/translations.png -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Admin Architect - Active Admin for Laravel 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/favicon.ico -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ./tests/ 7 | 8 | 9 | 10 | 11 | ./src 12 | 13 | 14 | ./src/ 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /publishes/Dashboard/BlankPanel.php: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |

Folders

5 |
6 |
7 | 21 |
22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /publishes/mix/resources/js/components/MediaPagination.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | -------------------------------------------------------------------------------- /publishes/mix/resources/js/components/index.js: -------------------------------------------------------------------------------- 1 | import MediaManager from './MediaManager.vue'; 2 | import MediaLibrary from './MediaLibrary.vue'; 3 | import MediaPagination from './MediaPagination'; 4 | import FoldersList from './Folders.vue'; 5 | import FilesList from './Files.vue'; 6 | import FileInfo from './FileInfo.vue'; 7 | import FileActions from './FileActions.vue'; 8 | import DropZone from './DropZone.vue'; 9 | import InstantSearch from './InstantSearch.vue'; 10 | import TagList from './fields/many_to_many/TagList.vue'; 11 | import DateTimePicker from './fields/DateTimePicker.vue'; 12 | 13 | export { 14 | MediaManager, 15 | MediaLibrary, 16 | MediaPagination, 17 | FoldersList, 18 | FilesList, 19 | FileInfo, 20 | FileActions, 21 | DropZone, 22 | InstantSearch, 23 | TagList, 24 | DateTimePicker 25 | } -------------------------------------------------------------------------------- /publishes/mix/resources/js/components/partials/ModalFooter.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 27 | 28 | -------------------------------------------------------------------------------- /publishes/mix/resources/js/components/partials/ModalHeader.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | -------------------------------------------------------------------------------- /publishes/mix/resources/js/components/partials/index.js: -------------------------------------------------------------------------------- 1 | import ModalHeader from './ModalHeader'; 2 | import ModalFooter from './ModalFooter'; 3 | 4 | export { 5 | ModalHeader, ModalFooter 6 | } -------------------------------------------------------------------------------- /publishes/mix/resources/js/components/popups/MkDir.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | -------------------------------------------------------------------------------- /publishes/mix/resources/js/components/popups/Rename.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 42 | -------------------------------------------------------------------------------- /publishes/mix/resources/js/components/popups/index.js: -------------------------------------------------------------------------------- 1 | import MkDir from './MkDir'; 2 | import Move from './Move'; 3 | import Rename from './Rename'; 4 | 5 | export {MkDir, Move, Rename}; -------------------------------------------------------------------------------- /publishes/mix/resources/js/editors/ckeditor.js: -------------------------------------------------------------------------------- 1 | require('ckeditor'); 2 | require('ckeditor/config'); 3 | require('ckeditor/adapters/jquery'); 4 | 5 | $(() => $('[data-editor="ckeditor"]').ckeditor()); 6 | -------------------------------------------------------------------------------- /publishes/mix/resources/js/editors/markdown.js: -------------------------------------------------------------------------------- 1 | const SimpleMDE = require('simplemde'); 2 | 3 | document.querySelectorAll('[data-editor="markdown"]').forEach((e) => { 4 | new SimpleMDE({element: e}); 5 | }); -------------------------------------------------------------------------------- /publishes/mix/resources/js/editors/medium.js: -------------------------------------------------------------------------------- 1 | new (require('medium-editor'))('[data-editor="medium"]'); -------------------------------------------------------------------------------- /publishes/mix/resources/js/editors/tinymce/plugins/image/index.js: -------------------------------------------------------------------------------- 1 | // Exports the "image" plugin for usage with module loaders 2 | // Usage: 3 | // CommonJS: 4 | // require('tinymce/plugins/image') 5 | // ES2015: 6 | // import 'tinymce/plugins/image' 7 | require('./plugin.js'); -------------------------------------------------------------------------------- /publishes/mix/resources/js/media/axios.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | import store from './store'; 3 | 4 | const $http = () => { 5 | axios.interceptors.response.use(response => { 6 | store.dispatch('response/set', response); 7 | 8 | return response; 9 | }, (error) => { 10 | store.dispatch('response/set', error.response); 11 | 12 | return error; 13 | }); 14 | 15 | return axios; 16 | }; 17 | 18 | export default $http; -------------------------------------------------------------------------------- /publishes/mix/resources/js/media/store/Response.js: -------------------------------------------------------------------------------- 1 | function emptyState() { 2 | return { 3 | data: {}, 4 | status: null, 5 | statusText: '' 6 | }; 7 | } 8 | 9 | const Response = { 10 | namespaced: true, 11 | 12 | state: emptyState(), 13 | 14 | mutations: { 15 | set(state, value) { 16 | state = Object.assign(state, value); 17 | }, 18 | }, 19 | 20 | actions: { 21 | set({commit}, value) { 22 | commit('set', value); 23 | 24 | setTimeout(() => { 25 | commit('set', emptyState()); 26 | }, 3000); 27 | }, 28 | }, 29 | 30 | getters: { 31 | success(state) { 32 | return String(state.status).match(/^20\d+/g); 33 | }, 34 | 35 | message(state) { 36 | return state.hasOwnProperty('data') && state.data.hasOwnProperty('message') 37 | ? state.data.message 38 | : state.statusText; 39 | }, 40 | }, 41 | }; 42 | 43 | export default Response; 44 | -------------------------------------------------------------------------------- /publishes/mix/resources/js/media/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import Vuex from 'vuex'; 3 | import selection from './Selection'; 4 | import response from './Response'; 5 | import storage from './Storage'; 6 | 7 | Vue.use(Vuex); 8 | 9 | const store = new Vuex.Store({ 10 | debug: true, 11 | modules: { 12 | selection, 13 | response, 14 | storage, 15 | }, 16 | }); 17 | 18 | export default store; -------------------------------------------------------------------------------- /publishes/mix/resources/js/vendor.js: -------------------------------------------------------------------------------- 1 | window.$ = window.jQuery = require('jquery'); 2 | window.fancybox = require('@fancyapps/fancybox'); 3 | 4 | require('bootstrap/js/dropdown'); 5 | require('bootstrap/js/tab'); 6 | require('bootstrap/js/carousel'); 7 | require('bootstrap/js/modal'); -------------------------------------------------------------------------------- /publishes/mix/resources/less/glyphicons.less: -------------------------------------------------------------------------------- 1 | @import "~bootstrap/less/mixins/vendor-prefixes"; 2 | @import "~bootstrap/less/mixins/opacity"; 3 | @import "~bootstrap/less/mixins/gradients"; 4 | @import "~bootstrap/less/variables"; 5 | @import "~bootstrap/less/glyphicons"; 6 | @import "~bootstrap/less/carousel"; 7 | -------------------------------------------------------------------------------- /publishes/mix/resources/sass/_angular.scss: -------------------------------------------------------------------------------- 1 | [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak { 2 | display: none !important; 3 | } -------------------------------------------------------------------------------- /publishes/mix/resources/sass/_dropzone.scss: -------------------------------------------------------------------------------- 1 | .media-drop-zone { 2 | flex-direction: column; 3 | height: 130px; 4 | display: flex; 5 | justify-content: center; 6 | align-items: center; 7 | } -------------------------------------------------------------------------------- /publishes/mix/resources/sass/_scaffold_index_actions.scss: -------------------------------------------------------------------------------- 1 | .table { 2 | th { 3 | a { 4 | color: #3b4354; 5 | } 6 | } 7 | } 8 | 9 | .actions { 10 | a { 11 | text-transform: uppercase; 12 | font-size: 11px; 13 | color: #636b6f; 14 | } 15 | } -------------------------------------------------------------------------------- /publishes/mix/resources/sass/app.scss: -------------------------------------------------------------------------------- 1 | @import "quirk"; 2 | @import "angular"; 3 | @import "dropzone"; 4 | @import "helpers"; 5 | @import 'scaffold_filters'; 6 | @import 'scaffold_index_actions'; -------------------------------------------------------------------------------- /publishes/mix/resources/sass/editors/markdown.scss: -------------------------------------------------------------------------------- 1 | @import "~simplemde/src/css/simplemde.css"; -------------------------------------------------------------------------------- /publishes/mix/resources/sass/editors/medium.scss: -------------------------------------------------------------------------------- 1 | @import "~medium-editor/dist/css/medium-editor.css"; 2 | @import "~medium-editor/dist/css/themes/default.css"; -------------------------------------------------------------------------------- /publishes/mix/resources/sass/vendor.scss: -------------------------------------------------------------------------------- 1 | @import '~font-awesome/scss/font-awesome'; 2 | @import "~@fancyapps/fancybox/dist/jquery.fancybox.css"; 3 | -------------------------------------------------------------------------------- /publishes/translations/en/actions.php: -------------------------------------------------------------------------------- 1 | [ 15 | // 'action' => 'Translation' 16 | // ], 17 | 18 | 'global' => [ 19 | // 'remove_selected' => 'Delete collection' 20 | ], 21 | ]; 22 | -------------------------------------------------------------------------------- /publishes/translations/en/buttons.php: -------------------------------------------------------------------------------- 1 | 'Create', 5 | 'create_item' => 'Create :resource', 6 | 'edit' => 'Edit', 7 | 'view' => 'View', 8 | 'view_more' => 'View More »', 9 | 'delete' => 'Delete', 10 | 'save' => 'Save', 11 | 'reset' => 'Reset', 12 | 'save_return' => 'Save & Return', 13 | 'save_create' => 'Save & Create new', 14 | 'download' => 'Download', 15 | 'search' => 'Search', 16 | 'remember_me' => 'Remember me', 17 | 'sign_in' => 'Sign me in', 18 | 'logout' => 'Logout', 19 | 'batch_actions' => 'Batch Actions', 20 | 'clear_filters' => 'Clear', 21 | 'media' => 'Media', 22 | 'translations' => 'Translations', 23 | 'upload' => 'Upload', 24 | 'attach' => '+ Attach new', 25 | 'next' => 'Next', 26 | 'previous' => 'Previous', 27 | 'true' => 'True', 28 | 'false' => 'False', 29 | 'search_modes' => [ 30 | 'contains' => 'Contains', 31 | 'not_contains' => 'Missing', 32 | 'equals' => 'Equals', 33 | 'not_equals' => 'Not', 34 | 'starts_with' => 'Starts With', 35 | 'ends_with' => 'Ends With', 36 | ], 37 | 'only_trashed' => 'Only Trashed', 38 | 'with_trashed' => 'With Trashed', 39 | 'any' => '--Any--', 40 | 'yes' => 'Yes', 41 | 'no' => 'No', 42 | ]; 43 | -------------------------------------------------------------------------------- /publishes/translations/en/columns.php: -------------------------------------------------------------------------------- 1 | [ 15 | // 'desc' => 'Hint' 16 | // ], 17 | 18 | 'global' => [ 19 | // 'desc' => 'Description', 20 | ], 21 | ]; 22 | -------------------------------------------------------------------------------- /publishes/translations/en/dashboard.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'header' => 'Database stats', 6 | 'header_engine' => 'Table / Engine', 7 | 'header_rows' => 'Rows', 8 | 'header_index' => 'Index Size', 9 | 'header_collation' => 'Collation', 10 | ], 11 | 'members' => [ 12 | 'header' => 'Members', 13 | 'header_total' => 'Total', 14 | 'header_signed_last_week' => 'Signed Last Week', 15 | 'header_signed_last_month' => 'Signed Last Month', 16 | 'header_members_per_day' => 'Members per day', 17 | ], 18 | ]; 19 | -------------------------------------------------------------------------------- /publishes/translations/en/enums.php: -------------------------------------------------------------------------------- 1 | [ 5 | // 'status' => [ 6 | // 'published' => 'Visible', 7 | // ] 8 | // ], 9 | 10 | 'global' => [ 11 | 'status' => [ 12 | // 'published' => 'Visible', 13 | ], 14 | ], 15 | ]; 16 | -------------------------------------------------------------------------------- /publishes/translations/en/errors.php: -------------------------------------------------------------------------------- 1 | 'This action is unauthorized.', 5 | 'login_failed' => 'Login attempt failed.', 6 | ]; 7 | -------------------------------------------------------------------------------- /publishes/translations/en/hints.php: -------------------------------------------------------------------------------- 1 | [ 15 | // 'desc' => 'Hint' 16 | // ], 17 | 18 | 'global' => [ 19 | 'optional' => 'Leave empty for default value', 20 | // 'desc' => 'Description', 21 | ], 22 | ]; 23 | -------------------------------------------------------------------------------- /publishes/translations/en/media.php: -------------------------------------------------------------------------------- 1 | 'Media', 5 | 'multiple_files_note' => 'Press Shift to select/deselect multiple files.', 6 | 'drag_drop_to_upload' => 'Drag & Drop files here
to upload.', 7 | 'files_selected' => 'file(s) selected.', 8 | 'no_files_found' => 'No files found.', 9 | 'folders' => 'Folders', 10 | 'info' => [ 11 | 'url' => 'URL', 12 | 'size' => 'Size', 13 | 'created_at' => 'Created at', 14 | 'updated_at' => 'Modified at', 15 | ], 16 | 'rename' => 'Rename file or folder', 17 | 'move' => 'Move files & folders', 18 | 'mkdir' => 'Create New Directory', 19 | 'files' => 'Files', 20 | 'dropzone' => 'Drop zone', 21 | 'file_info' => 'File info', 22 | 'buttons' => [ 23 | 'upload' => 'Upload', 24 | 'mkdir' => 'Make Directory', 25 | 'move' => 'Move', 26 | 'rename' => 'Rename', 27 | 'delete' => 'Delete', 28 | 'save' => 'Save', 29 | 'close' => 'Close', 30 | 'download' => 'Download', 31 | ], 32 | ]; 33 | -------------------------------------------------------------------------------- /publishes/translations/en/messages.php: -------------------------------------------------------------------------------- 1 | 'Item has been created.', 5 | 'update_success' => 'Item has been updated.', 6 | 'remove_success' => 'Item was removed successfully', 7 | 'attachment_remove_success' => 'Attachment was removed successfully', 8 | 'action_success' => 'Action performed successfully', 9 | 'confirm_deletion' => 'Are you sure you want to delete this item?', 10 | ]; 11 | -------------------------------------------------------------------------------- /publishes/translations/en/module.php: -------------------------------------------------------------------------------- 1 | 'Administration panel', 5 | 'success' => 'Success!', 6 | 'error' => 'Error!', 7 | 'settings' => 'Settings', 8 | 'actions' => 'Actions', 9 | 'login' => 'Sign In', 10 | 'dashboard' => 'Dashboard', 11 | 'filters' => 'Filters', 12 | 'credentials' => [ 13 | 'email' => 'Email', 14 | 'username' => 'Username', 15 | 'password' => 'Password', 16 | ], 17 | 'resources' => [ 18 | 'users' => 'Users', 19 | 'languages' => 'Languages', 20 | 'translations' => 'Translations', 21 | 'settings' => 'Settings', 22 | ], 23 | 'groups' => [ 24 | 'resources' => 'Resources', 25 | 'localization' => 'Localization', 26 | ], 27 | 'action' => [ 28 | 'create' => 'Create :resource', 29 | 'edit' => ':instance', 30 | 'view' => ':instance', 31 | ], 32 | ]; 33 | -------------------------------------------------------------------------------- /publishes/translations/en/scopes.php: -------------------------------------------------------------------------------- 1 | setTitle() method, just add your 10 | | scope here. Scopes having global name can be defined also. 11 | */ 12 | 13 | return [ 14 | // 'some_module' => [ 15 | // 'scope' => 'Title' 16 | // ], 17 | 18 | 'global' => [ 19 | 'all' => 'All', 20 | ], 21 | ]; 22 | -------------------------------------------------------------------------------- /publishes/views/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adminarchitect/core/bba2859b691fa4bedf32d8783aac49da5f09038c/publishes/views/.gitkeep -------------------------------------------------------------------------------- /publishes/views/components/index/table.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ $headers ?? '' }} 5 | 6 | 7 | 8 | 9 | {{ $rows ?? '' }} 10 | 11 |
12 | -------------------------------------------------------------------------------- /publishes/views/components/table/group.blade.php: -------------------------------------------------------------------------------- 1 | 2 |   3 | 4 | 5 | 6 | {{ $title }} 7 | 8 | 9 | 10 | {{ $elements ?? '' }} -------------------------------------------------------------------------------- /publishes/views/components/table/header.blade.php: -------------------------------------------------------------------------------- 1 | 2 | {{ $title ?? '' }} 3 | -------------------------------------------------------------------------------- /publishes/views/components/table/row.blade.php: -------------------------------------------------------------------------------- 1 | @if (isset($section) && $section) 2 | @component('administrator::components.table.spacer') 3 | @endcomponent 4 | 5 | {{ strip_tags($label) }} 6 | 7 | 8 | {!! $input ?? '' !!} 9 | 10 | @component('administrator::components.table.spacer') 11 | @endcomponent 12 | @else 13 | 14 | @if(!empty($label)) 15 | 16 | {!! $label ?? '' !!} 17 | @if (isset($description) && !empty($description)) 18 |

{!! $description !!}

19 | @endif 20 | 21 | @endif 22 | {!! $input ?? '' !!} 23 | 24 | @endif 25 | -------------------------------------------------------------------------------- /publishes/views/components/table/spacer.blade.php: -------------------------------------------------------------------------------- 1 | 2 |   3 | -------------------------------------------------------------------------------- /publishes/views/dashboard/database.blade.php: -------------------------------------------------------------------------------- 1 |
2 |
3 |

4 | {{ trans('administrator::dashboard.database.header') }} 5 |

6 |
7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | @foreach($dbStats as $table) 17 | 18 | 22 | 23 | 24 | 25 | 26 | @endforeach 27 |
{{ trans('administrator::dashboard.database.header_engine') }}{{ trans('administrator::dashboard.database.header_rows') }}{{ trans('administrator::dashboard.database.header_index') }}{{ trans('administrator::dashboard.database.header_collation') }}
19 | {{ $table->Name }} 20 | [{{ $table->Engine }}] 21 | {{ $table->Rows }}{{ round($table->Index_length/pow(1024, 2), 2) }} MB{{ $table->Collation }}
28 |
29 | 30 |
-------------------------------------------------------------------------------- /publishes/views/dashboard/widgets.blade.php: -------------------------------------------------------------------------------- 1 | @foreach($widgets as $section) 2 |
3 | @foreach($section as $panel) 4 |
5 | {!! $panel->render() !!} 6 |
7 | @endforeach 8 |
9 | @endforeach -------------------------------------------------------------------------------- /publishes/views/edit/actions.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 11 | @if ($resource->actions()->authorize('create')) 12 | 16 | @endif 17 | 18 | 19 | -------------------------------------------------------------------------------- /publishes/views/edit/create.blade.php: -------------------------------------------------------------------------------- 1 | @unless($resource->actions()->readonly()) 2 | @if ($item && $item->exists) 3 |
4 | @if ($resource->actions()->authorize('view', $item)) 5 | 7 | 8 | 9 | @endif 10 | 11 | @if ($resource->actions()->authorize('create')) 12 | 14 | 15 | 16 | @endif 17 | 18 | @if ($resource->actions()->authorize('delete', $item)) 19 | 22 | 23 | 24 | @endif 25 |
26 | @endif 27 | @endunless 28 | -------------------------------------------------------------------------------- /publishes/views/edit/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends($resource->template()->layout()) 2 | 3 | @section('scaffold.create') 4 | @include($resource->template()->edit('create')) 5 | @endsection 6 | 7 | @section('scaffold.content') 8 | @php($form = $resource->form()) 9 |
10 |
11 | @php($form->each->setModel($item)) 12 | 13 | {!! Form::model($item, ['method' => 'post', 'files' => true]) !!} 14 | @foreach($form->visibleOnPage(\Terranet\Administrator\Scaffolding::PAGE_EDIT)->filter(function($item) { 15 | return $item instanceof \Terranet\Administrator\Field\Hidden; 16 | }) as $hidden) 17 | {!! $hidden->render(\Terranet\Administrator\Scaffolding::PAGE_EDIT) !!} 18 | @endforeach 19 | 20 | @each($resource->template()->edit('row'), $form->visibleOnPage(\Terranet\Administrator\Scaffolding::PAGE_EDIT), 'field') 21 | 22 | @unless($resource->actions()->readonly()) 23 | @include($resource->template()->edit('actions')) 24 | @endunless 25 |
26 | {!! Form::close() !!} 27 |
28 |
29 | @stop 30 | 31 | @include($resource->template()->edit('scripts')) 32 | -------------------------------------------------------------------------------- /publishes/views/edit/row.blade.php: -------------------------------------------------------------------------------- 1 | @if ($field instanceof \Terranet\Administrator\Field\Media) 2 | 3 | @elseif ($field instanceof \Terranet\Administrator\Field\Hidden) 4 | 5 | @elseif ($field instanceof \Terranet\Administrator\Collection\Group) 6 | @component('administrator::components.table.group') 7 | @slot('title', $field->title()) 8 | @slot('elements') 9 | @each('administrator::edit.row', $field->elements(), 'field') 10 | @endslot 11 | @endcomponent 12 | @elseif ($field instanceof \Terranet\Administrator\Field\Section) 13 | 14 | {{ $field->title() }} 15 | 16 | @else 17 | @component('administrator::components.table.row', [ 18 | 'section' => $field instanceof \Terranet\Administrator\Field\HasOne || $field instanceof \Terranet\Administrator\Field\BelongsToMany 19 | ]) 20 | @slot('label', Form::label($field->id(), $field->title())) 21 | @slot('description', $field->getDescription()) 22 | @slot('input', $field->render(\Terranet\Administrator\Scaffolding::PAGE_EDIT)) 23 | @endcomponent 24 | @endif 25 | -------------------------------------------------------------------------------- /publishes/views/edit/scripts.blade.php: -------------------------------------------------------------------------------- 1 | @push('scaffold.js') 2 | @include($resource->template()->scripts('editors')) 3 | @endpush 4 | -------------------------------------------------------------------------------- /publishes/views/errors/404.blade.php: -------------------------------------------------------------------------------- 1 | @extends($resource->template()->layout()) 2 | 3 | @section('content') 4 |
5 |

404

6 |
7 |

Oops! Page not found.

8 |

9 | We could not find the page you were looking for. 10 | Meanwhile, you may return to dashboard or try using the search form. 11 |

12 |
13 |
14 | @endsection 15 | -------------------------------------------------------------------------------- /publishes/views/fields/belongs_to/edit.blade.php: -------------------------------------------------------------------------------- 1 | @if (!$searchable) 2 | {!! Form::select($field->name(), $options, optional($field->value())->getKey(), $attributes) !!} 3 | @endif 4 | 5 | @if ($searchable && $searchIn) 6 | 11 | @endif 12 | -------------------------------------------------------------------------------- /publishes/views/fields/belongs_to/index.blade.php: -------------------------------------------------------------------------------- 1 | @if ($title) 2 | @if ($module) 3 | 6 | {{ \Illuminate\Support\Str::limit($title, 25) }} 7 | 8 | @else 9 | 10 | {{ \Illuminate\Support\Str::limit($title, 25) }} 11 | 12 | @endif 13 | @endif 14 | -------------------------------------------------------------------------------- /publishes/views/fields/belongs_to/view.blade.php: -------------------------------------------------------------------------------- 1 | @include('administrator::fields.belongs_to.index') -------------------------------------------------------------------------------- /publishes/views/fields/belongs_to_many/edit.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | @if (\Terranet\Administrator\Field\BelongsToMany::MODE_TAGS === $editMode) 4 | 10 | @elseif(\Terranet\Administrator\Field\BelongsToMany::MODE_CHECKBOXES === $editMode) 11 |
    12 | @foreach($values as $related) 13 |
  • 14 | 20 |
  • 21 | @endforeach 22 |
23 | @endif 24 | 25 | 26 | -------------------------------------------------------------------------------- /publishes/views/fields/belongs_to_many/index.blade.php: -------------------------------------------------------------------------------- 1 | @include('administrator::fields.has_many.index') -------------------------------------------------------------------------------- /publishes/views/fields/belongs_to_many/view.blade.php: -------------------------------------------------------------------------------- 1 | @include('administrator::fields.has_many.view') -------------------------------------------------------------------------------- /publishes/views/fields/boolean/edit.blade.php: -------------------------------------------------------------------------------- 1 | {!! Form::hidden($field->name(), 0, ['id' => Form::getIdAttribute($field->id(), []).'_hidden']) !!} 2 | {!! Form::checkbox($field->name(), 1) !!} -------------------------------------------------------------------------------- /publishes/views/fields/boolean/index.blade.php: -------------------------------------------------------------------------------- 1 | 2 |   3 | {{ ($isTrue ? trans('administrator::buttons.true') : trans('administrator::buttons.false')) }} 4 | 5 | -------------------------------------------------------------------------------- /publishes/views/fields/boolean/view.blade.php: -------------------------------------------------------------------------------- 1 | @include('administrator::fields.boolean.index') -------------------------------------------------------------------------------- /publishes/views/fields/checkbox/edit.blade.php: -------------------------------------------------------------------------------- 1 | @foreach($options as $optionValue => $optionLabel) 2 | 6 | @endforeach 7 | -------------------------------------------------------------------------------- /publishes/views/fields/checkbox/index.blade.php: -------------------------------------------------------------------------------- 1 | 2 | {{ $options[$field->value()] }} 3 | -------------------------------------------------------------------------------- /publishes/views/fields/checkbox/view.blade.php: -------------------------------------------------------------------------------- 1 | {!! $options[$field->value()] !!} 2 | -------------------------------------------------------------------------------- /publishes/views/fields/date/edit.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /publishes/views/fields/date/index.blade.php: -------------------------------------------------------------------------------- 1 | @include('administrator::fields.date_time.index') -------------------------------------------------------------------------------- /publishes/views/fields/date_time/edit.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /publishes/views/fields/date_time/index.blade.php: -------------------------------------------------------------------------------- 1 | @php($color = \Illuminate\Support\Str::contains($field->id(), ['delete', 'destroy', 'erase', 'remove']) ? 'danger' : 'default') 2 | 3 | {{ $formatted }} 4 | 5 | -------------------------------------------------------------------------------- /publishes/views/fields/email/edit.blade.php: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | {!! Form::email($field->name(), $field->value(), $attributes) !!} 6 |
7 | -------------------------------------------------------------------------------- /publishes/views/fields/email/index.blade.php: -------------------------------------------------------------------------------- 1 | @if ($value = $field->value()) 2 | 3 | {{ \Illuminate\Support\Str::limit($value, 25) }} 4 | 5 | @endif 6 | -------------------------------------------------------------------------------- /publishes/views/fields/enum/edit.blade.php: -------------------------------------------------------------------------------- 1 | @if ('datalist' === $field->type) 2 | {!! Form::text($field->name(), $field->value(), ['id' => $field->id(), 'class' => 'form-control', 'list' => "scaffold_{$field->id()}"]) !!} 3 | {!! Form::datalist("scaffold_{$field->id()}", $field->options) !!} 4 | @else 5 | {{ Form::select($field->name(), $field->options ?? [], $field->value(), ['class' => 'form-control', 'multiple' => $field->isArray] + $field->getAttributes()) }} 6 | @endif 7 | 8 | -------------------------------------------------------------------------------- /publishes/views/fields/enum/index.blade.php: -------------------------------------------------------------------------------- 1 | 2 | {{ ($field->value() ? \Illuminate\Support\Arr::get($field->options, $field->value()) : '---') }} 3 | 4 | -------------------------------------------------------------------------------- /publishes/views/fields/enum/view.blade.php: -------------------------------------------------------------------------------- 1 | @include('administrator::fields.enum.index') 2 | -------------------------------------------------------------------------------- /publishes/views/fields/file/edit.blade.php: -------------------------------------------------------------------------------- 1 | @if ($attachment && $attachment->exists()) 2 | 3 |  {{ $attachment->originalFilename() }} 4 | 5 | 6 | 15 | @else 16 | {!! Form::file($field->name(), []) !!} 17 | @endif 18 | -------------------------------------------------------------------------------- /publishes/views/fields/file/index.blade.php: -------------------------------------------------------------------------------- 1 | @php($value = $field->value()) 2 | @if ($value->exists()) 3 | 4 | {{ trans('administrator::buttons.download') }} 5 | 6 | @endif -------------------------------------------------------------------------------- /publishes/views/fields/file/view.blade.php: -------------------------------------------------------------------------------- 1 | @php($value = $field->value()) 2 | @if ($value->exists()) 3 |

{{ $value->originalFilename() }}

4 | 5 |  {{ trans('administrator::buttons.download') }} 6 | 7 | @endif 8 | -------------------------------------------------------------------------------- /publishes/views/fields/has_many/edit.blade.php: -------------------------------------------------------------------------------- 1 | Not implemented 2 | -------------------------------------------------------------------------------- /publishes/views/fields/has_many/index.blade.php: -------------------------------------------------------------------------------- 1 | @if ($count) 2 | 3 | @if ($url) 4 | 5 |  {{ $count }} 6 | 7 | @else 8 |  {{ $count }} 9 | @endif 10 | 11 | @endif 12 | -------------------------------------------------------------------------------- /publishes/views/fields/has_many/view.blade.php: -------------------------------------------------------------------------------- 1 | @if ($module) 2 | @component('administrator::components.index.table') 3 | @slot('headers') 4 | @each('administrator::index.header', $columns->visibleOnPage('index'), 'column') 5 | @unless($actions->readonly() || $module instanceof \Terranet\Administrator\Modules\Faked) 6 | 7 | @endunless 8 | @endslot 9 | 10 | @slot('rows') 11 | @forelse($items as $item) 12 | 13 | @foreach($columns = $columns->visibleOnPage('index') as $column) 14 | 15 | @include('administrator::index.cell', ['column' => $column, 'item' => $item]) 16 | 17 | @endforeach 18 | @unless($actions->readonly() || $module instanceof \Terranet\Administrator\Modules\Faked) 19 | 20 | @include('administrator::index.row_actions', ['actions' => $actions, 'module' => $module]) 21 | 22 | @endunless 23 | 24 | @empty 25 | 26 | No data 27 | 28 | @endforelse 29 | @endslot 30 | @endcomponent 31 | @endif -------------------------------------------------------------------------------- /publishes/views/fields/has_one/edit.blade.php: -------------------------------------------------------------------------------- 1 | @foreach($columns as $field) 2 | @include('administrator::edit.row', ['field' => $field]) 3 | @endforeach 4 | -------------------------------------------------------------------------------- /publishes/views/fields/has_one/index.blade.php: -------------------------------------------------------------------------------- 1 | @php($page = \Terranet\Administrator\Scaffolding::PAGE_INDEX) 2 | 3 |
    4 | @foreach($columns->visibleOnPage($page) as $column) 5 |
  • 6 | {{ $column->title() }}: {!! $column->render($page) !!} 7 |
  • 8 | @endforeach 9 |
10 | -------------------------------------------------------------------------------- /publishes/views/fields/has_one/view.blade.php: -------------------------------------------------------------------------------- 1 | @php($page = \Terranet\Administrator\Scaffolding::PAGE_VIEW) 2 | 3 | @foreach($columns->visibleOnPage($page) as $column) 4 | @if ($column instanceof \Terranet\Administrator\Field\Section) 5 | 6 | {{ $column->title() }} 7 | 8 | @endif 9 | @component('administrator::components.table.row') 10 | @slot('label', Form::label($column->id(), $column->title())) 11 | @slot('description', $column->getDescription()) 12 | @slot('input', $column->render($page)) 13 | @endcomponent 14 | @endforeach 15 | -------------------------------------------------------------------------------- /publishes/views/fields/hidden/edit.blade.php: -------------------------------------------------------------------------------- 1 | {!! Form::hidden($field->name(), $field->value(), $attributes) !!} 2 | -------------------------------------------------------------------------------- /publishes/views/fields/image/edit.blade.php: -------------------------------------------------------------------------------- 1 | @if ($attachment && $attachment->exists()) 2 |

3 | 7 | 8 | 9 |

10 | 11 | @foreach($attachment->variants() as $variant) 12 | 13 | {{ $variant }} 14 |    15 | 16 | @endforeach 17 | 18 | 27 | @else 28 | {!! Form::file($field->name(), []) !!} 29 | @endif 30 | -------------------------------------------------------------------------------- /publishes/views/fields/image/index.blade.php: -------------------------------------------------------------------------------- 1 | $field->id(), 4 | 'class' => 'img-circle', 5 | 'width' => 60, 6 | 'height' => 60, 7 | ]; 8 | ?> 9 | {!! \admin\output\staplerImage($attachment, 'original', $attributes) !!} 10 | -------------------------------------------------------------------------------- /publishes/views/fields/image/view.blade.php: -------------------------------------------------------------------------------- 1 | $field->id(), 4 | 'class' => 'img-responsive', 5 | 'style' => 'max-width: 400px; max-height: 400px;', 6 | ]; 7 | ?> 8 | {!! \admin\output\staplerImage($attachment, 'original', $attributes) !!} -------------------------------------------------------------------------------- /publishes/views/fields/key/edit.blade.php: -------------------------------------------------------------------------------- 1 | {!! $field->value() !!} -------------------------------------------------------------------------------- /publishes/views/fields/key/index.blade.php: -------------------------------------------------------------------------------- 1 | {{ $field->value() }} -------------------------------------------------------------------------------- /publishes/views/fields/key/view.blade.php: -------------------------------------------------------------------------------- 1 | {!! $field->value() !!} -------------------------------------------------------------------------------- /publishes/views/fields/link/edit.blade.php: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | {!! Form::text($field->name(), $field->value(), $attributes) !!} 6 |
7 | -------------------------------------------------------------------------------- /publishes/views/fields/link/index.blade.php: -------------------------------------------------------------------------------- 1 | @if ($value = $field->value()) 2 | 3 | {{ \Illuminate\Support\Str::limit($value, 25) }} 4 | 5 | @endif 6 | -------------------------------------------------------------------------------- /publishes/views/fields/media/edit.blade.php: -------------------------------------------------------------------------------- 1 | 9 | -------------------------------------------------------------------------------- /publishes/views/fields/media/index.blade.php: -------------------------------------------------------------------------------- 1 | @if ($count) 2 | 3 | 4 |  {{$count}} 5 | 6 | 7 | @endif -------------------------------------------------------------------------------- /publishes/views/fields/media/view.blade.php: -------------------------------------------------------------------------------- 1 | @php($endpoint = route('scaffold.fetch_media', [ 2 | 'module' => app('scaffold.module')->url(), 3 | 'id' => app('scaffold.model')->id 4 | ])) 5 | 6 | 11 | -------------------------------------------------------------------------------- /publishes/views/fields/number/edit.blade.php: -------------------------------------------------------------------------------- 1 | {!! Form::input('number', $field->name(), $field->value(), $attributes) !!} -------------------------------------------------------------------------------- /publishes/views/fields/password/edit.blade.php: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | {!! Form::password($field->name(), $attributes) !!} 6 |
-------------------------------------------------------------------------------- /publishes/views/fields/phone/edit.blade.php: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | {!! Form::tel($field->name(), $field->value(), $attributes) !!} 6 |
-------------------------------------------------------------------------------- /publishes/views/fields/phone/index.blade.php: -------------------------------------------------------------------------------- 1 | @if ($value = $field->value()) 2 | {{$value}} 3 | @endif -------------------------------------------------------------------------------- /publishes/views/fields/radio/edit.blade.php: -------------------------------------------------------------------------------- 1 | @foreach($field->options as $optionValue => $optionLabel) 2 | 6 | @endforeach 7 | -------------------------------------------------------------------------------- /publishes/views/fields/radio/index.blade.php: -------------------------------------------------------------------------------- 1 | 2 | {{ $options[$field->value()] }} 3 | -------------------------------------------------------------------------------- /publishes/views/fields/radio/view.blade.php: -------------------------------------------------------------------------------- 1 | {!! $options[$field->value()] !!} 2 | -------------------------------------------------------------------------------- /publishes/views/fields/text/edit.blade.php: -------------------------------------------------------------------------------- 1 | {!! Form::text($field->name(), $field->value(), $attributes) !!} 2 | -------------------------------------------------------------------------------- /publishes/views/fields/textarea/edit.blade.php: -------------------------------------------------------------------------------- 1 | @php($attributes = [ 2 | 'class' => 'form-control', 3 | 'data-editor' => $dataEditor ?? '' 4 | ]) 5 | {!! Form::textarea($field->name(), $field->value(), $attributes) !!} 6 | -------------------------------------------------------------------------------- /publishes/views/fields/textarea/index.blade.php: -------------------------------------------------------------------------------- 1 | @if (!empty($value = $field->value())) 2 | {{ \Illuminate\Support\Str::limit(strip_tags($value), 200) }} 3 | @endif 4 | -------------------------------------------------------------------------------- /publishes/views/fields/textarea/view.blade.php: -------------------------------------------------------------------------------- 1 | @if (!empty($value = $field->value())) 2 | @php($preview = \Illuminate\Support\Str::limit(strip_tags($value), 200)) 3 | @php($full = strip_tags($value)) 4 |
{!! nl2br($preview) !!}
5 | @if (mb_strlen($full) !== mb_strlen($preview)) 6 | 7 | {!! trans('administrator::buttons.view_more') !!} 8 | 9 | 10 | 11 | @push('scaffold.js') 12 | 20 | @endpush 21 | @endif 22 | @endif 23 | -------------------------------------------------------------------------------- /publishes/views/fields/time/edit.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /publishes/views/fields/time/index.blade.php: -------------------------------------------------------------------------------- 1 | @include('administrator::fields.date_time.index') -------------------------------------------------------------------------------- /publishes/views/filters/date.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /publishes/views/filters/date_range.blade.php: -------------------------------------------------------------------------------- 1 | value() && is_array($field->value()) 3 | ? $field->value() 4 | : ['from' => '', 'to' => ''] 5 | ); 6 | ?> 7 | 14 | -------------------------------------------------------------------------------- /publishes/views/filters/enum.blade.php: -------------------------------------------------------------------------------- 1 | @if ('datalist' === $field->type) 2 | {!! Form::text($field->name(), $field->value(), ['id' => $field->id(), 'list' => "scaffold_{$field->id()}"] + $attributes) !!} 3 | {!! Form::datalist("scaffold_{$field->id()}", $field->options) !!} 4 | @else 5 | {{ Form::select($field->name(), ($field->isArray ? [] : ['' => "—"]) + ($field->options ?? []), $field->value(), ['multiple' => $field->isArray] + $attributes) }} 6 | @endif 7 | 8 | -------------------------------------------------------------------------------- /publishes/views/filters/number.blade.php: -------------------------------------------------------------------------------- 1 | {{ Form::number($field->name(), $field->value(), $attributes) }} 2 | -------------------------------------------------------------------------------- /publishes/views/filters/text.blade.php: -------------------------------------------------------------------------------- 1 | @if (!empty($modes)) 2 |
3 | @php($modeName = $field->name() . '_mode') 4 |
5 | {!! Form::select($modeName, $modes, request($modeName)) !!} 6 |
7 | {{ Form::text($field->name(), $field->value(), $attributes) }} 8 |
9 | @else 10 | {{ Form::text($field->name(), $field->value(), $attributes) }} 11 | @endif 12 | -------------------------------------------------------------------------------- /publishes/views/index/batch.blade.php: -------------------------------------------------------------------------------- 1 | @if (count($batch = $resource->actions()->batch()->authorized())) 2 |
3 | 7 | 12 |
13 | @endif 14 | 15 | -------------------------------------------------------------------------------- /publishes/views/index/cell.blade.php: -------------------------------------------------------------------------------- 1 | @if($column instanceof \Terranet\Administrator\Collection\Group) 2 |
    3 | @foreach($column->elements() as $element) 4 | @if($value = $element->setModel($item)->render()) 5 |
  • 6 | @if ($element->isHiddenLabel()) 7 | {!! $value !!} 8 | @else 9 | 10 | {!! $value !!} 11 | @endif 12 |
  • 13 | @endif 14 | @endforeach 15 |
16 | @else 17 | {!! $column->setModel($item)->render() !!} 18 | @endif 19 | -------------------------------------------------------------------------------- /publishes/views/index/create.blade.php: -------------------------------------------------------------------------------- 1 | @unless($resource->actions()->readonly()) 2 | @section('scaffold.create') 3 |
4 | @if ($resource->actions()->authorize('create')) 5 | 7 | 8 | {{ trans('administrator::buttons.create') }} 9 | 10 | @endif 11 |
12 | @endsection 13 | @endunless 14 | -------------------------------------------------------------------------------- /publishes/views/index/export.blade.php: -------------------------------------------------------------------------------- 1 | @if (\admin\helpers\exportable($resource) && !empty($formats = $resource->formats())) 2 | $title) { 4 | if (is_numeric($format)) { 5 | $format = $title; 6 | $title = str_replace('_', ' ', $format); 7 | } 8 | $title = mb_strtoupper($title); 9 | $links[] = link_to($resource->makeExportableUrl($format), $title); 10 | } 11 | ?> 12 |
13 | {{ trans('administrator::buttons.download') }}: {!! join(" | ", $links) !!} 14 |
15 | @endif 16 | -------------------------------------------------------------------------------- /publishes/views/index/header.blade.php: -------------------------------------------------------------------------------- 1 | 2 | @if ($resource->sortableManager()->canSortBy($column->id())) 3 | {{ $column->title() }} 4 | {!! ($resource->sortableManager()->element() == $column->id() 5 | ? '' 6 | : '') !!} 7 | @else 8 | {{ $column->title() }} 9 | @endif 10 | 11 | -------------------------------------------------------------------------------- /publishes/views/index/media.blade.php: -------------------------------------------------------------------------------- 1 | 31 | -------------------------------------------------------------------------------- /publishes/views/index/paginator.blade.php: -------------------------------------------------------------------------------- 1 | {!! $items->appends(\Request::query())->render() !!} 2 | -------------------------------------------------------------------------------- /publishes/views/index/row.blade.php: -------------------------------------------------------------------------------- 1 | 2 | @if ($resource->actions()->batch()->count() && !$resource->actions()->readonly()) 3 | 4 | 12 | 13 | @endif 14 | @foreach($columns->visibleOnPage('index') as $column) 15 | 16 | @include('administrator::index.cell', ['column' => $column, 'item' => $item]) 17 | 18 | @endforeach 19 | 20 | @unless($resource->actions()->readonly()) 21 | 22 | @include('administrator::index.row_actions', ['actions' => $resource->actions(), 'module' => $resource]) 23 | 24 | @endunless 25 | 26 | -------------------------------------------------------------------------------- /publishes/views/index/row_actions.blade.php: -------------------------------------------------------------------------------- 1 | @if ($resource->actions()->authorize('view', $item)) 2 | 4 |   5 | 6 | @endif 7 | @if ($resource->actions()->authorize('update', $item)) 8 | 10 |   11 | 12 | @endif 13 | @if ($resource->actions()->authorize('delete', $item)) 14 | 17 |   18 | 19 | @endif 20 | 21 | @if ($customActions = $resource->actions()->actions()->authorized(auth('admin')->user(), $item)) 22 |
    23 | @foreach($customActions as $action) 24 | @unless ($action->hideFromIndex()) 25 |
  • 26 | {!! $action->render($item) !!} 27 |
  • 28 | @endunless 29 | @endforeach 30 |
31 | @endif 32 | -------------------------------------------------------------------------------- /publishes/views/index/scopes.blade.php: -------------------------------------------------------------------------------- 1 | @if ($scopes = $filter->scopes()) 2 | @foreach($scopes as $scope) 3 | 5 | {!! (($icon = $scope->icon()) ? '' : '') !!} {{ $scope->title() }} 6 | 7 | @endforeach 8 | @endif 9 | -------------------------------------------------------------------------------- /publishes/views/layouts/dashboard.blade.php: -------------------------------------------------------------------------------- 1 | @extends(\Terranet\Administrator\Architect::template()->layout()) 2 | 3 | @section('scaffold.content') 4 | @include('administrator::dashboard.widgets', ['widgets' => app('scaffold.dashboard')]) 5 | @endsection 6 | -------------------------------------------------------------------------------- /publishes/views/layouts/popup.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ trans('administrator::media.title') }} 5 | 6 | 7 | 8 | 9 | @include('administrator::partials.styles') 10 | 11 | @stack('scaffold.css') 12 | @stack('scaffold.headjs') 13 | 14 | 15 |
16 | @yield('scaffold.content') 17 |
18 | 19 | @include('administrator::partials.scripts') 20 | @stack('scaffold.js') 21 | 22 | 23 | -------------------------------------------------------------------------------- /publishes/views/layouts/print.blade.php: -------------------------------------------------------------------------------- 1 | @inject('config', 'scaffold.config') 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | {{ strip_tags($config->get('title')) }} 12 | @if (isset($resource) && ($title = $resource->title())) 13 | » {{ $title }} 14 | @endif 15 | 16 | 17 | @include('administrator::partials.styles') 18 | @stack('scaffold.css') 19 | 20 | 21 | 22 |
23 |
24 | @yield('scaffold.content') 25 |
26 |
27 | 28 | 29 | -------------------------------------------------------------------------------- /publishes/views/layouts/settings.blade.php: -------------------------------------------------------------------------------- 1 | @extends($resource->template()->layout()) 2 | 3 | @section('module_header') 4 | {{ $resource->title() }} 5 | @stop 6 | 7 | @section('scaffold.content') 8 | @php($form = $resource->form()) 9 | {!! Form::open() !!} 10 | 11 | @foreach($form as $field) 12 | 13 | 19 | 22 | 23 | @endforeach 24 | 25 | 26 | 30 | 31 |
14 | {!! Form::label($field->name(), $field->title()) !!}: 15 | @if ($description = $field->getDescription()) 16 |

{!! $description !!}

17 | @endif 18 |
20 | {!! $field->render(\Terranet\Administrator\Scaffolding::PAGE_EDIT) !!} 21 |
27 | 29 |
32 | 33 | {!! Form::close() !!} 34 | @stop 35 | -------------------------------------------------------------------------------- /publishes/views/media/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends(\Terranet\Administrator\Architect::template()->layout($popup ? 'popup' : 'app')) 2 | 3 | @inject('config', 'scaffold.config') 4 | 5 | @push('scaffold.headjs') 6 | @include('administrator::media.scripts') 7 | @endpush 8 | 9 | @section('scaffold.content') 10 |

{{ trans('administrator::media.title') }}

11 | 12 | {!! $breadcrumbs !!} 13 | 14 |
15 | 16 |
17 | @append 18 | -------------------------------------------------------------------------------- /publishes/views/media/partials/actions.blade.php: -------------------------------------------------------------------------------- 1 |
2 |
3 | 6 | 9 |
10 |
11 | 14 | 15 | 18 | 19 | 22 |
23 |
-------------------------------------------------------------------------------- /publishes/views/media/partials/files.blade.php: -------------------------------------------------------------------------------- 1 |
2 |
3 |

{{ trans('administrator::media.no_files_found') }}

4 |
5 | 6 |
7 |
8 |
9 |
10 | 14 |
15 | 16 |
17 |
@{{ file.basename }}
18 | Created: @{{ file.createdAt }} 19 | @{{ file.size }} Bytes 20 |
21 |
22 |
23 |
24 |
25 | -------------------------------------------------------------------------------- /publishes/views/media/partials/folders.blade.php: -------------------------------------------------------------------------------- 1 |
2 |
3 |

{{ trans('administrator::media.folders') }}

4 |
5 |
6 | 20 |
21 |
-------------------------------------------------------------------------------- /publishes/views/media/partials/modals/_footer.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /publishes/views/media/partials/modals/_header.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /publishes/views/media/partials/modals/mkdir.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /publishes/views/media/partials/modals/move.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /publishes/views/media/partials/modals/rename.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /publishes/views/media/scripts.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /publishes/views/menus/sidebar.blade.php: -------------------------------------------------------------------------------- 1 | {!! app('scaffold.navigation')->render('sidebar', '\Terranet\Administrator\Navigation\Presenters\Bootstrap\SidebarMenuPresenter') !!} -------------------------------------------------------------------------------- /publishes/views/menus/tools.blade.php: -------------------------------------------------------------------------------- 1 | user(); 3 | $pict = asset('/admin/images/admin.png'); 4 | ?> 5 |
  • 6 |
    7 | 13 | 14 | {!! app('scaffold.navigation')->render('tools', '\Terranet\Administrator\Navigation\Presenters\Bootstrap\NavbarPresenter') !!} 15 |
    16 |
  • -------------------------------------------------------------------------------- /publishes/views/partials/actions.blade.php: -------------------------------------------------------------------------------- 1 | @if ($resource->actions()->authorize('delete', $item)) 2 |
    3 | {!! link_to(route('scaffold.delete', ['module' => $resource, 'id' => $item->getKey()]), trans('administrator::buttons.delete'), ['class' => "btn btn-danger", 'onclick' => "return confirm('Are you sure?')"]) !!} 4 |
    5 | @endif 6 | @if ($resource->actions()->authorize('update', $item)) 7 |
    8 | {!! link_to(route('scaffold.edit', ['module' => $resource, 'id' => $item->getKey()]), trans('administrator::buttons.edit'), ['class' => "btn btn-warning"]) !!} 9 |
    10 | @endif 11 | -------------------------------------------------------------------------------- /publishes/views/partials/breadcrumbs.blade.php: -------------------------------------------------------------------------------- 1 | @if ($breadcrumbs) 2 | 23 | @endif 24 | -------------------------------------------------------------------------------- /publishes/views/partials/forms/errors.blade.php: -------------------------------------------------------------------------------- 1 | @if (! empty($errors)) 2 |
      3 | @foreach($errors as $error) 4 |
    • {{ $error }}
    • 5 | @endforeach 6 |
    7 | @endif -------------------------------------------------------------------------------- /publishes/views/partials/messages.blade.php: -------------------------------------------------------------------------------- 1 | 2 | @if (isset($errors) && $errors->count()) 3 | 9 | @endif 10 | 11 | 12 | @if (Session::has('messages')) 13 | 19 | @endif 20 | -------------------------------------------------------------------------------- /publishes/views/partials/scripts.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /publishes/views/partials/styles.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | @if(file_exists(public_path($icons = 'glyphicons.css'))) 5 | 6 | @endif -------------------------------------------------------------------------------- /publishes/views/view/create.blade.php: -------------------------------------------------------------------------------- 1 | @unless($resource->actions()->readonly()) 2 |
    3 | @foreach($resource->actions()->actions()->authorized(auth('admin')->user(), $item) as $action) 4 | @unless ($action->hideFromView()) 5 | {!! $action->renderBtn($item) !!} 6 | @endunless 7 | @endforeach 8 | 9 | @if ($resource->actions()->authorize('update', $item)) 10 | 12 | 13 | 14 | @endif 15 | @if ($resource->actions()->authorize('delete', $item)) 16 | 19 | 20 | 21 | @endif 22 |
    23 | @endunless 24 | -------------------------------------------------------------------------------- /publishes/views/view/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends($resource->template()->layout()) 2 | 3 | @php($actions = $resource->actions()) 4 | 5 | @section('scaffold.create') 6 | @include($resource->template()->view('create')) 7 | @endsection 8 | 9 | @section('scaffold.content') 10 |
    11 |
    12 |
    13 |
    14 | @include($resource->template()->view('model'), $item) 15 |
    16 |
    17 |
    18 |
    19 | 20 | @include('administrator::dashboard.widgets', ['widgets' => $resource->widgets()]) 21 | @append 22 | -------------------------------------------------------------------------------- /sponsors.md: -------------------------------------------------------------------------------- 1 | ### Admin Architect Patrons 2 | 3 | We would like to send our thanks to the following sponsors for helping fund on-going Admin Architect development. 4 | If you are interested in becoming a sponsor, please visit the [Admin Architect Patreon page](https://www.patreon.com/adminarchitect). 5 | -------------------------------------------------------------------------------- /src/Actions/SaveOrder.php: -------------------------------------------------------------------------------- 1 | syncRanking($request->get($eloquent->getRankableColumn(), [])); 25 | } 26 | 27 | protected function icon() 28 | { 29 | return 'fa-sort'; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/AdminRequest.php: -------------------------------------------------------------------------------- 1 | resource()->finder()) { 36 | abort_unless($item = $finder->find($id), 404); 37 | } 38 | 39 | return $item ?? null; 40 | }); 41 | } 42 | 43 | /** 44 | * Resolve resource based on router parameters. 45 | * 46 | * @return null|Module 47 | */ 48 | public function resource(): ?Module 49 | { 50 | return once(function () { 51 | return tap(Architect::resourceForKey($this->route()->parameter('module')), function ($resource) { 52 | abort_if(is_null($resource), 404); 53 | }); 54 | }); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Annotations/ScopeFilter.php: -------------------------------------------------------------------------------- 1 | userProvider(); 12 | 13 | if (!$user) { 14 | return false; 15 | } 16 | 17 | if (method_exists($user, 'isSuperAdmin')) { 18 | return \call_user_func([$user, 'isSuperAdmin']); 19 | } 20 | 21 | return 1 === (int) $user->getAuthIdentifier(); 22 | } 23 | 24 | /** 25 | * @return null|Authenticatable 26 | */ 27 | protected function userProvider() 28 | { 29 | return auth('admin')->user(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Chain.php: -------------------------------------------------------------------------------- 1 | &$instance) { 18 | if ($next = Arr::get($queue, $i + 1)) { 19 | $instance->setNext($next); 20 | } 21 | } 22 | 23 | return Arr::first($queue); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Console/ActionsMakeCommand.php: -------------------------------------------------------------------------------- 1 | Hello, World! 23 |
    24 |

    Check me out here [{$class}]

    25 |
    26 | OUT; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Console/stubs/dashboard.panel.stub: -------------------------------------------------------------------------------- 1 | with([]); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Console/stubs/finder.plain.stub: -------------------------------------------------------------------------------- 1 | getQuery()->paginate($this->perPage()); 17 | } 18 | 19 | /** 20 | * Find a record by id 21 | * 22 | * @param $id 23 | * @param array $columns 24 | * @return mixed 25 | */ 26 | public function find($id, $columns = ['*']) 27 | { 28 | $this->model = $this->model->newQueryWithoutScopes()->findOrFail($id, $columns); 29 | 30 | return $this->model; 31 | } 32 | } -------------------------------------------------------------------------------- /src/Console/stubs/module.stub: -------------------------------------------------------------------------------- 1 | layout('dashboard')); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Dashboard/Factory.php: -------------------------------------------------------------------------------- 1 | dashboard = $dashboard; 17 | } 18 | 19 | public function make() 20 | { 21 | return $this->registerPanels(); 22 | } 23 | 24 | /** 25 | * Register dashboard panels. 26 | * 27 | * @return Manager 28 | */ 29 | abstract protected function registerPanels(); 30 | } 31 | -------------------------------------------------------------------------------- /src/Dashboard/Manager.php: -------------------------------------------------------------------------------- 1 | rows[] = $row; 23 | 24 | return $this; 25 | } 26 | 27 | /** 28 | * @return \ArrayIterator|\Traversable 29 | */ 30 | public function getIterator(): \ArrayIterator 31 | { 32 | return new \ArrayIterator($this->rows); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Dashboard/Panel.php: -------------------------------------------------------------------------------- 1 | validateWidth($width); 14 | 15 | $this->width = (int) $width; 16 | 17 | return $this; 18 | } 19 | 20 | public function width() 21 | { 22 | return $this->width; 23 | } 24 | 25 | /** 26 | * @param $width 27 | * 28 | * @throws \Exception 29 | */ 30 | protected function validateWidth($width) 31 | { 32 | if (!\in_array($width, range(1, 12, 1), true)) { 33 | throw new \Exception('Width must be between 1 and 12.'); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Dashboard/Panels/BlankPanel.php: -------------------------------------------------------------------------------- 1 | 22 |
    23 |

    Welcome to AdminArchitect.

    24 |
    25 |
    26 |

    27 | This is the default dashboard page. 28 | To manage dashboard panels, review \App\Http\Terranet\Administrator\Dashboard\Factory class. 29 |

    30 |
    31 | 32 | OUT; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Dashboard/Panels/DatabasePanel.php: -------------------------------------------------------------------------------- 1 | getDatabaseStats(); 17 | 18 | return view(Architect::template()->dashboard('database'), [ 19 | 'dbStats' => $dbStats, 20 | ]); 21 | } 22 | 23 | /** 24 | * @return mixed 25 | */ 26 | protected function getDatabaseStats() 27 | { 28 | if (connection('mysql')) { 29 | $query = $this->connection()->raw('SHOW TABLE STATUS')->getValue($this->connection()->getQueryGrammar()); 30 | return $this->connection()->select($query); 31 | } 32 | 33 | return collect([]); 34 | } 35 | 36 | protected function connection() 37 | { 38 | return app('db'); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Dashboard/Row.php: -------------------------------------------------------------------------------- 1 | panels[] = $panel; 14 | 15 | return $panel; 16 | } 17 | 18 | /** 19 | * Retrieve an external iterator. 20 | * 21 | * @see http://php.net/manual/en/iteratoraggregate.getiterator.php 22 | * 23 | * @return Traversable An instance of an object implementing Iterator or 24 | * Traversable 25 | * 26 | * @since 5.0.0 27 | */ 28 | public function getIterator() 29 | { 30 | return new \ArrayIterator($this->panels); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Events/TranslationsChanged.php: -------------------------------------------------------------------------------- 1 | locales = $locales; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Exception.php: -------------------------------------------------------------------------------- 1 | trueValue = $value; 21 | 22 | return $this; 23 | } 24 | 25 | /** 26 | * @param $value 27 | * 28 | * @return $this 29 | */ 30 | public function falseValue($value): self 31 | { 32 | $this->falseValue = $value; 33 | 34 | return $this; 35 | } 36 | 37 | /** 38 | * @return bool 39 | */ 40 | public function isTrue(): bool 41 | { 42 | return $this->value() === $this->trueValue; 43 | } 44 | 45 | /** 46 | * @return array 47 | */ 48 | public function onIndex(): array 49 | { 50 | return ['isTrue' => $this->isTrue()]; 51 | } 52 | 53 | /** 54 | * @return array 55 | */ 56 | public function onView(): array 57 | { 58 | return $this->onIndex(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/Field/Checkbox.php: -------------------------------------------------------------------------------- 1 | getType() instanceof BooleanType; 24 | } 25 | 26 | /** 27 | * Detect field class. 28 | * 29 | * @param string $column 30 | * @param Column $metadata 31 | * @param Model $model 32 | * 33 | * @return mixed 34 | */ 35 | protected function detect(string $column, Column $metadata, Model $model) 36 | { 37 | return Boolean::class; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Field/Detectors/CastedEnumDetector.php: -------------------------------------------------------------------------------- 1 | getNotnull()); 24 | } 25 | 26 | /** 27 | * Detect field class. 28 | * 29 | * @param string $column 30 | * @param Column $metadata 31 | * @param Model $model 32 | * 33 | * @return mixed 34 | */ 35 | protected function detect(string $column, Column $metadata, Model $model) 36 | { 37 | return Enum::make($column)->setOptions( 38 | Architect::castedEnumValues($model, $column, !$metadata->getNotNull()) 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Field/Detectors/DateTimeDetector.php: -------------------------------------------------------------------------------- 1 | getType()), [ 25 | TimeType::class, 26 | DateType::class, 27 | DateTimeType::class, 28 | ], true); 29 | } 30 | 31 | /** 32 | * Detect field class. 33 | * 34 | * @param string $column 35 | * @param Column $metadata 36 | * @param Model $model 37 | * 38 | * @return mixed 39 | */ 40 | protected function detect(string $column, Column $metadata, Model $model) 41 | { 42 | $className = class_basename($metadata->getType()); 43 | 44 | $type = str_replace('Type', '', $className); 45 | 46 | return "\\Terranet\\Administrator\\Field\\{$type}"; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Field/Detectors/EmailDetector.php: -------------------------------------------------------------------------------- 1 | getType() instanceof StringType && Str::contains($column, 'email'); 25 | } 26 | 27 | /** 28 | * Detect field class. 29 | * 30 | * @param string $column 31 | * @param Column $metadata 32 | * @param Model $model 33 | * 34 | * @return mixed 35 | */ 36 | protected function detect(string $column, Column $metadata, Model $model) 37 | { 38 | return Email::class; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Field/Detectors/LinkDetector.php: -------------------------------------------------------------------------------- 1 | getType() instanceof StringType && Str::contains($column, ['url', 'site', 'host']); 25 | } 26 | 27 | /** 28 | * Detect field class. 29 | * 30 | * @param string $column 31 | * @param Column $metadata 32 | * @param Model $model 33 | * 34 | * @return mixed 35 | */ 36 | protected function detect(string $column, Column $metadata, Model $model) 37 | { 38 | return Link::class; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Field/Detectors/NumberDetector.php: -------------------------------------------------------------------------------- 1 | getType()); 29 | 30 | return in_array($class, [ 31 | IntegerType::class, 32 | DecimalType::class, 33 | FloatType::class, 34 | BigIntType::class, 35 | SmallIntType::class, 36 | ]); 37 | } 38 | 39 | /** 40 | * Detect field class. 41 | * 42 | * @param string $column 43 | * @param Column $metadata 44 | * @param Model $model 45 | * 46 | * @return mixed 47 | */ 48 | protected function detect(string $column, Column $metadata, Model $model) 49 | { 50 | return Number::class; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Field/Detectors/PasswordDetector.php: -------------------------------------------------------------------------------- 1 | getType() instanceof StringType && Str::contains($column, 'password'); 25 | } 26 | 27 | /** 28 | * Detect field class. 29 | * 30 | * @param string $column 31 | * @param Column $metadata 32 | * @param Model $model 33 | * 34 | * @return mixed 35 | */ 36 | protected function detect(string $column, Column $metadata, Model $model) 37 | { 38 | return Password::class; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Field/Detectors/PhoneDetector.php: -------------------------------------------------------------------------------- 1 | getType() instanceof StringType && Str::contains($column, ['phone', 'gsm']); 25 | } 26 | 27 | /** 28 | * Detect field class. 29 | * 30 | * @param string $column 31 | * @param Column $metadata 32 | * @param Model $model 33 | * 34 | * @return mixed 35 | */ 36 | protected function detect(string $column, Column $metadata, Model $model) 37 | { 38 | return Phone::class; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Field/Detectors/PrimaryKeyDetector.php: -------------------------------------------------------------------------------- 1 | getKeyName(); 23 | } 24 | 25 | /** 26 | * Detect field class. 27 | * 28 | * @param string $column 29 | * @param Column $metadata 30 | * @param Model $model 31 | * 32 | * @return mixed 33 | */ 34 | protected function detect(string $column, Column $metadata, Model $model) 35 | { 36 | return Id::class; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Field/Detectors/RankableDetector.php: -------------------------------------------------------------------------------- 1 | getRankableColumn(); 23 | } 24 | 25 | /** 26 | * Detect field class. 27 | * 28 | * @param string $column 29 | * @param Column $metadata 30 | * @param Model $model 31 | * 32 | * @return mixed 33 | */ 34 | protected function detect(string $column, Column $metadata, Model $model) 35 | { 36 | return Rank::class; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Field/Detectors/TextDetector.php: -------------------------------------------------------------------------------- 1 | getType() instanceof TextType; 24 | } 25 | 26 | /** 27 | * Detect field class. 28 | * 29 | * @param string $column 30 | * @param Column $metadata 31 | * @param Model $model 32 | * 33 | * @return mixed 34 | */ 35 | protected function detect(string $column, Column $metadata, Model $model) 36 | { 37 | return Textarea::class; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Field/Email.php: -------------------------------------------------------------------------------- 1 | 'width: 250px'] + parent::getAttributes(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Field/File.php: -------------------------------------------------------------------------------- 1 | true, 11 | Scaffolding::PAGE_EDIT => true, 12 | Scaffolding::PAGE_VIEW => true, 13 | ]; 14 | 15 | public function onEdit(): array 16 | { 17 | return $this->onIndex(); 18 | } 19 | 20 | public function onView(): array 21 | { 22 | return $this->onIndex(); 23 | } 24 | 25 | protected function onIndex(): array 26 | { 27 | return [ 28 | 'attachment' => $this->model ? $this->model->{$this->id} : null, 29 | ]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Field/Hidden.php: -------------------------------------------------------------------------------- 1 | collection = $collection; 26 | 27 | return $this; 28 | } 29 | 30 | /** 31 | * @param string $conversion 32 | * 33 | * @return self 34 | */ 35 | public function convertedTo(string $conversion): self 36 | { 37 | $this->conversion = $conversion; 38 | 39 | return $this; 40 | } 41 | 42 | protected function onIndex(): array 43 | { 44 | return [ 45 | 'count' => MediaLibraryProvider::forModel($this->model)->count($this->collection), 46 | 'module' => Architect::resourceByEntity($this->model) ?: app('scaffold.module'), 47 | ]; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Field/Number.php: -------------------------------------------------------------------------------- 1 | 'width: 150px'] + parent::getAttributes(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Field/Password.php: -------------------------------------------------------------------------------- 1 | trans('administrator::hints.global.optional'), 14 | 'autocomplete' => 'off', 15 | ]; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Field/Phone.php: -------------------------------------------------------------------------------- 1 | 'width: 250px'] + parent::getAttributes(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Field/Radio.php: -------------------------------------------------------------------------------- 1 | options; 13 | } 14 | 15 | /** 16 | * @param array $options 17 | * 18 | * @return self 19 | */ 20 | public function setOptions(array $options): self 21 | { 22 | $this->options = $options; 23 | 24 | return $this; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Field/Rank.php: -------------------------------------------------------------------------------- 1 | false, 12 | Scaffolding::PAGE_EDIT => true, 13 | Scaffolding::PAGE_VIEW => true, 14 | ]; 15 | } 16 | -------------------------------------------------------------------------------- /src/Field/Text.php: -------------------------------------------------------------------------------- 1 | format; 18 | } 19 | 20 | /** 21 | * @param Closure $format 22 | * 23 | * @return self 24 | */ 25 | public function renderAs(Closure $format): self 26 | { 27 | $this->format = $format; 28 | 29 | return $this; 30 | } 31 | 32 | /** 33 | * @param $args 34 | * 35 | * @return mixed 36 | */ 37 | protected function callFormatter(...$args) 38 | { 39 | return $this->format->call($this, ...$args); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Field/Traits/AppliesSorting.php: -------------------------------------------------------------------------------- 1 | orderBy("{$model->getTable()}.{$this->id()}", $direction); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Field/Traits/HandlesRelation.php: -------------------------------------------------------------------------------- 1 | model, $this->id]); 16 | } 17 | 18 | /** 19 | * Finds a module this relation belongs to. 20 | * 21 | * @return null| 22 | */ 23 | public function relationModule(): ?Module 24 | { 25 | return Architect::resourceByEntity( 26 | $this->relation()->getRelated() 27 | ); 28 | } 29 | 30 | /** 31 | * @param $relation 32 | * @return mixed 33 | */ 34 | public function getForeignKey($relation) 35 | { 36 | if (method_exists($relation, 'getForeignKey')) { 37 | return $relation->getForeignKey(); 38 | } 39 | 40 | if (method_exists($relation, 'getForeignKeyName')) { 41 | return $relation->getForeignKeyName(); 42 | } 43 | 44 | if (method_exists($relation, 'getForeignPivotKeyName')) { 45 | return $relation->getForeignPivotKeyName(); 46 | } 47 | 48 | throw new \Exception("Unable to resolve foreign key."); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Field/Traits/HandlesVisibility.php: -------------------------------------------------------------------------------- 1 | when ? $this->when->call($this, request()) : true; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Field/Traits/HasEmptyValue.php: -------------------------------------------------------------------------------- 1 | allowEmpty = (bool) $flag; 16 | 17 | return $this; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Field/Traits/HasValuePresenter.php: -------------------------------------------------------------------------------- 1 | present(), $method = $this->presenterMethod($field)) 23 | ? [$model->present(), $method] 24 | : null; 25 | } 26 | 27 | /** 28 | * @param callable $presenter 29 | * 30 | * @return mixed 31 | */ 32 | public function callPresenter(callable $presenter) 33 | { 34 | return \call_user_func_array($presenter, [$this->value()]); 35 | } 36 | 37 | /** 38 | * @param string $fieldName 39 | * 40 | * @return string 41 | */ 42 | public function presenterMethod(string $fieldName): string 43 | { 44 | return 'admin'.Str::title(Str::camel($fieldName)); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Field/Traits/SupportsMultipleValues.php: -------------------------------------------------------------------------------- 1 | isArray = true; 12 | 13 | return $this; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Filter/Date.php: -------------------------------------------------------------------------------- 1 | whereDate("{$model->getTable()}.{$this->id()}", '=', $this->value()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Filter/DateRange.php: -------------------------------------------------------------------------------- 1 | value()); 23 | 24 | if ($dateFrom && $dateTo) { 25 | $query->whereDate("{$model->getTable()}.{$this->id()}", '>=', $dateFrom); 26 | $query->whereDate("{$model->getTable()}.{$this->id()}", '<=', $dateTo); 27 | } 28 | 29 | return $query; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Filter/Number.php: -------------------------------------------------------------------------------- 1 | where("{$model->getTable()}.{$this->id()}", '=', (int) $this->value()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Media/Icons.php: -------------------------------------------------------------------------------- 1 | 'fa fa-folder-open-o', 11 | 'Pdf' => 'fa fa-file-pdf-o', 12 | 'Code' => 'fa fa-file-code-o', 13 | 'Excel' => 'fa fa-file-excel-o', 14 | 'Word' => 'fa fa-file-word-o', 15 | 'PowerPoint' => 'fa fa-file-powerpoint-o', 16 | 'Archive' => 'fa fa-file-archive-o', 17 | 'Image' => 'fa fa-file-image-o', 18 | 'Audio' => 'fa fa-file-audio-o', 19 | 'Movie' => 'fa fa-file-video-o', 20 | ]; 21 | 22 | public function table() 23 | { 24 | return array_keys(static::$table); 25 | } 26 | 27 | public function icon($group) 28 | { 29 | return Arr::get(static::$table, $group, 'fa fa-file-text-o'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Middleware/AuthProvider.php: -------------------------------------------------------------------------------- 1 | shouldUse('admin'); 24 | 25 | return $next($request); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Middleware/ProtectMedia.php: -------------------------------------------------------------------------------- 1 | setModel($model); 22 | 23 | return $module; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Modules/Users.php: -------------------------------------------------------------------------------- 1 | model); 28 | 29 | return new $model(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Navigation/Presenters/Bootstrap/NavbarPresenter.php: -------------------------------------------------------------------------------- 1 | '.PHP_EOL; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/PermissionChecker.php: -------------------------------------------------------------------------------- 1 | callback($permission); 22 | } 23 | 24 | return (bool) $permission; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Providers/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | handlers as $handler) { 25 | app($handler)->handle(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Providers/Handlers/RouteManager.php: -------------------------------------------------------------------------------- 1 | matched(function (RouteMatched $event) { 13 | if (!$this->isAdminArea($event)) { 14 | return false; 15 | } 16 | 17 | $route = $event->route; 18 | $request = $event->request; 19 | 20 | if ($route->parameter('module')) { 21 | return true; 22 | } 23 | if ($resolver = app('scaffold.config')->get('resource.resolver')) { 24 | $module = \call_user_func_array($resolver, [$route, $request]); 25 | } else { 26 | $module = $request->segment(app('scaffold.config')->get('resource.segment', 2)); 27 | } 28 | 29 | $route->setParameter('module', $module); 30 | 31 | return $module; 32 | }); 33 | } 34 | 35 | /** 36 | * Check if running under admin area. 37 | * 38 | * @param RouteMatched $event 39 | * 40 | * @return bool 41 | */ 42 | protected function isAdminArea(RouteMatched $event) 43 | { 44 | if ($action = $event->route->getAction()) { 45 | return config('administrator.prefix') === Arr::get($action, 'prefix'); 46 | } 47 | 48 | return false; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Requests/LoginRequest.php: -------------------------------------------------------------------------------- 1 | get('auth.identity', 'username'); 30 | $credential = $config->get('auth.credential', 'password'); 31 | 32 | return [ 33 | $identity => 'required', 34 | $credential => 'required', 35 | ]; 36 | } 37 | 38 | protected function getRedirectUrl() 39 | { 40 | return route('scaffold.login'); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Services/Breadcrumbs/EloquentPresenter.php: -------------------------------------------------------------------------------- 1 | eloquent = $eloquent; 17 | } 18 | 19 | public function present() 20 | { 21 | if (!($field = $this->getQualifiedTitleName())) { 22 | $field = $this->eloquent->getRouteKeyName(); 23 | } 24 | 25 | return (string) $this->eloquent->getAttribute($field); 26 | } 27 | 28 | protected function getQualifiedTitleName() 29 | { 30 | foreach (['title', 'name', 'username', 'nickname'] as $column) { 31 | if (array_key_exists($column, $this->eloquent->toArray())) { 32 | return $column; 33 | } 34 | } 35 | 36 | return null; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Traits/AutoTranslatesInstances.php: -------------------------------------------------------------------------------- 1 | getParameters(); 14 | 15 | foreach ($parameters as $parameter) { 16 | $className = $parameter->getClass(); 17 | 18 | if ($className && $name = $className->getName()) { 19 | array_unshift($arguments, \App::make($name)); 20 | } 21 | } 22 | 23 | return \call_user_func_array($callback, $arguments); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Traits/ContainsConfig.php: -------------------------------------------------------------------------------- 1 | config; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Traits/Form/ExecutesQuery.php: -------------------------------------------------------------------------------- 1 | query) && \is_callable($this->query); 24 | } 25 | 26 | /** 27 | * Execute filter element's query. 28 | * 29 | * @return Builder|mixed 30 | */ 31 | public function execQuery() 32 | { 33 | return \call_user_func_array($this->query, \func_get_args()); 34 | } 35 | 36 | /** 37 | * @return mixed 38 | */ 39 | public function getQuery() 40 | { 41 | return $this->query; 42 | } 43 | 44 | /** 45 | * Set a query to execute. 46 | * 47 | * @param mixed $query 48 | * 49 | * @return $this 50 | */ 51 | public function setQuery($query) 52 | { 53 | $this->query = $query; 54 | 55 | return $this; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/Traits/Form/HasHtmlAttributes.php: -------------------------------------------------------------------------------- 1 | 'form-control']; 8 | 9 | /** 10 | * @param array $attributes 11 | * @return static 12 | */ 13 | public function setAttributes(array $attributes) 14 | { 15 | $this->attributes = array_replace($this->attributes, $attributes); 16 | 17 | return $this; 18 | } 19 | 20 | /** 21 | * @return array 22 | */ 23 | public function getAttributes(): array 24 | { 25 | return $this->attributes; 26 | } 27 | 28 | /** 29 | * @param float $min 30 | * @return static 31 | */ 32 | public function min(float $min) 33 | { 34 | $this->attributes['min'] = $min; 35 | 36 | return $this; 37 | } 38 | 39 | /** 40 | * @param null|float $max 41 | * @return static 42 | */ 43 | public function max(float $max) 44 | { 45 | $this->attributes['max'] = $max; 46 | 47 | return $this; 48 | } 49 | 50 | /** 51 | * @param float $step 52 | * @return static 53 | */ 54 | public function step(float $step) 55 | { 56 | $this->attributes['step'] = $step; 57 | 58 | return $this; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/Traits/Form/SupportsListTypes.php: -------------------------------------------------------------------------------- 1 | type = 'datalist'; 16 | 17 | return $this; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Traits/MethodsCollector.php: -------------------------------------------------------------------------------- 1 | getMethods($filter) 23 | : []; 24 | } 25 | 26 | return $methodsCache; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Traits/Module/AllowFormats.php: -------------------------------------------------------------------------------- 1 | scaffoldFormats(); 17 | } 18 | 19 | /** 20 | * Get exportable url. 21 | * 22 | * @param $format 23 | * 24 | * @return string 25 | */ 26 | public function makeExportableUrl($format) 27 | { 28 | $payload = array_merge([ 29 | 'module' => $this->url(), 30 | 'format' => $format, 31 | ], Request::all()); 32 | 33 | return route('scaffold.export', $payload); 34 | } 35 | 36 | protected function scaffoldFormats() 37 | { 38 | return property_exists($this, 'exportableTo') 39 | ? $this->exportableTo 40 | : config('administrator.export.'.$this->url(), config('administrator.export.default')); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Traits/Module/HasOptions.php: -------------------------------------------------------------------------------- 1 | scaffoldForm(); 19 | } 20 | 21 | /** 22 | * @return Mutable 23 | */ 24 | protected function scaffoldForm() 25 | { 26 | $collection = new Mutable(); 27 | 28 | foreach (options_fetch() as $option) { 29 | $element = Text::make($option->key)->setValue($option->value); 30 | $collection->add($element); 31 | } 32 | 33 | return $collection; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Traits/Module/ValidatesOptions.php: -------------------------------------------------------------------------------- 1 | scaffoldRules(); 13 | } 14 | 15 | /** 16 | * Build a list of supposed validators based on columns and indexes information. 17 | * 18 | * @return array 19 | */ 20 | protected function scaffoldRules() 21 | { 22 | return array_build(options_fetch(), function ($key, $option) { 23 | return [$option->key, 'required']; 24 | }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Traits/Policy/GrantsSuperPrivileges.php: -------------------------------------------------------------------------------- 1 | isSuperAdmin(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Traits/ResolvesClasses.php: -------------------------------------------------------------------------------- 1 | getPathname(); 20 | 21 | $instance = app()->make($this->getModuleClassName($fileInfo)); 22 | 23 | if (\is_callable($callback)) { 24 | $callback($instance); 25 | } 26 | } 27 | 28 | /** 29 | * @param SplFileInfo $fileInfo 30 | * 31 | * @return mixed 32 | */ 33 | protected function getModuleClassName(SplFileInfo $fileInfo) 34 | { 35 | $name = str_replace('.php', '', $fileInfo->getBasename()); 36 | 37 | $path = trim(str_replace( 38 | app_path(), 39 | '', 40 | \dirname($fileInfo->getPathname()) 41 | ), \DIRECTORY_SEPARATOR); 42 | 43 | $location = str_replace('/', '\\', $path); 44 | 45 | return app()->getNamespace()."{$location}\\{$name}"; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Traits/SessionGuardHelper.php: -------------------------------------------------------------------------------- 1 | get('auth.model', config('auth.model')); 27 | } 28 | 29 | /** 30 | * Fetch authentication model. 31 | * 32 | * @param $config 33 | * 34 | * @return null|mixed 35 | */ 36 | protected function fetchModel($config) 37 | { 38 | if (guarded_auth()) { 39 | return $this->guardedModel(); 40 | } 41 | 42 | return $this->authModel($config); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Traits/SortableTrait.php: -------------------------------------------------------------------------------- 1 | sortable : null; 13 | } 14 | 15 | /** 16 | * Is Sortable item. 17 | * 18 | * @return bool 19 | */ 20 | public function isSortable() 21 | { 22 | if (property_exists($this, 'sortable')) { 23 | return \is_string($this->sortable) || \is_callable($this->sortable); 24 | } 25 | 26 | return false; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Traits/Stringify.php: -------------------------------------------------------------------------------- 1 | render(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tests/Actions/SaveOrderTest.php: -------------------------------------------------------------------------------- 1 | createMock(Request::class); 18 | $request->expects($this->once())->method('get')->with('rank')->willReturn([]); 19 | 20 | $eloquent = $this->getMockBuilder(User::class) 21 | ->disableOriginalConstructor() 22 | ->addMethods(['syncRanking', 'getRankableColumn']) 23 | ->getMock(); 24 | 25 | $eloquent->expects($this->once())->method('syncRanking')->with([]); 26 | $eloquent->expects($this->once())->method('getRankableColumn')->willReturn('rank'); 27 | 28 | $action->handle($eloquent, $request); 29 | } 30 | 31 | /** @test */ 32 | public function it_may_have_an_icon() 33 | { 34 | $action = $this->createMock(SaveOrder::class); 35 | 36 | $this->assertNotEmpty( 37 | $this->invokeMethod($action, 'icon') 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/CoreTestCase.php: -------------------------------------------------------------------------------- 1 | getMethod($method); 25 | $method->setAccessible(true); 26 | 27 | return $method->invokeArgs($object, $args); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/CreatesElement.php: -------------------------------------------------------------------------------- 1 | setOptions($options = [1, 2, 3, 4, 5]); 13 | 14 | $this->assertSame( 15 | $options, 16 | $select->getOptions() 17 | ); 18 | } 19 | 20 | /** @test */ 21 | public function it_allows_callable_options_for_enum_types() 22 | { 23 | $select = Enum::make('select'); 24 | 25 | $realOptions = [1, 2, 3, 4, 5]; 26 | $options = function () use ($realOptions) { 27 | return $realOptions; 28 | }; 29 | 30 | $select->setOptions($options); 31 | 32 | $this->assertSame( 33 | $realOptions, 34 | $select->getOptions() 35 | ); 36 | } 37 | 38 | /** @test */ 39 | public function it_allows_a_query_builder() 40 | { 41 | $select = Enum::make('test'); 42 | 43 | $select->setOptions([1, 2, 3, 4, 5]); 44 | 45 | $select->setQuery($query = function ($query, $value = null) { 46 | return $query->where('test', $value); 47 | }); 48 | 49 | $this->assertSame( 50 | $query, 51 | $select->getQuery() 52 | ); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /tests/MocksObjects.php: -------------------------------------------------------------------------------- 1 | shouldReceive('has')->withAnyArgs()->andReturn(false); 14 | 15 | app()->instance('translator', $translator); 16 | 17 | return $translator; 18 | } 19 | 20 | protected function mockModule() 21 | { 22 | $module = \Mockery::mock(\Terranet\Administrator\Scaffolding::class); 23 | $module->shouldReceive('url')->andReturn('/module/url'); 24 | 25 | app()->instance('scaffold.module', $module); 26 | 27 | return $module; 28 | } 29 | 30 | /** 31 | * @param $translator 32 | */ 33 | protected function mockApplication($translator) 34 | { 35 | $app = \Mockery::mock(\Illuminate\Contracts\Foundation\Application::class); 36 | $app->shouldReceive('make') 37 | ->with('translator') 38 | ->andReturn($translator); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/bootstrap.php: -------------------------------------------------------------------------------- 1 |