Exemplo n.º 1
0
<?php

Admin::model(App\Product::class)->title('Управление товарами')->display(function () {
    $display = AdminDisplay::datatables();
    $display->with('category');
    $display->filters([Filter::related('category_id')->model(App\Category::class)]);
    $display->columns([Column::string('name')->label('Название'), Column::string('price')->label('Цена'), Column::image('image')->label('Изображение'), Column::string('category.title')->label('Категория')->append(Column::filter('category_id')), Column::custom()->label('Топ')->callback(function ($instance) {
        return $instance->active ? 'да' : 'нет';
    }), Column::string('product_rest')->label('Остаток')]);
    return $display;
})->createAndEdit(function () {
    $form = AdminForm::form();
    $form->items([FormItem::text('name', 'Название'), FormItem::text('slug', 'Slug'), FormItem::text('price', 'Цена'), FormItem::image('image', 'Изображение'), FormItem::select('category_id', 'Категория')->model(App\Category::class)->display('title'), FormItem::checkbox('active', 'Топ'), FormItem::ckeditor('description', 'Описание'), FormItem::text('product_rest', 'Количество товара')->defaultValue('0')]);
    return $form;
});
Exemplo n.º 2
0
<?php

Admin::model(App\Models\Task::class)->title('Задачи')->with('subject')->filters(function () {
})->columns(function () {
    Column::string('number_task', 'Number_task');
    Column::image('image')->sortable(false);
    Column::string('experience', 'Experience');
    Column::string('gold', 'Gold');
    Column::string('grade', 'Grade');
    Column::string('subject.name', 'Subject')->append(Column::filter('subject_id')->value('subject_id'));
    Column::string('answer', 'Answer');
    Column::string('detail', 'detail');
    Column::string('set_of_task', 'Set_of_task');
})->form(function () {
    FormItem::text('number_task', 'Number Task');
    FormItem::image('image', 'Image');
    FormItem::text('experience', 'Experience');
    FormItem::text('gold', 'Gold');
    FormItem::text('grade', 'Grade');
    FormItem::select('subject_id', 'Subject')->list(App\Models\Subject::class);
    FormItem::text('answer', 'Answer');
    FormItem::text('detail', 'detail');
    FormItem::text('set_of_task', 'Set Of Task');
});
Exemplo n.º 3
0
<?php

Admin::model('App\\Contact3')->title('Contact')->alias('contacts3')->display(function () {
    $display = AdminDisplay::table();
    $display->with('country', 'companies');
    $display->filters([Filter::related('country_id')->model('App\\Country')]);
    $display->columns([Column::image('photo')->label('Photo'), Column::string('fullName')->label('Name'), Column::datetime('birthday')->label('Birthday')->format('d.m.Y'), Column::string('country.title')->label('Country')->append(Column::filter('country_id')), Column::lists('companies.title')->label('Companies')]);
    return $display;
})->createAndEdit(function ($id) {
    $display = AdminDisplay::tabbed();
    $display->tabs(function () use($id) {
        $tabs = [];
        $form = AdminForm::form();
        $form->items([FormItem::columns()->columns([[FormItem::text('firstName', 'First Name')->required(), FormItem::text('lastName', 'Last Name')->required(), FormItem::text('phone', 'Phone'), FormItem::text('address', 'Address')], [FormItem::image('photo', 'Photo'), FormItem::date('birthday', 'Birthday')->format('d.m.Y')], [FormItem::select('country_id', 'Country')->model('App\\Country')->display('title'), FormItem::textarea('comment', 'Comment')]])]);
        $tabs[] = AdminDisplay::tab($form)->label('Main Form')->active(true);
        if (!is_null($id)) {
            $instance = App\Contact::find($id);
            if ($instance->country_id) {
                $country = Admin::model('App\\Country')->fullEdit($instance->country_id);
                $tabs[] = AdminDisplay::tab($country)->label('Form from Related Model (Country)');
            }
            $companies = Admin::model('App\\Company')->display();
            $companies->scope('withContact', $id);
            $companies->parameters(['contact_id' => $id]);
            $tabs[] = AdminDisplay::tab($companies)->label('Display from Related Model (Companies)');
        }
        return $tabs;
    });
    return $display;
})->delete(null);
Exemplo n.º 4
0
<?php

Admin::model(App\Models\Category::class)->title('Категории')->with()->filters(function () {
})->columns(function () {
    Column::string('id', 'ID');
    Column::string('name', 'Название');
    Column::string('alias', 'Альяс');
    Column::image('image', 'Рисунок');
})->form(function () {
    FormItem::text('name', 'Название');
    FormItem::text('alias', 'Альяс');
    FormItem::image('image', 'Рисунок');
});
Exemplo n.º 5
0
<?php

