<?php /* * This is a simple example of the main features. * For full list see documentation. */ Admin::model('App\\Models\\Sector')->title('Sectors')->alias('sector')->display(function () { $display = AdminDisplay::datatablesAsync(); $display->order([[0, 'asc']]); $display->columns([Column::string('id')->label('Id'), Column::string('name')->label('Name'), Column::datetime('created_at')->format('d-m-Y h:i:s')->label('Created'), Column::datetime('updated_at')->format('d-m-Y h:i:s')->label('Updated')]); $display->columnFilters([null, ColumnFilter::text()->placeholder('Name'), ColumnFilter::range()->from(ColumnFilter::date()->format('d.m.Y')->placeholder('From Date'))->to(ColumnFilter::date()->format('d.m.Y')->placeholder('To Date')), ColumnFilter::range()->from(ColumnFilter::date()->format('d.m.Y')->placeholder('From Date'))->to(ColumnFilter::date()->format('d.m.Y')->placeholder('To Date'))]); return $display; })->createAndEdit(function () { $form = AdminForm::form(); $form->items([FormItem::text('name', 'Name')->required()]); return $form; });
<?php /* * This is a simple example of the main features. * For full list see documentation. */ Admin::model('App\\Models\\Member')->title('Members')->alias('member')->display(function () { $display = AdminDisplay::datatablesAsync(); $display->order([[0, 'asc']]); $display->columns([Column::checkbox(), Column::string('organization.name')->label('Organization'), Column::string('status')->label('Status'), Column::string('type')->label('Type'), Column::string('title')->label('Function'), Column::string('first_name')->label('Firstname'), Column::string('last_name')->label('Lastname'), Column::string('email')->label('Email'), Column::custom()->label('Enabled')->callback(function ($instance) { return $instance->is_enabled ? '✓' : '-'; }), Column::datetime('created_at')->format('d-m-Y h:i:s')->label('Created')]); $display->columnFilters([null, ColumnFilter::text()->placeholder('Organization'), null, null, null, null, null, ColumnFilter::text()->placeholder('Email'), null, ColumnFilter::range()->from(ColumnFilter::date()->format('d.m.Y')->placeholder('From Date'))->to(ColumnFilter::date()->format('d.m.Y')->placeholder('To Date'))]); return $display; })->edit(function () { $form = AdminForm::form(); $form->items([FormItem::checkbox('is_enabled', 'Enabled'), FormItem::select('organization_id', 'Organization')->model('App\\Models\\Organization')->display('name'), FormItem::text('first_name', 'Firstname'), FormItem::text('last_name', 'Lastname'), FormItem::text('email', 'Email')->unique(), FormItem::text('phone', 'Phone'), FormItem::text('url', 'Website'), FormItem::text('title', 'Function'), FormItem::custom()->display(function ($instance) { return '<div class="form-group "> <label for="key">Key</label><br/> ' . $instance->key . ' </div>'; }), FormItem::custom()->display(function ($instance) { return '<div class="form-group "> <label for="key">Status</label><br/> ' . $instance->status . ' </div>'; }), FormItem::custom()->display(function ($instance) { return '<div class="form-group "> <label for="key">Type</label><br/> ' . $instance->type . ' </div>';
<?php Admin::model('App\\UserProduct')->title('Юзер-Товар')->display(function () { $display = AdminDisplay::datatables(); $display->columns([Column::string('id')->label('ID'), Column::string('user.name')->label('Юзер'), Column::string('product.title')->label('Товар'), Column::string('review')->label('Отзыв'), Column::string('status')->label('Статус'), Column::string('sum')->label('Сумма'), Column::string('created_at')->label('Дата'), Column::string('updated_at')->label('Обновлено')]); $display->columnFilters([null, ColumnFilter::text()->placeholder('Юзер'), null, null, null, null, ColumnFilter::range()->from(ColumnFilter::date()->format('d.m.Y')->placeholder('С'))->to(ColumnFilter::date()->format('d.m.Y')->placeholder('По')), null]); return $display; })->edit(function () { $form = AdminForm::form(); $form->items([FormItem::select('user_id', 'Юзер')->model('App\\User')->display('name')->required(), FormItem::select('product_id', 'Товар')->model('App\\Product')->display('title')->required(), FormItem::text('review', 'Отзыв'), FormItem::select('status', 'Статус')->enum(['M', 'A', 'D', 'R'])->nullable()]); return $form; })->create(function () { $form = AdminForm::form(); $form->items([FormItem::select('user_id', 'Юзер')->model('App\\User')->display('name')->required(), FormItem::select('product_id', 'Товар')->model('App\\Product')->display('title')->required()]); return $form; });
<?php Admin::model('App\\Contact4')->title('Contact')->alias('contacts4')->display(function () { $display = AdminDisplay::datatables(); $display->with('country', 'companies'); $display->filters([Filter::related('country_id')->model('App\\Country')]); $display->order([[1, 'asc']]); $display->columns([Column::image('photo')->label('Photo'), Column::string('fullName')->label('Name'), Column::string('height')->label('Height'), 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')]); $display->columnFilters([null, ColumnFilter::text()->placeholder('Full Name'), ColumnFilter::range()->from(ColumnFilter::text()->placeholder('From'))->to(ColumnFilter::text()->placeholder('To')), ColumnFilter::range()->from(ColumnFilter::date()->placeholder('From Date')->format('d.m.Y'))->to(ColumnFilter::date()->placeholder('To Date')->format('d.m.Y')), ColumnFilter::select()->placeholder('Country')->model('\\App\\Country')->display('title'), ColumnFilter::text()->placeholder('Companies')]); return $display; })->createAndEdit(function ($id) { return null; })->delete(null);