6
0
Fork 0
jiqu-library-server/app/Admin/Actions/Grid/ArticleList.php

70 lines
1.4 KiB
PHP

<?php
namespace App\Admin\Actions\Grid;
use Dcat\Admin\Actions\Response;
use Dcat\Admin\Grid\RowAction;
use Dcat\Admin\Traits\HasPermissions;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;
class ArticleList extends RowAction
{
/**
* @return string
*/
protected $title = 'Title';
public function title()
{
if ($this->title) {
return $this->title;
}
return '<i class="feather icon-list grid-action-icon"></i> '.__('admin.list').' &nbsp;&nbsp;';
}
/**
* Handle the action request.
*
* @param Request $request
*
* @return Response
*/
public function handle(Request $request)
{
// dump($this->getKey());
return $this->response()
// ->success('Processed successfully: '.$this->getKey())
->redirect(admin_route('articles.index', ['category' =>$this->getKey()]));
}
/**
* @return string|array|void
*/
public function confirm()
{
// return ['Confirm?', 'contents'];
}
/**
* @param Model|Authenticatable|HasPermissions|null $user
*
* @return bool
*/
protected function authorize($user): bool
{
return true;
}
/**
* @return array
*/
protected function parameters()
{
return [];
}
}