/**
 * Created by IntelliJ IDEA.
 * User: yarik
 * Date: 20.10.15
 * Time: 21:22
 */
Admin::model(\App\Slider::class)->title('Slider')->alias('slider')->display(function () {
    $display = AdminDisplay::table();
    $display->columns([Column::string('active')->label('Active'), Column::string('position')->label('Position'), Column::string('title')->label('Title'), Column::string('url')->label('Url'), Column::image('image')->label('Image')]);
    return $display;
})->createAndEdit(function () {
    $form = AdminForm::form();
    $form->items([FormItem::text('active', 'Active')->required(), FormItem::text('position', 'Position')->required(), FormItem::text('title', 'Title')->required(), FormItem::text('url', 'url')->required(), FormItem::image('image', 'Photo')->required()]);
    return $form;
});
Exemplo n.º 6
0
<?php

Admin::model('App\\News')->title('Noticias')->display(function () {
    $display = AdminDisplay::datatables();
    $display->with('gallery');
    $display->filters([Filter::related('gallery_id')->model('App\\Gallery')]);
    $display->columns([Column::image('thumbnail'), Column::string('title')->label('Title'), Column::string('short_text')->label('Short_text')]);
    return $display;
})->createAndEdit(function () {
    $form = AdminForm::form();
    $form->items([FormItem::columns()->columns([[FormItem::text('title', 'Title'), FormItem::text('short_text', 'Shorttext'), FormItem::select('gallery_id', 'Galería')->model('App\\Gallery')->display('title'), FormItem::ckeditor('text', 'Text')], [FormItem::checkbox('pin', 'Destacada'), FormItem::image('thumbnail', 'Thumbnail')]])]);
    return $form;
});
Exemplo n.º 7
0
<?php

Admin::model('App\\Product')->title('Товары')->display(function () {
    $display = AdminDisplay::datatables();
    $display->columns([Column::string('id')->label('ID'), Column::string('title')->label('Название'), Column::string('ym_url')->label('ЯМ ссылка')->append(Column::url('ym_url')), Column::image('image_url')->label('Ссылка на картинку')]);
    $display->columnFilters([null, ColumnFilter::text()->placeholder('Товар'), null, null]);
    return $display;
})->createAndEdit(function () {
    $form = AdminForm::form();
    $form->items([FormItem::text('title', 'Название')->required(), FormItem::text('ym_url', 'ЯМ ссылка')->required(), FormItem::text('image_url', 'Ссылка на картинку')->required()]);
    return $form;
});
Exemplo n.º 8
0
<?php

/**
 * @var \SleepingOwl\Admin\Model\ModelConfiguration
 */
$model = Admin::model(\App\Slide::class);
$model->title('Слайды');
$model->display(function () {
    $display = AdminDisplay::datatables();
    $display->with('page');
    $display->columns([Column::image('image')->label('Картинка')->orderable(false), Column::string('title')->label('Заголовок')->orderable(false), Column::string('description')->label('Описание')->orderable(false), Column::string('page.title')->label('Страница')->append(Column::filter('id')->model(\App\Page::class)->field('page_id'))->orderable(false), Column::order()->orderable(false)]);
    $display->apply(function ($query) {
        $query->orderBy('sort', 'asc');
    });
    return $display;
});
$model->createAndEdit(function ($id) use($model) {
    $model->title($id ? 'Редактировать слайд' : 'Создать слайд');
    $form = AdminForm::form();
    $form->items([FormItem::columns()->columns([[FormItem::text('title', 'Заголовок')->required(), FormItem::select('page_id', 'Страница')->model(\App\Page::class)->display('title')->required(), FormItem::textarea('description', 'Описание')->rows(4)], [FormItem::image('image', 'Картинка')->required(true)]])]);
    return $form;
});
Exemplo n.º 9
0
<?php

/*
 * This is a simple example of the main features.
 * For full list see documentation.
 */
Admin::model('Crimibook\\Models\\Status')->title('Status')->display(function () {
    $display = AdminDisplay::datatables();
    $display->with();
    $display->filters([Filter::related('user_id')->model('Crimibook\\User')]);
    $display->columns([Column::string('users.name')->label('Owner')->append(Column::filter('user_id')), Column::string('body')->label('Text'), Column::string('image_path')->label('Photo path'), Column::image('image_path')->label('Photo')]);
    return $display;
})->createAndEdit(function () {
    $form = AdminForm::form();
    $form->items([FormItem::select('user_id', 'User')->model('Crimibook\\User')->display('name')->required(), FormItem::text('body', 'Body')->required(), FormItem::text('image_path', 'Photo')]);
    return $form;
});
Exemplo n.º 10
0
<?php

