LaravelRUS / SleepingOwlAdmin

🦉 Administrative interface builder for Laravel (Laravel admin)
http://sleepingowladmin.ru/
MIT License
805 stars 217 forks source link

Перестала работать кастомизация таблиц в области #779

Closed FlashWS closed 7 years ago

FlashWS commented 7 years ago

Данный коммит https://github.com/LaravelRUS/SleepingOwlAdmin/commit/d1a9000510628e5f80a5c11a5bfcea551541db58 отвалил функционал расширения таблиц (https://sleepingowl.ru/docs/displays#extend), теперь кастомный класс невозможно отобразить в области before.panel

FlashWS commented 7 years ago
<?php

namespace App\Admin\Displays\Extensions;

use SleepingOwl\Admin\Display\Extension\Extension;
use SleepingOwl\Admin\Contracts\Display\Placable;

class FormSearch extends Extension implements Placable
{
    /**
     * @var string|\Illuminate\View\View
     */
    protected $view = 'admin.displays.extensions.form_search';

    /**
     * @var string
     */
    protected $placement = 'before.panel';

    /**
     * @var array
     */

    protected $fields;

    public function setFields($fields)
    {
        foreach ($fields as $key => $field){
            $fields[$key]['value'] = request()->input($field['name']);
        }

        $this->fields = $fields;
        return $this;
    }

    /**
     * Get the instance as an array.
     *
     * @return array
     */
    public function toArray()
    {
        return array('fields' => $this->fields);
    }

    /**
     * @return string|\Illuminate\View\View
     */
    public function getView()
    {
        return view($this->view);
    }
    /**
     * @param string|\Illuminate\View\View $view
     *
     * @return $this
     */
    public function setView($view)
    {
        $this->view = $view;
        return $this;
    }
    /**
     * @return string
     */
    public function getPlacement()
    {
        return $this->placement;
    }
    /**
     * @param string $placement
     *
     * @return $this
     */
    public function setPlacement($placement)
    {
        $this->placement = $placement;
        return $this;
    }

}