Giter VIP home page Giter VIP logo

area17 / twill Goto Github PK

View Code? Open in Web Editor NEW
3.6K 84.0 545.0 57.39 MB

Twill is an open source CMS toolkit for Laravel that helps developers rapidly create a custom admin console that is intuitive, powerful and flexible. Chat with us on Discord at https://discord.gg/cnWk7EFv8R.

Home Page: https://twillcms.com

License: Apache License 2.0

JavaScript 8.11% PHP 62.01% CSS 0.20% SCSS 2.57% Blade 6.09% Vue 21.03%
laravel vue cms content-management-system cms-framework headless-cms

twill's Introduction

Packagist PHP Version Latest Stable Version Build Status License
Total Downloads chat on Discord GitHub closed pull requests

About Twill

Twill is an open source Laravel package that helps developers rapidly create a custom CMS that is beautiful, powerful, and flexible. By standardizing common functions without compromising developer control, Twill makes it easy to deliver a feature-rich admin console that focuses on modern publishing needs.

Twill is an AREA 17 product. It was crafted with the belief that content management should be a creative, productive, and enjoyable experience for both publishers and developers.

Benefits overview

With a vast number of pre-built features and custom-built Vue.js UI components, developers can focus their efforts on the unique aspects of their applications instead of rebuilding standard ones.

Built to get out of your way, Twill offers:

  • No lock-in, create your data models or hook existing ones
  • No front-end assumptions, use it within your Laravel app or headless
  • No bloat, turn off features you don’t need
  • No need to write/adapt HTML for the admin UI
  • No limits, extend as you see fit

Learning Twill

If you use Laravel, you already know Twill. It embraces Laravel to the fullest extent and encourages you to write beautiful code. To get started, read our documentation. If you'd like to hire us for implementation or support, contact us. We're here to discuss your plans, evaluate your needs, make recommendations, and give you a full walk-thru of Twill.

Credits

Over the last 15 years, nearly every engineer at AREA 17 has contributed to Twill in some capacity. However, Twill in its current form as an open source initiative was created by:

  • Quentin Renard, lead application engineer
  • Antoine Doury, lead interface engineer
  • Antonin Caudron, interface engineer
  • Martin Rettenbacher, product designer
  • Jesse Golomb, product owner
  • George Eid, product manager

With contributions from Laurens van Heems, Fernando Petrelli, Gilbert Moufflet, Mubashar Iqbal, Pablo Barrios, Luis Lavena, and Mike Byrne.

Contributing

We look forward to your contribution to make Twill the best it can be. You can find our contribution guidelines in the Twill documentation.

Security vulnerabilities

If you discover a security vulnerability within Twill, please email us at [email protected]. All security vulnerabilities will be promptly addressed.

License

The Twill software is licensed under the Apache 2.0 license. The Twill UI, including but not limited to images, icons, patterns, and derivatives thereof are licensed under the Creative Commons Attribution 4.0 International License.

Attribution

By using the Twill UI, you agree that any application which incorporates it shall prominently display the message “Made with Twill” in a legible manner in the footer of the admin console. This message must open a link to twillcms.com when clicked or touched. For permission to remove the attribution, contact us at [email protected].

Trademark

Twill CMS and the Twill CMS logo are trademarks of AREA 17. You may not display or invoke the Twill CMS name or logo in a manner that implies a relationship or affiliation with, sponsorship, promotion, or endorsement by Twill CMS or AREA 17, except as authorized by the terms of attribution.

Copyright © AREA 17

twill's People

Contributors

13twelve avatar agnonym avatar aksiome avatar antonioribeiro avatar daun avatar dependabot[bot] avatar driftingly avatar ferpetrelli avatar freshleafmedia avatar gilbo75 avatar graxmonzo avatar haringsrob avatar ifox avatar joyceverheije avatar kallesprd avatar keimeno avatar kylegoines avatar liamjcooper avatar m4n1ok avatar mazeeblanke avatar mrdoinel avatar pauldwight avatar pboivin avatar ptrckvzn avatar sauron avatar smeeckaert avatar stevanpavlovic avatar thingasd avatar tofandel avatar yasiendwieb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

twill's Issues

error PDOException on php artisan twill:setup

(Windows10 / Mamp Pro 4 / php 7.1.7)

1 PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1059 Identifier name 'fk_your_plural_module_name_translations_your_plural_module_name_id' is too long")
D:\MAMP\htdocs\twill\vendor\laravel\framework\src\Illuminate\Database\Connection.php:458

2 PDOStatement::execute()
D:\MAMP\htdocs\twill\vendor\laravel\framework\src\Illuminate\Database\Connection.php:458

Build scripts for windows

Hi,
I tried to install twill but no success with build scripts in document, look like it works only in linux/macos, so i rewrote a little to make it works:

"cms-build": "npm run cms-copy-blocks && cd vendor/area17/twill && npm ci && npm run prod && cp -R public/* ${INIT_CWD}/public", "cms-copy-blocks": "npm run cms-clean-blocks && mkdir resources\\assets\\js\\blocks\\ && mkdir vendor\\area17\\twill\\frontend\\js\\components\\blocks\\customs\\ && cp -R resources\\assets\\js\\blocks\\ vendor\\area17\\twill\\frontend\\js\\components\\blocks\\customs\\", "cms-clean-blocks": "rm -rf vendor\\area17\\twill\\frontend\\js\\components\\blocks\\customs && rm -rf resources\\assets"

One more problem is paths in public/assets/tasks/icon.js, i saw you used path.resolve('frontend/icons') but i got the syntax is incorrect when build, and i changed it to path.resolve('frontend\icons') but still got same problem.

@ preicons D:\laragon\www\laratrans\vendor\area17\twill rimraf public/assets/admin/icons/icons.svg && rimraf frontend/scss/setup/_icons.scss && rimraf public/assets/admin/icons/icons-files.svg && rimraf frontend/scss/setup/_icons-files.scss && mkdir -p public/assets/admin/icons