Admin::model('App\\Models\\Advert')->title('Рекламные блоки')->display(function () {
    $display = AdminDisplay::datatables();
    $display->with();
    $display->filters([Filter::field('active')->title('Вкл')->alias('ddddd')]);
    $display->columns([Column::string('id')->label('Id'), Column::string('name')->label('Название'), Column::string('place')->label('Место'), Column::string('active')->label('Включен'), Column::image('img')->label('Img')]);
    return $display;
})->createAndEdit(function () {
    $form = AdminForm::form();
    $form->items([FormItem::columns()->columns([[FormItem::text('name', 'Название (только для админа)')], [FormItem::checkbox('active', 'Включен')]]), FormItem::columns()->columns([[FormItem::select('place', 'Место посадки')->enum(['top1', 'aside1', 'aside2', 'recipie_step', 'foot_script'])], []]), FormItem::columns()->columns([[FormItem::text('title', 'Заголовок')], [FormItem::checkbox('show_title', 'Показывать')]]), FormItem::columns()->columns([[FormItem::image('img', 'Изображение')], [FormItem::checkbox('show_img', 'Показывать'), FormItem::text('imglink', 'Ссылка')]]), FormItem::columns()->columns([[FormItem::textarea('text', 'Содержимое')], [FormItem::checkbox('show_text', 'Показывать')]])]);
    return $form;
});
Exemplo n.º 11
0
<?php

Admin::model('App\\Contact')->title('Contacts')->display(function () {
    $display = AdminDisplay::table();
    $display->with('country', 'companies');
    $display->filters([Filter::related('country_id')->model('App\\Country')]);
    $display->columns([Column::image('photo')->label('Photo<br/><small>(image)</small>'), Column::string('fullName')->label('Name<br/><small>(string with accessor)</small>'), Column::datetime('birthday')->label('Birthday<br/><small>(datetime)</small>')->format('d.m.Y'), Column::string('country.title')->label('Country<br/><small>(string from related model)</small>')->append(Column::filter('country_id')), Column::count('companies')->label('Companies<br/><small>(count)</small>'), Column::lists('companies.title')->label('Companies<br/><small>(lists)</small>'), Column::custom()->label('Has Photo?<br/><small>(custom)</small>')->callback(function ($instance) {
        return $instance->photo ? '&check;' : '-';
    }), Column::action('my_action')->label('<small>(action)</small>')->value('Custom action')->target('_blank')->callback(function ($instance) {
        dd('Custom action called with instance:', $instance->toArray());
    })]);
    return $display;
})->createAndEdit(null)->delete(null);
Exemplo n.º 12
0
<?php

Admin::model('App\\Product')->title('Productos')->display(function () {
    $display = AdminDisplay::datatables();
    $display->with('colors');
    // $display->filters([
    // ]);
    $display->columns([Column::image('thumbnail')->label('Miniatura'), Column::string('title')->label('Título'), Column::lists('colors.name')]);
    return $display;
})->createAndEdit(function () {
    $form = AdminForm::tabbed();
    $form->items(['General' => [FormItem::text('title', 'Título'), FormItem::text('subtitle', 'Subtítulo'), FormItem::multiselect('colors', 'Colores')->model('App\\Color')->display('name'), FormItem::select('category_id', 'Categoria')->model('App\\Category')->display('name'), FormItem::text('tags', 'Serie')], 'Extra' => [FormItem::ckeditor('description', 'Descripcion'), FormItem::jsonField('specs', 'Especificaciones'), FormItem::ckeditor('details', 'Detalles')], 'Media' => [FormItem::image('thumbnail', 'Miniatura'), FormItem::images('images', 'Imagenes')], 'Venta' => [FormItem::text('price', 'Precio'), FormItem::text('link', 'Link a tienda nube')]]);
    return $form;
});
Exemplo n.º 13
0
<?php

Admin::model('\\Contact')->title('Contacts')->with('country', 'companies')->filters(function () {
    ModelItem::filter('country_id')->title()->from('\\Country');
    ModelItem::filter('withoutCompanies')->scope('withoutCompanies')->title('without companies');
})->columns(function () {
    Column::image('photo');
    Column::string('full_name', 'Name')->orderBy('lastName')->sortableDefault();
    Column::date('birthday', 'Birthday')->format('medium', 'none');
    Column::string('country.title', 'Country')->append(Column::filter('country_id')->value('country.id'));
    Column::lists('companies.title', 'Companies');
    Column::action('show', 'Custom action')->target('_blank')->icon('fa-globe')->style('long')->callback(function ($instance) {
        echo 'You are trying to call custom action "show" with row id "' . $instance->id . '"';
        die;
    });
})->form(function () {
    FormItem::text('firstName', 'First Name')->required();
    FormItem::text('lastName', 'Last Name')->required();
    FormItem::image('photo', 'Photo');
    FormItem::date('birthday', 'Birthday');
    FormItem::text('phone', 'Phone');
    FormItem::text('address', 'Address');
    FormItem::select('country_id', 'Country')->list('\\Country')->required();
    FormItem::multiSelect('companies', 'Companies')->list('\\Company')->value('companies.company_id');
    FormItem::ckeditor('comment', 'Comment');
    FormItem::view('admin.form.comment');
});
Exemplo n.º 14
0
<?php

