当前位置: 首页>>代码示例>>PHP>>正文


PHP Column::action方法代码示例

本文整理汇总了PHP中Column::action方法的典型用法代码示例。如果您正苦于以下问题:PHP Column::action方法的具体用法?PHP Column::action怎么用?PHP Column::action使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Column的用法示例。


在下文中一共展示了Column::action方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: str_limit

        $secondaryDisplay = AdminDisplay::datatables();
        $secondaryDisplay->apply(function ($query) {
            $query->onlyTrashed();
        });
        $secondaryDisplay->columns([Column::checkbox(), Column::string('id'), Column::custom()->label('Картинка')->callback(function ($instance) {
            $attachment = $instance->attachments()->first();
            if (!is_null($attachment)) {
                if ($attachment->type === 'album') {
                    $attachment = $attachment->childs()->first();
                }
                return "<img class='thumbnail' width='80px' src='{$attachment->srcs['image_small']}'>";
            }
            return '';
        }), Column::custom()->label('Текст')->callback(function ($instance) {
            return str_limit($instance->text, 180);
        }), Column::datetime('date')->label('Создан')->format('d.m.Y в H:i'), Column::datetime('created_at')->label('Импортирован')->format('d.m.Y в H:i'), Column::datetime('deleted_at')->label('Удален')->format('d.m.Y в H:i')]);
        $secondaryDisplay->actions([Column::action('post_restore')->value('Восстановить записи')->icon('fa-refresh')->callback(function (\Illuminate\Database\Eloquent\Collection $collections) {
            if ($collections) {
                /** @var \App\Post $collection */
                foreach ($collections as $collection) {
                    $collection->restore();
                }
            }
        })]);
        $tabs = [];
        $tabs[] = AdminDisplay::tab($mainDisplay)->label('Активные записи')->active(true);
        $tabs[] = AdminDisplay::tab($secondaryDisplay)->label('Удаленные записи');
        return $tabs;
    });
    return $display;
});
开发者ID:stcoder,项目名称:uf-vova,代码行数:31,代码来源:Post.php

示例2: function

<?php

//dd(Storage::files('archivos-imprentas'));
Admin::model(\App\Orden::class)->title('Ordenes')->with()->filters(function () {
})->columns(function () {
    Column::string('numero_de_orden', 'Numero de orden');
    Column::date('valido_hasta', 'Valido Hasta')->format('medium', 'none');
    Column::string('imprenta.nombre', 'Imprenta');
    Column::Link('codigo', 'URL')->sortable(false);
    Column::action('email', 'email')->icon('fa-envelope-o')->style('short')->callback(function ($instance) {
        $imprenta = $instance->imprenta;
        Mail::send('email', ['imprenta' => $imprenta, 'orden' => $instance], function ($m) use($instance, $imprenta) {
            $m->from('muriell@petrilac.com.ar', 'Muriel Lodeiro');
            $m->to($imprenta->email, $imprenta->contacto)->subject('Archivos disponibles para orden de compra: ' . $instance->numero_de_orden);
        });
        //return Redirect::route('my-route', [$instance->id]);
    });
})->form(function () {
    FormItem::text('numero_de_orden', 'Numero De Orden');
    FormItem::select('imprenta_id', 'Imprenta')->list(App\Imprenta::class);
    FormItem::date('valido_hasta', 'Valido Hasta');
    FormItem::textarea('comentarios', 'Comentarios');
    FormItem::archivosSelector('archivos_s', 'Archivos');
    FormItem::archivosHidden('archivos', '');
});
开发者ID:ateszki,项目名称:petrimprentas,代码行数:25,代码来源:Orden.php

示例3:

<?php

Admin::model('App\\Order')->title('Управление заказами')->display(function () {
    $display = AdminDisplay::datatables();
    $display->with('status');
    $display->filters([Filter::related('order_status_id')->model('App\\OrderStatus')->display('title')]);
    $display->columns([Column::string('id')->label('№'), Column::string('customer_name')->label('ФИО'), Column::string('phone')->label('Телефон'), Column::string('sum_order')->label('Сумма заказа'), Column::string('status.title')->label('Статус заказа')->append(Column::filter('order_status_id')), Column::action('show')->label('Подробности')->icon('fa fa-share')->url('order_content/:id')]);
    return $display;
})->delete(null);
开发者ID:DimaPikash,项目名称:eshop,代码行数:9,代码来源:Order.php