The syntax of the command is incorrect.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ preicons: rimraf public/assets/admin/icons/icons.svg && rimraf >frontend/scss/setup/_icons.scss && rimraf public/assets/admin/icons/icons-files.svg && >rimraf frontend/scss/setup/_icons-files.scss && mkdir -p public/assets/admin/icons
npm ERR! Exit status 1`

Dashboard route is not found

I have just freshly installed but completely unable to access the admin route
it gives error 404
i set the admin app url and path but it is still 404
I do not wish to use subdomains on my local machine

Translation models

I'm trying to add in translations to the page module I've generated. The documentation suggests that models should be generated in a App\Models\Translations folder. I've added in UseTranslations and HasTranslation to the repository and the model manually, is there something I can run that will generate the translation models? Or is that something that needs to happen when the module is initially created using the php artisan twill:module command?

Settings fail to save when only one language is available

Hello, thanks for such an amazing admin package, I absolutely love Twill!

I'm having the following issue: I'm building a CMS for a single language website (english). I enabled the Settings option in the config/twill.php file, I copied the settings migration to my migrations folder as suggested in the documentation but removed the translations table as I will not use it. My "translatable" locales settings array only contains the "en" code so no other languages are available. The problem comes when I try to store some settings as I get the following error:

ErrorException (E_WARNING) Illegal string offset 'en' 66 ErrorException …/vendor/area17/twill/src/Repositories/SettingRepository.php45

I've tried adding the "translated=false" attribute on the form fields but I still get the same error.

I removed the tables and re-executed the migrations but this time leaving the translations table, I enabled the translated=true attribute on the form fields and it worked correctly, however I can't store any images so it does not solve my problem.

Any help would be much appreciated.

Thank you!

"Array to string conversion in <module>_slugs table

Hi,

while testing the app, I got the following error message:

Array to string conversion (SQL: insert into `article_slugs` (`active`, `slug`, `locale`, `article_id`) values (1, test, MX, 1))

STRs:

Create new module

php artisan twill:module articles -R -P -M -S -B

Update the generated files

https://gist.github.com/noxify/3317922ca2202df14c47768212a95d02

(all other generated files are untouched)

Migrate the new tables

php artisan migrate

Create a new article record

  1. Open the admin page for the modules ( in my case, it is http://twill.local/manage/content/articles )
  2. Click Add new Button
  3. Enter something in the Title field
  4. Click the Create Button

Expected Result

A new record has been created in all needed tables

Current Result

In the UI, the following error is shown:

Your content can not be edited, please retry

In the console log you can see a 500 response with the following error:

{
    "error": {
        "type": "Illuminate\\Database\\QueryException",
        "message": "Array to string conversion (SQL: insert into `article_slugs` (`active`, `slug`, `locale`, `article_id`) values (1, testrecord, MX, 3))",
        "file": "\/home\/vagrant\/code\/twill\/vendor\/laravel\/framework\/src\/Illuminate\/Database\/Connection.php",
        "line": 664
    }
}

Environment

  • Host: OSX
  • App running via Homestead

composer.json

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": "^7.1.3",
        "area17/twill": "^1.1",
        "fideloper/proxy": "^4.0",
        "laravel/framework": "5.6.*",
        "laravel/tinker": "^1.0"
    },
    "require-dev": {
        "filp/whoops": "^2.0",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^2.0",
        "phpunit/phpunit": "^7.0"
    },
    "autoload": {
        "classmap": [
            "database/seeds",
            "database/factories"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "extra": {
        "laravel": {
            "dont-discover": [
            ]
        }
    },
    "scripts": {
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate"
        ],
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

I hope the STRs are enough :) If you need more information, please let me know.

Thanks!

Medias not saving

I've added the HasMedias and HandleMedias to my page module and I've successsfully saved one medias input to the database. I've added two more media fields, but they're not saving and I'm not sure what I'm missing.

Here's what I have in the mediasParams array in my Page model:

public $mediasParams = [
         'header_img' => [
             'default' => [
                 [
                     'name' => 'landscape',
                     'ratio' => 16 / 9,
                 ],
             ],
         ],
         'large_rectange' => [
             'default' => [
                 [
                     'name' => 'landscape',
                     'ratio' => 16 / 9,
                 ],
             ],
         ],
         'large_square' => [
             'default' => [
                 [
                     'name' => 'square',
                     'ratio' => 1,
                 ],
             ],
         ],
    ];

Here are the fields in the form:

@formField('medias', [
    'name' => 'header_img',
    'label' => 'Header Image',
    'note' => 'Image should be 1520 X 1472. Optional.',
    'max' => 1,
])

@formField('medias', [
    'name' => 'large_rectangle',
    'label' => 'Large Image Rectangle',
    'note' => 'Image should be exactly 3040px X 1487px.',
    'max' => 1,
    'required' => true,
])

@formField('medias', [
    'name' => 'large_square',
    'label' => 'Large Image Square',
    'note' => 'Image should be exactly 1464px X 1464px.',
    'max' => 1,
    'required' => true,
])

Is there something else I need to add? I insert an image and update, but it's not saving the two new images to the mediables table in the database.

.env file

All right sorry ! close this one :P

Getting repeaters in contentFields section to save

Hi,

I managed to successfully add a repeater block (the "accordion" example as per the docs)- that works correctly. Following that, I attempted to add a repeater to the contentFields section, but I can't get it to save its data on update.

My CRUD module is called Projects. I added the repeater to projects/form.blade.php below my description field:

@section('contentFields')
    @formField('input', [
        'name' => 'description',
        'label' => 'Description',
        'maxlength' => 100,
        'required' => true,
    ])

    @formField('repeater', [
      'name' => 'myRepeater',
      'type' => 'accordion_item']
    )
@stop

I also added 'myRepeater' to the Project model fillable array, and added a json column called 'myRepeater' to the migration file (not sure whether this is correct, the docs seem a bit sparse re this).

The repeater appears correctly on the edit screen, and I can add items and text, but none of it saves to the database on update. What am I missing here?

Thanks
Seb

Admin URL

I'm trying to setup the admin routing, but I'm running into some issues. In the config/twill.php file I've added this to override the default setup:

return [

/*
|--------------------------------------------------------------------------
| Application Admin URL
|--------------------------------------------------------------------------
|
| This value is the URL of your admin application.
|
 */
'admin_app_url' => env('ADMIN_APP_URL', env('APP_URL').'/admin')

];

The app URL is set to http://nin-twill.loc/ in the .env file. When I try to load the admin section by going to http://nin-twill.loc/admin, I get a NotFoundHttpException error. Am I missing something?

All local asset urls broken

Trying to demo this on Valet and i've defined my APP_URL as well as the ADMIN_APP_URL and I finally managed to log in but none of the styles/js assets are loading because they are referencing localhost:8080 and not twill.test like i've defined...

Looks like a promising product but the docs and setup process could be well improved.

Strip out HTML tags in slugify filter

For our website, we implemented the ability to render titles as raw HTML, so that content editors can italicize titles embedded within other titles. However, we noticed that the formatPermalink function doesn't strip out HTML tags when generating the slug. Since doing so would not impact projects that do not enter HTML into title fields, I'd like to see the slugify filter expanded to strip out HTML tags.

const slug = this.$options.filters.slugify(text)

slugify: function (value) {
const a = 'àáäâèéëêìíïîòóöôùúüûñçßÿœæŕśńṕẃǵǹḿǘẍźḧ·/_,:;' + 'ąàáäâãåæćęęèéëêìíïîłńòóöôõøśùúüûñçżź'
const b = 'aaaaeeeeiiiioooouuuuncsyoarsnpwgnmuxzh------' + 'aaaaaaaaceeeeeeiiiilnoooooosuuuunczz'
const p = new RegExp(a.split('').join('|'), 'g')
return value.toString().toLowerCase().trim()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(p, c =>
b.charAt(a.indexOf(c))) // Replace special chars
.replace(/&/g, '-and-') // Replace & with 'and'
.replace(/[^\w-]+/g, '') // Remove all non-word chars
.replace(/--+/g, '-') // Replace multiple - with single -
},

I'll submit a PR for this shortly!

Issues with the `php artisan twill:setup`

Copied File [/vendor/area17/twill/migrations/create_tags_tables.php] To [/database/migrations/2018_07_14_205036_create_tags_tables.php]
Copied File [/vendor/area17/twill/migrations/create_blocks_table.php] To [/database/migrations/2018_07_14_205036_create_blocks_table.php]
Copied File [/vendor/area17/twill/migrations/create_users_tables.php] To [/database/migrations/2018_07_14_205036_create_users_tables.php]
Copied File [/vendor/area17/twill/migrations/create_files_tables.php] To [/database/migrations/2018_07_14_205036_create_files_tables.php]
Copied File [/vendor/area17/twill/migrations/create_medias_tables.php] To [/database/migrations/2018_07_14_205036_create_medias_tables.php]
Publishing complete.
Copied File [/vendor/spatie/laravel-activitylog/migrations/create_activity_log_table.php.stub] To [/database/migrations/2018_07_14_205036_create_activity_log_table.php]
Publishing complete.

   Illuminate\Database\QueryException  : SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select * from information_schema.tables where table_schema = blog and table_name = migrations)

  at /Users/patrickblackjr/code/blog/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
    660|         // If an exception occurs when attempting to run a query, we'll format the error
    661|         // message to include the bindings with SQL, which will make this exception a
    662|         // lot more helpful to the developer instead of just the database's errors.
    663|         catch (Exception $e) {
  > 664|             throw new QueryException(
    665|                 $query, $this->prepareBindings($bindings), $e
    666|             );
    667|         }
    668|

  Exception trace:

  1   PDOException::("PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]")
      /Users/patrickblackjr/code/blog/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68

  2   PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=blog", "root", "", [])
      /Users/patrickblackjr/code/blog/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68

  Please use the argument -v to see more details.

I tried to run php artisan twill:setup.

Major problem re hot module replacement (npm run twill-dev)

Hi,

I ran npm run twill-dev to start the HMR server. It didn't seem to work (may raise a separate issue re this) but more importantly, all my CSS and JS assets are now being served from localhost:8080 rather than admin.mysite.localhost:8000, meaning that none of them load.

I've rebooted the VM but it still persists. How do I revert this?

Thanks,
Seb

error message during setup - asset path?

php artisan twill:setup

Can't locate path: </Users/XXX/Twill/repos/vendor/area17/twill/src/../assets>
Publishing complete.

not sure what this is supposed to be doing anything i can do manually to resolve?

thanks Kele.

Sending Markdown mail fails

Sending any mail from Laravel with Twill enabled results in the following error:

ErrorException thrown with message "View [emails.html.header] not found. (View: /Users/dafyd/Development/personal/medalnet/vendor/area17/twill/views/emails/html/message.blade.php) (View: /Users/dafyd/Development/personal/medalnet/vendor/area17/twill/views/emails/html/message.blade.php)"

Stacktrace:
#86 ErrorException in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php:137
#85 ErrorException in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php:137
#84 InvalidArgumentException in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php:137
#83 Illuminate\View\FileViewFinder:findInPaths in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php:79
#82 Illuminate\View\FileViewFinder:find in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/View/Factory.php:128
#81 Illuminate\View\Factory:make in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesComponents.php:64
#80 Illuminate\View\Factory:renderComponent in /Users/dafyd/Development/personal/medalnet/storage/framework/views/1902003e19f5ef8ca431d77e026152380daa02f0.php:7
#79 include in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php:43
#78 Illuminate\View\Engines\PhpEngine:evaluatePath in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php:59
#77 Illuminate\View\Engines\CompilerEngine:get in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/View/View.php:142
#76 Illuminate\View\View:getContents in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/View/View.php:125
#75 Illuminate\View\View:renderContents in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/View/View.php:90
#74 Illuminate\View\View:render in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesComponents.php:64
#73 Illuminate\View\Factory:renderComponent in /Users/dafyd/Development/personal/medalnet/storage/framework/views/cc9da87a672670f40a03103aba3cfb2c341b8f6b.php:19
#72 include in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php:43
#71 Illuminate\View\Engines\PhpEngine:evaluatePath in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php:59
#70 Illuminate\View\Engines\CompilerEngine:get in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/View/View.php:142
#69 Illuminate\View\View:getContents in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/View/View.php:125
#68 Illuminate\View\View:renderContents in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/View/View.php:90
#67 Illuminate\View\View:render in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Mail/Markdown.php:61
#66 Illuminate\Mail\Markdown:render in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php:248
#65 Illuminate\Mail\Mailable:buildMarkdownView in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php:220
#64 Illuminate\Mail\Mailable:buildView in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php:142
#63 Illuminate\Mail\Mailable:Illuminate\Mail{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Support/Traits/Localizable.php:18
#62 Illuminate\Mail\Mailable:withLocale in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php:149
#61 Illuminate\Mail\Mailable:send in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php:263
#60 Illuminate\Mail\Mailer:sendMailable in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php:218
#59 Illuminate\Mail\Mailer:send in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Mail/PendingMail.php:119
#58 Illuminate\Mail\PendingMail:send in /Users/dafyd/Development/personal/medalnet/app/Http/Controllers/ContactController.php:37
#57 App\Http\Controllers\ContactController:send in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Controller.php:54
#56 call_user_func_array in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Controller.php:54
#55 Illuminate\Routing\Controller:callAction in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php:45
#54 Illuminate\Routing\ControllerDispatcher:dispatch in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Route.php:212
#53 Illuminate\Routing\Route:runController in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Route.php:169
#52 Illuminate\Routing\Route:run in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Router.php:665
#51 Illuminate\Routing\Router:Illuminate\Routing{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:30
#50 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /Users/dafyd/Development/personal/medalnet/app/Http/Middleware/SetLocale.php:26
#49 App\Http\Middleware\SetLocale:handle in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#48 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#47 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php:41
#46 Illuminate\Routing\Middleware\SubstituteBindings:handle in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#45 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#44 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php:68
#43 Illuminate\Foundation\Http\Middleware\VerifyCsrfToken:handle in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#42 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#41 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php:49
#40 Illuminate\View\Middleware\ShareErrorsFromSession:handle in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#39 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#38 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:63
#37 Illuminate\Session\Middleware\StartSession:handle in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#36 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#35 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php:37
#34 Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse:handle in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#33 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#32 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php:66
#31 Illuminate\Cookie\Middleware\EncryptCookies:handle in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#30 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#29 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104
#28 Illuminate\Pipeline\Pipeline:then in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Router.php:667
#27 Illuminate\Routing\Router:runRouteWithinStack in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Router.php:642
#26 Illuminate\Routing\Router:runRoute in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Router.php:608
#25 Illuminate\Routing\Router:dispatchToRoute in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Router.php:597
#24 Illuminate\Routing\Router:dispatch in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:176
#23 Illuminate\Foundation\Http\Kernel:Illuminate\Foundation\Http{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:30
#22 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /Users/dafyd/Development/personal/medalnet/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php:65
#21 Barryvdh\Debugbar\Middleware\InjectDebugbar:handle in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#20 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#19 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /Users/dafyd/Development/personal/medalnet/vendor/fideloper/proxy/src/TrustProxies.php:57
#18 Fideloper\Proxy\TrustProxies:handle in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#17 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#16 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:31
#15 Illuminate\Foundation\Http\Middleware\TransformsRequest:handle in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#14 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#13 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:31
#12 Illuminate\Foundation\Http\Middleware\TransformsRequest:handle in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#11 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#10 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php:27
#9 Illuminate\Foundation\Http\Middleware\ValidatePostSize:handle in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#8 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#7 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php:62
#6 Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode:handle in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#5 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#4 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104
#3 Illuminate\Pipeline\Pipeline:then in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:151
#2 Illuminate\Foundation\Http\Kernel:sendRequestThroughRouter in /Users/dafyd/Development/personal/medalnet/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:116
#1 Illuminate\Foundation\Http\Kernel:handle in /Users/dafyd/Development/personal/medalnet/public/index.php:55
#0 require in /Users/dafyd/.composer/vendor/laravel/valet/server.php:147

I have published both the Laravel Mail views (php artisan vendor:publish --tag=laravel-mail) and Twill's own views (php artisan vendor:publish --tag=views --provider=A17\Twill\TwillServiceProvider).

It seems the following lines in TwillServiceProvider (132-135) are causing the error (at least, the mail sends when they are commented out):

config(['mail.markdown.paths' => array_merge(
    [__DIR__ . '/../views/emails'],
    config('mail.markdown.paths')
)]);

Setting the first path to a full value seems to work, too:

config(['mail.markdown.paths' => array_merge(
    ['/vendor/area17/twill/views/emails'],
    config('mail.markdown.paths')
)]);

Actually, I'm a little confused as to the purpose of this config setting. Wouldn't publishing the views do this anyway, while allowing the user a little more control over them?

Change some `medias` columns from `string` to `text`

We are seeing issues come through via Sentry, which suggest that users are blowing past the column length limits set in the medias table. This got me thinking – is there a reason for these columns to be strings in the first place?

https://github.com/area17/twill/blob/1.2/migrations/create_medias_tables.php

Schema::create('medias', function (Blueprint $table) {
    [...]
    $table->text('uuid');
    $table->text('alt_text');
    [...]
    $table->text('caption')->nullable();
    $table->text('filename')->nullable();
});
  1. caption and alt_text are free-text fields, so they should be text. Consider e.g. the Coyote Project, which favors long-form descriptions for accessibility.
  2. filename is limited to 255 chars in most filesystems, but not all. There's no need to assume filesystem limits by using a string column.
  3. I'd normally not suggest that a uuid should be text, but given that the "uuid" seems to be comprised of an actual UUID combined with the filename, the least disruptive way to reduce inconsistency is to allow it to be a text field. It looks like medias is typically queried via id, not uuid, so performance shouldn't be an issue.

Similar changes might need to be done to files for consistency (uuid and filename).

Overall, I don't see any advantages in using string over text in modern database systems, except for cases where there's a need to index columns for faster sorting. It just tends to cause issues when users inevitably enter text that's longer than expected. 😢

We are already making these adjustments in our existing project – just throwing the idea your way in case it proves helpful to others!

Conditional logic in forms

Is it possible to have a select input on a form which controls the inputs that are displayed after it depending on which option is selected?

Logo

Hi. I am a graphic designer. I volunteer to design a logo for open source projects. I can design it for you to use it in the text file. What dou you say?

The setup process as described does not work

The installation steps in the documentation does not work with the provided examples. The created module is not routable, because Route::module('resource') can not resolve the right Controller at the created path.
Nothing is running locally. Maybe it is a problem with the used sub domain, but no url from the route:list is accessible without any exception screen.

Please fix your documentation at the setup process.

Used package version constraint is: ^1.1

Error when running php artisan twill:setup

I've created a database and added it to the .env file, but when I try to run twill:setup I get the following error.

Copied File [\vendor\area17\twill\migrations\create_tags_tables.php] To [\database\migrations\2018_08_04_003227_create_tags_tables.php]
Copied File [\vendor\area17\twill\migrations\create_blocks_table.php] To [\database\migrations\2018_08_04_003227_create_blocks_table.php]
Copied File [\vendor\area17\twill\migrations\create_users_tables.php] To [\database\migrations\2018_08_04_003227_create_users_tables.php]
Copied File [\vendor\area17\twill\migrations\create_files_tables.php] To [\database\migrations\2018_08_04_003227_create_files_tables.php]
Copied File [\vendor\area17\twill\migrations\create_medias_tables.php] To [\database\migrations\2018_08_04_003227_create_medias_tables.php]
Publishing complete.
Copied File [\vendor\spatie\laravel-activitylog\migrations\create_activity_log_table.php.stub] To [\database\migrations\2018_08_04_003227_create_activity_log_table.php]
Publishing complete.
PHP Fatal error: Cannot declare class CreateActivityLogTable, because the name is already in use in E:\Dropbox\www\nin_twill\database\migrations\2018_08_04_001240_create_activity_log_table.php on line 35
PHP Stack trace:
PHP 1. {main}() E:\Dropbox\www\nin_twill\artisan:0
PHP 2. App\Console\Kernel->handle() E:\Dropbox\www\nin_twill\artisan:37
PHP 3. Illuminate\Console\Application->run() E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php:122
PHP 4. Illuminate\Console\Application->run() E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Console\Application.php:89
PHP 5. Illuminate\Console\Application->doRun() E:\Dropbox\www\nin_twill\vendor\symfony\console\Application.php:145
PHP 6. Illuminate\Console\Application->doRunCommand() E:\Dropbox\www\nin_twill\vendor\symfony\console\Application.php:262
PHP 7. A17\Twill\Commands\Setup->run() E:\Dropbox\www\nin_twill\vendor\symfony\console\Application.php:886
PHP 8. A17\Twill\Commands\Setup->run() E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Console\Command.php:171
PHP 9. A17\Twill\Commands\Setup->execute() E:\Dropbox\www\nin_twill\vendor\symfony\console\Command\Command.php:251
PHP 10. Illuminate\Foundation\Application->call() E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Console\Command.php:184
PHP 11. Illuminate\Container\BoundMethod::call() E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Container\Container.php:564
PHP 12. Illuminate\Container\BoundMethod::callBoundMethod() E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:31
PHP 13. Illuminate\Container\BoundMethod::Illuminate\Container{closure}() E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:87
PHP 14. call_user_func_array:{E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:29}() E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:29
PHP 15. A17\Twill\Commands\Setup->handle() E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:29
PHP 16. A17\Twill\Commands\Setup->call() E:\Dropbox\www\nin_twill\vendor\area17\twill\src\Commands\Setup.php:17
PHP 17. Illuminate\Database\Console\Migrations\MigrateCommand->run() E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Console\Command.php:199
PHP 18. Illuminate\Database\Console\Migrations\MigrateCommand->run() E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Console\Command.php:171
PHP 19. Illuminate\Database\Console\Migrations\MigrateCommand->execute() E:\Dropbox\www\nin_twill\vendor\symfony\console\Command\Command.php:251
PHP 20. Illuminate\Foundation\Application->call() E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Console\Command.php:184
PHP 21. Illuminate\Container\BoundMethod::call() E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Container\Container.php:564
PHP 22. Illuminate\Container\BoundMethod::callBoundMethod() E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:31
PHP 23. Illuminate\Container\BoundMethod::Illuminate\Container{closure}() E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:87
PHP 24. call_user_func_array:{E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:29}() E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:29
PHP 25. Illuminate\Database\Console\Migrations\MigrateCommand->handle() E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:29
PHP 26. Illuminate\Database\Migrations\Migrator->run() E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Database\Console\Migrations\MigrateCommand.php:70
PHP 27. Illuminate\Database\Migrations\Migrator->requireFiles() E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php:89
PHP 28. Illuminate\Filesystem\Filesystem->requireOnce() E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php:447

Symfony\Component\Debug\Exception\FatalErrorException : Cannot declare class CreateActivityLogTable, because the name is already in use

at E:\Dropbox\www\nin_twill\database\migrations\2018_08_04_001240_create_activity_log_table.php:35
31| public function down()
32| {
33| Schema::drop(config('activitylog.table_name'));
34| }

35| }
36|

Exception trace:

1 Symfony\Component\Debug\Exception\FatalErrorException::__construct()
E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php:137

2 Illuminate\Foundation\Bootstrap\HandleExceptions::fatalExceptionFromError()
E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php:123

Please use the argument -v to see more details.

Whoops\Exception\ErrorException : Cannot declare class CreateActivityLogTable, because the name is already in use

at E:\Dropbox\www\nin_twill\database\migrations\2018_08_04_001240_create_activity_log_table.php:35
31| public function down()
32| {
33| Schema::drop(config('activitylog.table_name'));
34| }

35| }
36|

Exception trace:

1 Illuminate\Filesystem\Filesystem::requireOnce()
E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php:447

2 Illuminate\Database\Migrations\Migrator::requireFiles()
E:\Dropbox\www\nin_twill\vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php:89

Twill UI?

Working on a different project but want to use Twill's clean UI components, CSS and colors.
Any way to isolate the specific files?

Add CSS to the control panel

Is there a nice and clean way to add some extra CSS to the control panel? I'd like to add a section title to the forms to break things up visually a bit. I can inline it easily enough, but it would be nice to have the ability to append some CSS.

Adding related models using the browser input

I'm following the instructions in the Block Editor>Adding browser fields section of the docs, but I'm not sure where to add the last bit of code (in the section labeled After that, it is required to add the Route Prefixes. e.g.:). Is that something that should be added to the routes/admin.php file? Or should it go somewhere else. It's a bit unclear to me.

Saving input from a browser form field

I've added a browser input for a module called services (a taxonomy associated with a project), added a field called services to the project table in the database (which I've assigned the text type in the database), and I've added a browser form field to the project's form.blade.php. Nothing is saving to the database, so I'm wondering if I'm missing something. It seems like Twill is setup to handle that as far as I can tell (add a form field and a corresponding field to the database and Twill will handle the logic of saving the data automatically). Is there some logic that needs to be added manually (e.g. to the projects model) to handle saving the input? It's not really obvious to me how the data entered in a browser input (or the block editor) is saved to the database, the documentation doesn't seem to go over that, so it's a bit of a black box.

npm [email protected] is missing

Hi

I've issue when trying to launch twill.

> [email protected] install C:\OSPanel\domains\laravel-twill-cms-builder\vendor\area17\twill\node_modules\node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.8.3/win32-x64-64_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.8.3/win32-x64-64_binding.node":

HTTP error 404 Not Found

Hint: If github.com is not accessible in your location
      try setting a proxy via HTTP_PROXY, e.g.

      export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

      npm config set proxy http://example.com:8080

> [email protected] postinstall C:\OSPanel\domains\laravel-twill-cms-builder\vendor\area17\twill\node_modules\node-sass
> node scripts/build.js

Building: C:\Program Files\nodejs\node.exe C:\OSPanel\domains\laravel-twill-cms-builder\vendor\area17\twill\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok

Please, may someone update dependencies?

The latest version of node-sass - 4.9.3 for now
https://github.com/sass/node-sass/releases/tag/v4.9.3

Getting MySQL error when migrating DB

Running php artisan twill:setup causes the error specified in the screenshot:

1071 Specified key was too long; max key length is 767 bytes (SQL: alter table activity_log add index activity_log_log_name_index(log_name))

screen shot 2018-07-05 at 11 07 58 am

I'm running MAMP with MySQL Server version: 5.6.38 - MySQL Community Server (GPL)

Support `maxlength` in `wysiwyg` fields

Twill gives us the ability to specify a max-length attribute when defining input fields:

@formField('input', [
    'name' => 'title',
    'label' => 'Title',
    'maxlength' => 60
])

@formField('input', [
    'type' => 'textarea',
    'name' => 'description',
    'label' => 'Description',
    'rows' => 4,
    'maxlength' => 500
])

Doing this does not enforce strict input validation AFAICT, but it does give the user a nice countdown of how many characters they have left as they type:

maxlength-indicator

It would be neat if wysiwyg inputs could support this maxlength indicator too.

(Correct me if this is already implemented in newer versions of Twill.)

Querying a module and it's associated data

I'm studying the Laravel docs trying to figure out the best way to pull all of the content associated with a module. Is there a simple way of doing this in Twill that enables me to pull everything (media, translations, associated browser content) at once? Or do I need to query all of the associated content in separate queries? I just want to make sure I'm not missing some sort of helper that simplifies this task before I dig into figuring out how to pull everything manually.

I've set up a PageController that serves the content for the pages from the Page module and added a route in the web.php file that's working as expected:

namespace App\Http\Controllers;

use App\Models\Page;
use App\Models\Translations\PageTranslation;
use Illuminate\Http\Request;

class PageController extends Controller
{
    public function home()
    {
    	$page = Page::find(1); 
    	$translations = PageTranslation::where('page_id', '=', 1)->get();
        return view('home', [
        	'page' => $page,
        	'translations' => $translations
        ]);
    }
}

It's not clear to me how I can make a query to the mediables table if I do need to pull that content manually.

Deleting medias from file storage

Hey Twillers (Twillistas? Twillamis?),

We're noticing that when a Media gets deleted from Twill, the file never gets deleted from file storage, even when there's no data in the database pointing to that resource. There are two scenarios we're thinking about:

  • Soft deletes: If a medias and related mediables records get soft deleted, it would make sense for the file to stay in storage, since the pointer in the database still exists.
  • Force deletes: If a medias gets forceDelete()ed, I think it would make sense for the file to be deleted from storage as well.

One way to do this might be having the A17\Twill\Models\Media model override the forceDelete() method to make a called to Storage::delete to remove the resource from storage after a successful request to the method. But taking a step back, is this behavior that should already be managed by Laravel's File Storage system? Or is this indeed behavior Twill would need to implement?

Thanks!
nikhil

Retrieving a 404 for all twill routes (/login & users)

Hi could someone please let me know if i'm doing something wrong - I just cant get it to show any URL'S so I can login etc.?

Am I missing something in the install docs, I have dd() in the twill routes file and it is being loaded - it just never links to the controller?

screen shot 2018-07-09 at 11 51 41

Command "twill:setup" is not defined.

I am following the documentation#install Howevery I have trouble executing the twill:setup command. The only provider that is registered according to the documentation is A17\Twill\TwillInstallServiceProvider::class but from what I see is that twill:setup command is registered in TwillServiceProvider. Is the auto discover supposed to pick and include this service provider as well ? If I add A17\Twill\TwillServiceProvider:class to config/app.php and run the command I get the following error:

PHP Fatal error:  Cannot declare class CreateActivityLogTable, because the name is already in use in D:\workspace\TwillAdmin\database\migrations\2018_07_26_091603_create_activity_log_table.php on line 35

I am using a new laravel install. After running composer update to see if auto discover will find area17/twill it did not :

PS D:\workspace\TwillAdmin> composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
Discovered Package: barryvdh/laravel-debugbar
Discovered Package: cartalyst/tags
Discovered Package: dimsav/laravel-translatable
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: nunomaduro/collision
Discovered Package: spatie/laravel-activitylog
Discovered Package: spatie/laravel-analytics
Package manifest generated successfully.

Any suggestions ?

Update: I have deleted all migrations from database/migrations and included

        /*
         * Twill CMS
         */
        \A17\Twill\TwillInstallServiceProvider::class,
        \A17\Twill\TwillServiceProvider::class,

to config/app.php . Now the setup command runs to completion but it is kind of awkward - I had duplicated migrations.

Documentation suggestions: add warnings about destructive actions

Hi,
While the documentation describes casually how to install into a default (completely uncustomized) Laravel application, it fails to warn how destructive it is to an existing Laravel app.

A few suggestions to include:

  1. twill:install will replace the app's Exceptions handler

  2. twill:setup will delete the 2 default user and password_resets table migrations, even if they've been customized. This also breaks existing migration history.

  3. twill:setup will also add the activity_log table migration from the spatie package, even if such a migration file already exists, resulting in a fatal error during twill:setup attempt to run migrations. This aborts setup with no way to recover.

Also, there is a small typo in the docs:
twill docs typo

How to add custom JavaScript that responds to form events?

Hey all,

Thanks for the great package! We're working on customizing our CMS, and we'd like to add Javascript that responds to an event—like when a user clicks on an option in a browser or removes a selected browser option. I understand we can use @push to add our own JS, but how do we reference/listen to form change and click events?

Thanks for all your work!
nikhil

After installing Twill, problems with PHP and now MySQL not working

I love the look of Twill and it seems like an incredible project, but I ran into some issues installing which have snowballed into none of my local Laravel apps working anymore.

Software Version
macOS 10.13.6
PHP 7.2.8
MySQL 8.0.12*
Node 10.4.0

* When I started all this it was 8.0.11.

I followed all the instructions in the Twill docs. Requiring and installing Twill went fine, running php artisan twill:setup produced some errors but succeeded (I closed my tab before copying these logs so I don't know exactly what happened).

Then I ran yarn cms-build and I feel like things went sideways. The log output from that was huge so I put it in a gist. It looks like it tried to reinstall Node? Could that have been because I used yarn and not npm run?

I opened my app up in a browser and was eventually able to find Twill's login page, but nothing else. Logging in at admin.blog.test/login would redirect me to the Laravel welcome screen at blog.test, admin.blog.test/users would redirect me to /login and then just reload the login page every time I tried to log in, and I couldn't make any other routes work.

Then I noticed that running any command that needed PHP (like php artisan migrate or laravel new twill) gave me this error:

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.61.dylib
  Referenced from: /usr/local/bin/php
  Reason: image not found

After some googling I was able to resolve this with brew update && brew upgrade, which did all this:

Updated 1 tap (homebrew/core).
==> Updated Formulae
quicktype
==> Upgrading 11 outdated packages, with result:
pyenv 1.2.5 -> 1.2.6, libpng 1.6.34 -> 1.6.35, node-build 3.0.12 -> 3.0.15, trash 0.8.5 -> 0.9.2, ruby-build 20180601 -> 20180618, php 7.2.6 -> 7.2.8, nginx 1.15.0 -> 1.15.2, freetds 1.00.91 -> 1.00.94, mysql 8.0.11 -> 8.0.12, imagemagick 7.0.8-5 -> 7.0.8-8, git 2.17.1 -> 2.18.0
==> Upgrading git
==> Downloading https://homebrew.bintray.com/bottles/git-2.18.0.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring git-2.18.0.high_sierra.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions and functions have been installed to:
  /usr/local/share/zsh/site-functions

Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/git
==> Summary
🍺  /usr/local/Cellar/git/2.18.0: 1,488 files, 295.6MB
==> Upgrading libpng
==> Downloading https://homebrew.bintray.com/bottles/libpng-1.6.35.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libpng-1.6.35.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/libpng/1.6.35: 26 files, 1.2MB
==> Upgrading node-build
==> Downloading https://github.com/nodenv/node-build/archive/v3.0.15.tar.gz
==> Downloading from https://codeload.github.com/nodenv/node-build/tar.gz/v3.0.15
######################################################################## 100.0%
==> ./install.sh
🍺  /usr/local/Cellar/node-build/3.0.15: 493 files, 569.6KB, built in 4 seconds
==> Upgrading trash
==> Downloading https://homebrew.bintray.com/bottles/trash-0.9.2.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring trash-0.9.2.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/trash/0.9.2: 5 files, 40.6KB
==> Upgrading ruby-build
==> Downloading https://github.com/rbenv/ruby-build/archive/v20180618.tar.gz
==> Downloading from https://codeload.github.com/rbenv/ruby-build/tar.gz/v20180618
######################################################################## 100.0%
==> ./install.sh
🍺  /usr/local/Cellar/ruby-build/20180618: 405 files, 204.8KB, built in 4 seconds
==> Upgrading php
==> Installing dependencies for php: freetds
==> Installing php dependency: freetds
==> Downloading https://homebrew.bintray.com/bottles/freetds-1.00.94.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring freetds-1.00.94.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/freetds/1.00.94: 2,094 files, 11.9MB
==> Installing php
==> Downloading https://homebrew.bintray.com/bottles/php-7.2.8.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring php-7.2.8.high_sierra.bottle.tar.gz
==> /usr/local/Cellar/php/7.2.8/bin/pear config-set php_ini /usr/local/etc/php/7.2/php.ini system
==> /usr/local/Cellar/php/7.2.8/bin/pear config-set php_dir /usr/local/share/pear system
==> /usr/local/Cellar/php/7.2.8/bin/pear config-set doc_dir /usr/local/share/pear/doc system
==> /usr/local/Cellar/php/7.2.8/bin/pear config-set ext_dir /usr/local/lib/php/pecl/20170718 system
==> /usr/local/Cellar/php/7.2.8/bin/pear config-set bin_dir /usr/local/opt/php/bin system
==> /usr/local/Cellar/php/7.2.8/bin/pear config-set data_dir /usr/local/share/pear/data system
==> /usr/local/Cellar/php/7.2.8/bin/pear config-set cfg_dir /usr/local/share/pear/cfg system
==> /usr/local/Cellar/php/7.2.8/bin/pear config-set www_dir /usr/local/share/pear/htdocs system
==> /usr/local/Cellar/php/7.2.8/bin/pear config-set man_dir /usr/local/share/man system
==> /usr/local/Cellar/php/7.2.8/bin/pear config-set test_dir /usr/local/share/pear/test system
==> /usr/local/Cellar/php/7.2.8/bin/pear config-set php_bin /usr/local/opt/php/bin/php system
==> /usr/local/Cellar/php/7.2.8/bin/pear update-channels
==> Caveats
To enable PHP in Apache add the following to httpd.conf and restart Apache:
    LoadModule php7_module /usr/local/opt/php/lib/httpd/modules/libphp7.so

    <FilesMatch \.php$>
        SetHandler application/x-httpd-php
    </FilesMatch>

Finally, check DirectoryIndex includes index.php
    DirectoryIndex index.php index.html

The php.ini and php-fpm.ini file can be found in:
    /usr/local/etc/php/7.2/

To have launchd start php now and restart at login:
  brew services start php
Or, if you don't want/need a background service you can just run:
  php-fpm
==> Summary
🍺  /usr/local/Cellar/php/7.2.8: 515 files, 79.1MB
==> Upgrading nginx
==> Downloading https://homebrew.bintray.com/bottles/nginx-1.15.2.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring nginx-1.15.2.high_sierra.bottle.tar.gz
==> Caveats
Docroot is: /usr/local/var/www

The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.

nginx will load all files in /usr/local/etc/nginx/servers/.

To have launchd start nginx now and restart at login:
  brew services start nginx
Or, if you don't want/need a background service you can just run:
  nginx
==> Summary
🍺  /usr/local/Cellar/nginx/1.15.2: 23 files, 1.4MB
==> Upgrading mysql
==> Downloading https://homebrew.bintray.com/bottles/mysql-8.0.12.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring mysql-8.0.12.high_sierra.bottle.tar.gz
==> Caveats
We've installed your MySQL database without a root password. To secure it run:
    mysql_secure_installation

MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -uroot

To have launchd start mysql now and restart at login:
  brew services start mysql
Or, if you don't want/need a background service you can just run:
  mysql.server start
==> Summary
🍺  /usr/local/Cellar/mysql/8.0.12: 255 files, 233.0MB
==> Upgrading imagemagick
==> Downloading https://homebrew.bintray.com/bottles/imagemagick-7.0.8-8.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring imagemagick-7.0.8-8.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/imagemagick/7.0.8-8: 1,516 files, 23.1MB
==> Upgrading pyenv
==> Downloading https://homebrew.bintray.com/bottles/pyenv-1.2.6.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring pyenv-1.2.6.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/pyenv/1.2.6: 607 files, 2.4MB
==> Caveats
==> git
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions and functions have been installed to:
  /usr/local/share/zsh/site-functions

Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/git
==> php
To enable PHP in Apache add the following to httpd.conf and restart Apache:
    LoadModule php7_module /usr/local/opt/php/lib/httpd/modules/libphp7.so

    <FilesMatch \.php$>
        SetHandler application/x-httpd-php
    </FilesMatch>

Finally, check DirectoryIndex includes index.php
    DirectoryIndex index.php index.html

The php.ini and php-fpm.ini file can be found in:
    /usr/local/etc/php/7.2/

To have launchd start php now and restart at login:
  brew services start php
Or, if you don't want/need a background service you can just run:
  php-fpm
==> nginx
Docroot is: /usr/local/var/www

The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.

nginx will load all files in /usr/local/etc/nginx/servers/.

To have launchd start nginx now and restart at login:
  brew services start nginx
Or, if you don't want/need a background service you can just run:
  nginx
==> mysql
We've installed your MySQL database without a root password. To secure it run:
    mysql_secure_installation

MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -uroot

To have launchd start mysql now and restart at login:
  brew services start mysql
Or, if you don't want/need a background service you can just run:
  mysql.server start

Now PHP worked again, so I made another new Laravel site, added Twill, and this time when I ran php artisan twill:setup it only copied the migration files and then stopped, and then after a minute or two failed with this error:

   PDOException  : SQLSTATE[HY000] [2006] MySQL server has gone away

  at /Users/jacob/Sites/twill/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
    64|         if (class_exists(PDOConnection::class) && ! $this->isPersistentConnection($options)) {
    65|             return new PDOConnection($dsn, $username, $password, $options);
    66|         }
    67|
  > 68|         return new PDO($dsn, $username, $password, $options);
    69|     }
    70|
    71|     /**
    72|      * Determine if the connection is persistent.

  Exception trace:

  1   PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=twill", "admin", "admin", [])
      /Users/jacob/Sites/twill/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68

  2   Illuminate\Database\Connectors\Connector::createPdoConnection("mysql:host=127.0.0.1;port=3306;dbname=twill", "admin", "admin", [])
      /Users/jacob/Sites/twill/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:98

  Please use the argument -v to see more details.

My databases are still there and MySQL is running normally—the Laravel sites I had set up before are working, and I can see the data in MySQL with DataGrip and log in on the command line, but I can't do migrations. Regardless of which database and user I try, in my Twill test project or my other Laravel apps from before this or in a new one I made after trying everything else, trying to run php artisan migrate tells me the MySQL server has gone away.

I restarted all my brew services a bunch of times, and reinstalled MySQL with homebrew, and still get the same error, even though apparently my apps can still connect to the DB because they're loading data when I visit them in a browser.

Any suggestions would be appreciated!! I can't really use Laravel now and that's a bit of a problem! I can't figure out what twill:setup or yarn cms-build could have done that would cause any of this.

Thanks!

missing in documents

i think in installation document something is missing
does need update packages.json dependecies ?

because when i run npm run cms-build throws to error

Emitted 'error' event at:
    at writeAfterEnd (_stream_writable.js:245:10)
    at PassThrough.Writable.write (_stream_writable.js:291:5)
    [... lines matching original stack trace ...]
    at Unzip.write (/usr/local/lib/node_modules/npm/node_modules/tar/node_modules/minizlib/index.js:284:29)
events.js:167     ░⸩ ⠙ extractTree: sill extractTree [email protected] -> /Users/davood/Desktop/twill/vendor/area17/twill/node_modules/next-tick
      throw er; // Unhandled 'error' event
      ^

Error [ERR_STREAM_WRITE_AFTER_END]: write after end
    at writeAfterEnd (_stream_writable.js:243:12)
    at PassThrough.Writable.write (_stream_writable.js:291:5)
    at PassThrough.Writable.end (_stream_writable.js:579:10)
    at ReadEntry.entry.on (/usr/local/lib/node_modules/npm/node_modules/libcipm/node_modules/pacote/lib/extract-stream.js:19:41)
    at ReadEntry.emit (events.js:187:15)
    at ReadEntry.emit (/usr/local/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:301:25)
    at ReadEntry.[maybeEmitEnd] (/usr/local/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:252:12)
    at ReadEntry.end (/usr/local/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:165:27)
    at Unpack.[consumeBody] (/usr/local/lib/node_modules/npm/node_modules/tar/lib/parse.js:210:13)
    at Unpack.[consumeChunkSub] (/usr/local/lib/node_modules/npm/node_modules/tar/lib/parse.js:391:40)
    at Unpack.[consumeChunk] (/usr/local/lib/node_modules/npm/node_modules/tar/lib/parse.js:362:30)
    at Unzip.(anonymous function).on.chunk (/usr/local/lib/node_modules/npm/node_modules/tar/lib/parse.js:291:59)
    at Unzip.emit (events.js:182:13)
    at Unzip.emit (/usr/local/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:301:25)
    at Unzip.write (/usr/local/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:102:17)
    at Unzip.write (/usr/local/lib/node_modules/npm/node_modules/tar/node_modules/minizlib/index.js:284:29)
Emitted 'error' event at:
    at writeAfterEnd (_stream_writable.js:245:10)
    at PassThrough.Writable.write (_stream_writable.js:291:5)
    [... lines matching original stack trace ...]
    at Unzip.write (/usr/local/lib/node_modules/npm/node_modules/tar/node_modules/minizlib/index.js:284:29)
npm ERR! cancel after 1 retries!

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/davood/.npm/_logs/2018-07-08T14_20_16_618Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ cms-build: `npm run cms-copy-blocks && cd vendor/area17/twill && npm ci && npm run prod && cp -R public/ ${INIT_CWD}/public`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ cms-build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/davood/.npm/_logs/2018-07-08T14_20_16_698Z-debug.log

Multiple browser inputs for a single module

Does the name for a browser input need to match the module name? I would like to have three separate browser inputs that all use a single module, but when I gave each input a unique name, nothing was saved. Changing the name to match the module name allows me to save them, but that prevents me from having three separate inputs with different items from the module for each one. Is there a way around this? Or in this instance would I need to create three separate tables in the database, one for each input?

Unable to get blocks to work

Hi,

I'm using Twill 1.2 & Laravel 5.7 in Homestead.

I implemented the example code in the documentation under "Adding Blocks", I added the Quote block as described. All seemed to go well, but there are no textareas inside them so I can't enter any text:

screen shot 2018-10-24 at 19 14 47

I guess (I'm not very experienced with Vue, sorry!) that the Vue components inside the blocks aren't rendering, as I can still see the a17-block-quote tags within the blocks in the devtools inspector?

I've gone through the steps in the docs several times, from a fresh install also, and can't work out what the problem is. I'd very much appreciate it if you could take a look, an example can be found at https://github.com/sebastianlenton/twill-test

Thanks,
Seb

Json datatype support in DB engines

Hi.

I advise to not use the json datatype, as some versions of MySQL and MariaDB do not support it. It can be replaced with text for a easy installation.

Dashboard translation?

Hi. First thanks for your awesome package.

Will be useful if you add the dashboard strings as a Laravel syntax so in case we want to translate the dashboard we can use php array files or just the json file.

What do you think?

Regards!

UpdateOrCreate fail with translated model

Hey,

Bad coding or Bug, i can't tell, but i got an issue when i try to use the function updateOrCreate with translated attributes.

That code works :

// Create movie
        $movieNew = app(MovieRepository::class)->updateOrCreate(
        ['dorcel_id'=> $movie['ids']['dorcelId']],
        [
            'public'=>1,
            'published'=>1,
            'languages' => [
                 ['value'=> "en", 'published'=> true],
                 ['value'=> "fr", 'published'=> true],
            ],
            /*'title' => [
                'en'=> $movie['titles']['en'], 
                'fr'=> $movie['titles']['fr'], 
            ],*/
            'studio' => $movie['studio'],
            'director'=> $movie['director'],
            'audio'=> $movie['languages'],
            'duration'=> $movie['duration'],
            'year'=> $movie['productionYear'].'-01-01 00:00:00',
            /*'resume' => [
                'en'=> $movie['synops']['en'], 
                'fr'=> $movie['synops']['fr'], 
            ],*/
            'pictures'=>$movie['images'],
        ]); 

This one don't :

// Create movie
        $movieNew = app(MovieRepository::class)->updateOrCreate(
        ['dorcel_id'=> $movie['ids']['dorcelId']],
        [
            'public'=>1,
            'published'=>1,
            'languages' => [
                 ['value'=> "en", 'published'=> true],
                 ['value'=> "fr", 'published'=> true],
            ],
            'title' => [
                'en'=> $movie['titles']['en'], 
                'fr'=> $movie['titles']['fr'], 
            ],
            'studio' => $movie['studio'],
            'director'=> $movie['director'],
            'audio'=> $movie['languages'],
            'duration'=> $movie['duration'],
            'year'=> $movie['productionYear'].'-01-01 00:00:00',
            'resume' => [
                'en'=> $movie['synops']['en'], 
                'fr'=> $movie['synops']['fr'], 
            ],
            'pictures'=>$movie['images'],
        ]); 

Here is the error when first run (so create function) :

ErrorException  : mb_strtolower() expects parameter 1 to be string, array given

  at /Users/volatil/sources/dorcel-360/vendor/laravel/framework/src/Illuminate/Support/Str.php:431
    427|         // Replace @ with the word 'at'
    428|         $title = str_replace('@', $separator.'at'.$separator, $title);
    429| 
    430|         // Remove all characters that are not the separator, letters, numbers, or whitespace.
  > 431|         $title = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', mb_strtolower($title));
    432| 
    433|         // Replace all separator characters and whitespace by a single separator
    434|         $title = preg_replace('!['.preg_quote($separator).'\s]+!u', $separator, $title);
    435| 

  Exception trace:

  1   mb_strtolower(["Road MoviX", "Road Movix"])
      /Users/volatil/sources/dorcel-360/vendor/laravel/framework/src/Illuminate/Support/Str.php:431

  2   Illuminate\Support\Str::slug(["Road MoviX", "Road Movix"], "-", "en")
      /Users/volatil/sources/dorcel-360/vendor/laravel/framework/src/Illuminate/Support/helpers.php:996

And the error when second run (update) :

Illuminate\Database\QueryException  : Array to string conversion (SQL: insert into `movie_translations` (`locale`, `title`, `resume`, `movie_id`, `updated_at`, `created_at`) values (fr, Road MoviX, blablabla, 95, 2018-07-26 11:34:10, 2018-07-26 11:34:10))

  at /Users/volatil/sources/dorcel-360/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
    660|         // If an exception occurs when attempting to run a query, we'll format the error
    661|         // message to include the bindings with SQL, which will make this exception a
    662|         // lot more helpful to the developer instead of just the database's errors.
    663|         catch (Exception $e) {
  > 664|             throw new QueryException(
    665|                 $query, $this->prepareBindings($bindings), $e
    666|             );
    667|         }
    668| 

  Exception trace:

  1   ErrorException::("Array to string conversion")
      /Users/volatil/sources/dorcel-360/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:102

  2   PDOStatement::bindValue(["Road MoviX", "Road Movix"])
      /Users/volatil/sources/dorcel-360/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:102

  Please use the argument -v to see more details. 

Here is the Movie Model :

class Movie extends Model implements Sortable
{
    use HasTranslation, HasSlug, HasFiles, HasPosition, HasRevisions, HasMedias;

    protected $fillable = [
        'published',
        'position',
        'public',
        'featured',
        'publish_start_date',
        'publish_end_date',
        'duration',
        'studio',
        'year',
        'audio',
        'director',
        'pictures',
        'dorcel_id',
    ];

    public $translatedAttributes = [
        'title',
        'resume',
        'active',
    ];

    public $slugAttributes = [
        'title',
    ];

And movieTranslation :

{
    protected $fillable = [
        'title',
        'resume',
        'active',
        'locale',
    ]; 

Any ideas for that ?

Thank you :)

Exception when trying to follow the Adding browser fields documentation

I'm testing out the browser blocks and I've followed the documentation, adding in a products browser block type. When I run php artisan twill:blocks I get the following exception:

 ErrorException  : Route [admin.content.products.browser] not defined. (View: /Users/Beesmum/Dropbox/devilbox/data/www/nin/laravel-project/vendor/area17/twill/views/partials/form/_browser.blade.php) (View: /Users/Beesmum/Dropbox/devilbox/data/www/nin/laravel-project/vendor/area17/twill/views/partials/form/_browser.blade.php)

  at /Users/Beesmum/Dropbox/devilbox/data/www/nin/laravel-project/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php:374
    370|         if (! is_null($route = $this->routes->getByName($name))) {
    371|             return $this->toRoute($route, $parameters, $absolute);
    372|         }
    373| 
  > 374|         throw new InvalidArgumentException("Route [{$name}] not defined.");
    375|     }
    376| 
    377|     /**
    378|      * Get the URL for a given route instance.

  Exception trace:

  1   Illuminate\View\Engines\CompilerEngine::handleViewException(Object(ErrorException))
      /Users/Beesmum/Dropbox/devilbox/data/www/nin/laravel-project/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php:45

  2   ErrorException::("Route [admin.content.products.browser] not defined. (View: /Users/Beesmum/Dropbox/devilbox/data/www/nin/laravel-project/vendor/area17/twill/views/partials/form/_browser.blade.php)")
      /Users/Beesmum/Dropbox/devilbox/data/www/nin/laravel-project/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php:374

Blocks [Some questions]

Hello again. I have some blocks options:

I was able to create this three blocks;

'blocks'   => [
            'title'     => [
                'title'     => 'Title',
                'icon'      => 'text',
                'component' => 'a17-block-title',
            ],
            'images'    => [
                'title'     => 'Image',
                'icon'      => 'image',
                'component' => 'a17-block-image',
            ],
            'contenido' => [
                'title'     => 'Content',
                'icon'      => 'text',
                'component' => 'a17-block-wysiwyg',
            ],
        ],

I create this views inside resources\views:
captura de pantalla 2018-07-16 a las 14 18 26

How I can render for example the title? What I should put in blocks and title views to show the title?

I just be able if I modify the BlocksController@preview method and override the last lines to:

$view = view(config('twill.block_editor.block_single_layout'))->with('content', $renderedBlocks);

return html_entity_decode($view);

So in the title.blade I can see the preview using:

<div class="block__body">
    <h1>{{ $block->translatedinput('text') }}</h1>
</div>

Also, if I attach some image to the Image block, when I save, no mediable is set. So when reload there isn't image.

Thanks!

[Media Library] Filesystem Config not used - Invalid image url

Hi,

i have currently the challenge, that the returned url values for images which has been uploaded locally.

I configured the twill app as following:

//.env
APP_URL=twill.local 
ADMIN_APP_URL=twill.local
ADMIN_APP_PATH=manage
SESSION_DOMAIN=.twill.local
MEDIA_LIBRARY_ENDPOINT_TYPE=local
MEDIA_LIBRARY_LOCAL_PATH=uploads

//config/twill.php
    'media_library' => [
        'disk' => 'public',
        'endpoint_type' => env('MEDIA_LIBRARY_ENDPOINT_TYPE', 's3'),
        'cascade_delete' => env('MEDIA_LIBRARY_CASCADE_DELETE', false),
        'local_path' => env('MEDIA_LIBRARY_LOCAL_PATH'),
        'image_service' => env('MEDIA_LIBRARY_IMAGE_SERVICE', 'A17\Twill\Services\MediaLibrary\Imgix'),
        'acl' => env('MEDIA_LIBRARY_ACL', 'private'),
        'filesize_limit' => env('MEDIA_LIBRARY_FILESIZE_LIMIT', 50),
        'allowed_extensions' => ['svg', 'jpg', 'gif', 'png', 'jpeg'],
    ],

Return URL is the following:

https://uploads235189ba-1726-4a94-930a-0314e749c112/34984697-2186605328021771-2297187018024681472-o.jpg?auto=compress%2Cformat&dpr=1&fit=min&fm=jpg&h=256&q=60

The image is saved successfully, but I expected the file in a different directory (in my case public/storage/uploads/ instead of public/uploads<uuid>/.
( public/storage is available as symlink via php artisan storage:link )

Correct me if I'm wrong, but it seems, that the filesystem configuration is not used in the current version.

Thanks & Greets

Custom Field Types

Hi,

is it currently possible to add custom field types?

Example:

  • Alternative WYSIWYG Editor (e.g. tinymce )

I have checked the code and (for me) it seems it's currently not possible to create custom field types.

Thanks & Greets

Previewing with SPA frontend

Hi there! Let me first thank you for releasing Twill to the public. It really raises the bar for CMSs in terms of flexibility and usability. Finally someone has implemented blocks in a sane manner! However, there is one thing I'm unclear on, and I hope you'll allow me to ask a question here.

In the section Feature list > Developer experience of the docs, you say:

Previewing and side by side comparison of fully rendered frontend site that you’ll get up and running very quickly whatever the way you built your frontend (fully headed Laravel app, hybrid Laravel app with your own custom API endpoints or even full SPA with frameworks like React or Vue)

It is not at all clear to me how one would go about doing so.

Is there a standard way for passing preview data to a separate SPA frontend? How does that work for the individual block views in the editor? Would it require maintaining separate copies of the templates in Blade and my JS framework of choice?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.