Admin::model(\App\Models\News::class)->title('News')->with()->filters(function () {
})->columns(function () {
    Column::string('title', 'Title');
    Column::date('date', 'Date')->format('medium', 'none');
    Column::string('published', 'Published');
    //	Column::string('text', 'Text');
    Column::image('photo', 'Photo')->sortable(false);
})->form(function () {
    FormItem::text('title', 'Title')->required();
    FormItem::date('date', 'Date')->required();
    FormItem::checkbox('published', 'Published')->required();
    FormItem::image('photo', 'Photo');
    FormItem::ckeditor('text', 'Text')->required();
});
Exemplo n.º 15
0
<?php

/*
 * This is a simple example of the main features.
 * For full list see documentation.
 */
Admin::model('App\\Models\\User')->title('Users')->columns(function () {
    Column::image('avatar');
    Column::string('name', 'Имя');
    Column::string('surname', 'Фамилия');
    Column::string('login', 'Login');
    //Column::string('email', 'Email');
    Column::string('description', 'Описание');
    Column::string('group', 'Номер группы');
})->form(function () {
    FormItem::image('avatar', 'Аватар');
    FormItem::text('name', 'Имя')->required();
    FormItem::text('surname', 'Фамилия')->required();
    FormItem::text('login', 'Login');
    FormItem::text('email', 'Email')->unique();
    FormItem::text('password', 'Пароль')->unique();
    FormItem::textarea('description', 'Описание');
    FormItem::text('group', 'Номер группы');
});
Exemplo n.º 16
0
<?php

Admin::model('App\\Marker')->title('Маркеры')->display(function () {
    $display = AdminDisplay::datatables();
    $display->with('markerGroups');
    $display->filters([]);
    $display->columns([Column::string('name')->label('Имя'), Column::lists('markerGroups.name')->label('Входит в группы'), Column::image('ico')->label('Иконка')]);
    return $display;
})->create(function () {
    $form = AdminForm::form();
    $form->items([FormItem::columns()->columns([[FormItem::text('name', 'Имя'), FormItem::image('ico', 'Иконка'), FormItem::checkbox('showadd', 'Показывать в форме добавления рецепта')->defaultValue(0), FormItem::text('sortorder', 'Порядок сортировки')], [FormItem::text('metakey', 'Meta Keywords'), FormItem::text('metadesk', 'Meta Description'), FormItem::text('slug', 'Slug (если пустое, генерируется реалтайм из имени)'), FormItem::text('title', 'Title')]])]);
    return $form;
})->edit(function () {
    $form = AdminForm::form();
    $form->items([FormItem::columns()->columns([[FormItem::text('name', 'Имя'), FormItem::image('ico', 'Иконка'), FormItem::checkbox('showadd', 'Показывать в форме добавления рецепта'), FormItem::text('sortorder', 'Порядок сортировки')], [FormItem::text('metakey', 'Meta Keywords'), FormItem::text('metadesk', 'Meta Description'), FormItem::text('slug', 'Slug (если пустое, генерируется реалтайм из имени)'), FormItem::text('title', 'Title')]])]);
    return $form;
});
Exemplo n.º 17
0
<?php

Admin::model('App\\Models\\Product')->title('')->display(function () {
    $display = AdminDisplay::datatables();
    $display->with();
    $display->filters([]);
    $display->columns([Column::string('title')->label('Title'), Column::image('image')->label('Title'), Column::string('m_desc')->label('Description'), Column::string('price')->label('Price'), Column::string('discount')->label('Discount'), Column::custom()->label('Active')->callback(function ($instance) {
        return $instance->active ? '&check;' : '-';
    })]);
    return $display;
})->createAndEdit(function () {
    $form = AdminForm::form();
    $form->items([FormItem::text('title', 'Title')->required(), FormItem::text('slug', 'Slug')->required(), FormItem::text('m_desc', 'Mini Description')->required(), FormItem::ckeditor('f_desc', 'Full Description')->required(), FormItem::image('image', 'Image')->required(), FormItem::select('server_id', 'Server')->model('App\\Models\\Server')->display('name')->required(), FormItem::text('command', 'Command')->required(), FormItem::text('price', 'Price')->required(), FormItem::text('discount', 'Discount')->defaultValue(0)->required()->validationRule(['numeric', 'max:99']), FormItem::checkbox('countable', 'Countable'), FormItem::checkbox('active', 'Active')]);
    return $form;
});