示例4:

<?php

Admin::model(\App\Model\Category::class)->title('Категории Блога')->display(function () {
    $display = AdminDisplay::datatables();
    $display->with('pages');
    $display->filters([]);
    $display->columns([Column::string('title')->label('Название'), Column::count('pages.id')->label('Количество статей'), Column::action('show')->label('Label')->callback(function ($query) {
        return $query->active ? '&check;' : '-';
    })]);
    return $display;
})->createAndEdit(function () {
    $form = AdminForm::tabbed();
    $form->items(['Main' => [FormItem::hidden('user_id')->defaultValue(AdminAuth::user()->id), FormItem::text('title', 'Заголовок'), FormItem::text('slug', 'Slug - Заполняется автоматически'), FormItem::ckeditor('content', 'Content'), FormItem::textarea('descriptor', 'Краткое описание')]]);
    return $form;
});
开发者ID:peyoter,项目名称:pblog,代码行数:15,代码来源:Category.php

示例5: str_limit

            $query->onlyTrashed();
        });
        $secondaryDisplay->with('profile');
        $secondaryDisplay->columns([Column::checkbox(), Column::custom()->label('Автор')->callback(function ($instance) {
            $fullName = '<p class="small text-center">' . $instance->profile->first_name . ' ' . $instance->profile->last_name . '</p>';
            $img = '';
            if (!is_null($instance->profile->photo)) {
                $img = "<img class='thumbnail' width='110px' src='{$instance->profile->photo}'>";
            }
            return $img . $fullName;
        }), Column::custom()->label('Текст')->callback(function ($instance) {
            return str_limit($instance->text, 180);
        }), Column::datetime('date')->label('Опубликован')->format('d.m.Y в H:i'), Column::datetime('created_at')->label('Импортирован')->format('d.m.Y в H:i'), Column::datetime('deleted_at')->label('Удален')->format('d.m.Y в H:i')]);
        $secondaryDisplay->order([2, 'desc']);
        $secondaryDisplay->actions([Column::action('review_import')->value('Импортировать записи')->icon('fa-share')->callback(function (\Illuminate\Database\Eloquent\Collection $collection) {
            \App\Imports\Review::import(0, 100);
        }), Column::action('review_restore')->value('Восстановить записи')->icon('fa-refresh')->callback(function (\Illuminate\Database\Eloquent\Collection $collections) {
            if ($collections) {
                /** @var \App\Post $collection */
                foreach ($collections as $collection) {
                    $collection->restore();
                }
            }
        })]);
        $tabs = [];
        $tabs[] = AdminDisplay::tab($mainDisplay)->label('Активные записи')->active(true);
        $tabs[] = AdminDisplay::tab($secondaryDisplay)->label('Удаленные записи');
        return $tabs;
    });
    return $display;
});
开发者ID:stcoder,项目名称:uf-vova,代码行数:31,代码来源:Review.php

示例6: dd

<?php

Admin::model('App\\News8')->title('News (bulk actions)')->alias('news8')->display(function () {
    $display = AdminDisplay::table();
    $display->actions([Column::action('export')->value('Export')->icon('fa-share')->target('_blank')->callback(function ($collection) {
        dd('You are trying to export:', $collection->toArray());
    })]);
    $display->columns([Column::checkbox(), Column::string('title')->label('Title'), Column::datetime('date')->label('Date')->format('d.m.Y'), Column::custom()->label('Published')->callback(function ($instance) {
        return $instance->published ? '&check;' : '-';
    })]);
    return $display;
})->createAndEdit(function () {
    $form = AdminForm::form();
    $form->items([FormItem::text('title', 'Title')->required(), FormItem::date('date', 'Date')->required()->format('d.m.Y'), FormItem::checkbox('published', 'Published'), FormItem::ckeditor('text', 'Text')]);
    return $form;
});
开发者ID:ntamvl,项目名称:admin-3-demo,代码行数:16,代码来源:News8.php

示例7:

<?php

