<?php Admin::model('Cartalyst\\Sentinel\\Users\\EloquentUser')->title('Юзеры')->display(function () { $display = AdminDisplay::datatables(); $display->with(); $display->filters([]); $display->columns([Column::string('id')->label('Id'), Column::string('email')->label('Email'), Column::string('first_name')->label('Имя')]); return $display; })->create(function () { $form = AdminForm::form(); $form->items([FormItem::columns()->columns([[FormItem::text('email', 'Email'), FormItem::password('password', 'Пароль'), FormItem::password('password_confirm', 'Подтверждение пароля')], [FormItem::text('first_name', 'Имя'), FormItem::text('last_name', 'Фамилия'), FormItem::view('admin.user_create')]])]); return $form; })->edit(function () { $form = AdminForm::form(); $form->items([FormItem::columns()->columns([[FormItem::text('email', 'Email'), FormItem::password('password', 'Пароль'), FormItem::password('password_confirm', 'Подтверждение пароля')], [FormItem::text('first_name', 'Имя'), FormItem::text('last_name', 'Фамилия'), FormItem::view('admin.user_update')]])]); return $form; });
<?php \Admin::model('App\\Product')->title('Products')->alias('products')->display(function () { $display = AdminDisplay::datatablesAsync(); $display->columns([Column::checkbox(), Column::string('id')->label('#'), Column::string('title')->label('Загаловок'), Column::string('active_status')->label('Статус'), Column::string('publish')->label('Опубликован')]); return $display; })->createAndEdit(function () { $form = AdminForm::tabbed(); $form->items(['Main' => [FormItem::columns()->columns([[FormItem::text('title', 'Загаловок')->required()->unique(), FormItem::textarea('description', 'Описание')->required(), FormItem::timestamp('publish', 'Дата и время публикации')->defaultValue(Carbon\Carbon::now()), FormItem::icheckbox('active', 'Статус')->defaultValue(true), FormItem::text('rest', 'Остаток'), FormItem::text('price', 'Цена')], [FormItem::text('sort', 'сортировка'), FormItem::bsselect('user_id', 'Пользователь')->model('App\\User')->defaultValue(Sentinel::check()->id)->display('email'), FormItem::bsselect('catalog_id', 'Категоря')->model('App\\Catalog')->display('level_label')->disableSort()->required()]])], 'content' => [FormItem::markdown('content', 'Контент')], 'images' => [FormItem::images('gallery', 'Картинки')], 'files' => [FormItem::view('suroviy.soa_addon::admin.elfinder')]]); return $form; });
<?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'); });