1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

laravel-adminでeditorを使う

Last updated at Posted at 2020-04-01

laravel-adminには

    protected function form()
    {
        $form = new Form(new Infomation());
        $form->text('title', __('タイトル'));
        $form->textarea('detail', __('詳細'));
        $form->date('yyyymmdd', __('日付'))->default(date('Y-m-d'));

        return $form;
    }

と普通のtextarea出力の代わりに

$form->editor('detail', __('詳細'));

とリッチテキストで書けるような機能がありますがこれをそのまま使うと
Field type [editor] does not existと表示され使えません。

これを使うようにするには
app/Admin/bootstrap.php

app/Admin/bootstrap.php
Encore\Admin\Form::forget(['map', 'editor']);

の部分を

app/Admin/bootstrap.php
//Encore\Admin\Form::forget(['map', 'editor']);
Encore\Admin\Form::extend('editor', Encore\Admin\Form\Field\Editor::class);

とするだけです

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?