Admin::model(App\Model\Page::class)->title('Страницы блога')->display(function () {
    $display = AdminDisplay::datatables();
    $display->with('category');
    $display->filters([]);
    $display->columns([Column::string('title')->label('Название'), Column::string('category.title')->label('Категория'), Column::action('show')->label('Label')->callback(function ($query) {
        return $query->active ? '&check;' : '-';
    })]);
    return $display;
})->createAndEdit(function () {
    $form = AdminForm::tabbed();
    $form->items(['Main' => [FormItem::hidden('user_id')->defaultValue(AdminAuth::user()->id), FormItem::select('category_id', 'Категория')->model(App\Model\Category::class), FormItem::text('title', 'Заголовок'), FormItem::text('slug', 'Slug - Заполняется автоматически'), FormItem::ckeditor('content', 'Content'), FormItem::textarea('descriptor', 'Краткое описание'), FormItem::checkbox('active', 'Активный')], 'Внешняя картинка' => [FormItem::image('image', 'Image')], 'Фоновая картика' => [FormItem::image('bg', 'Bg')]]);
    return $form;
});
开发者ID:peyoter,项目名称:pblog,代码行数:15,代码来源:Page.php

示例8:

<?php

Admin::model(App\Pedido::class)->title('Pedidos')->with()->filters(function () {
    ModelItem::filter('user_id')->as('cliente')->title()->from(App\User::class, 'razsoc');
})->columns(function () {
    Column::string('id', 'Id');
    Column::string('user.razsoc', 'Cliente')->append(Column::filter('cliente')->value('user_id'));
    Column::string('total', 'Total');
    Column::string('created_at', 'Fecha');
    Column::Estado('estado', 'Estado')->sortable(false);
    Column::action('show', 'Detalle')->icon('fa-list')->style('short')->url('pedido_lineas?pedido=:id');
})->form(function () {
    FormItem::text('id', 'Id')->attributes(["readonly" => "readonly"]);
    FormItem::select('user_id', 'Cliente')->list('App\\User')->attributes(["disabled" => "true"]);
    FormItem::text('total', 'Total')->attributes(["readonly" => "readonly"]);
    FormItem::text('created_at', 'Fecha')->attributes(["readonly" => "readonly"]);
    FormItem::select('estado', 'Estado')->list(['P' => 'Pendiente', 'I' => 'Ingresado', 'C' => 'Cancelado']);
});
开发者ID:ateszki,项目名称:nh,代码行数:18,代码来源:Pedido.php

示例9: config

/*
 * This is a simple example of the main features.
 * For full list see documentation.
 */
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Input;
use App\Product;
use App\UserProduct;
Admin::model('App\\User')->title('Пользователи')->display(function () {
    $display = AdminDisplay::datatables();
    $display->columns([Column::checkbox(), Column::string('id')->label('ID'), Column::string('name')->label('Имя'), Column::custom()->label('Актив.')->callback(function ($instance) {
        return $instance->is_active ? '&check;' : '-';
    }), Column::string('email')->label('Email'), Column::count('products')->label('Товаров')->orderable(true), Column::count('list_active_products')->label('Акт. товаров')->orderable(true), Column::string('balance')->label('Баланс')]);
    $display->columnFilters([null, ColumnFilter::select()->model('App\\User')->display('name'), null, null, null, null]);
    $display->actions([Column::action('export')->value('Раздать товары')->icon('fa-share')->callback(function ($collection) {
        $max_products_per_user = config('main.max_products_per_user', 3);
        foreach ($collection as $key => $user) {
            $active_products = $user->list_active_products;
            $count_active_products = count($active_products);
            if ($count_active_products >= 0 && $count_active_products < $max_products_per_user) {
                $random_product = Product::orderByRaw("RAND()")->first();
                try {
                    $user_product = UserProduct::create(['user_id' => $user->id, 'product_id' => $random_product->id]);
                } catch (QueryException $e) {
                    //Nothing
                }
            }
        }
    })]);
    return $display;
开发者ID:Eduard90,项目名称:Laravel-5-Example,代码行数:31,代码来源:User.php

示例10: dd

<?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);
开发者ID:ntamvl,项目名称:admin-3-demo,代码行数:13,代码来源:Contact.php

示例11:

<?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');
});
开发者ID:tldmic,项目名称:admin_demo,代码行数:27,代码来源:Contact.php


注:本文中的Column::action方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。