添加友情链接样式
parent
c7c3c9cd39
commit
9489c3ea3a
|
|
@ -42,7 +42,7 @@ class ArticleCategoryController extends AdminController
|
||||||
amisMake()->ImageControl()->name('icon')->label('icon')->autoUpload(true),
|
amisMake()->ImageControl()->name('icon')->label('icon')->autoUpload(true),
|
||||||
Components::make()->parentControl(),
|
Components::make()->parentControl(),
|
||||||
Components::make()->sortControl(),
|
Components::make()->sortControl(),
|
||||||
amisMake()->SwitchControl()->name('is_enable')->label('状态'),
|
amisMake()->SwitchControl()->name('is_enable')->label('显示'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
|
use Slowlyo\OwlAdmin\Renderers\Page;
|
||||||
|
use Slowlyo\OwlAdmin\Renderers\Form;
|
||||||
|
use Slowlyo\OwlAdmin\Renderers\TableColumn;
|
||||||
|
use Slowlyo\OwlAdmin\Renderers\TextControl;
|
||||||
|
use Slowlyo\OwlAdmin\Controllers\AdminController;
|
||||||
|
use App\Services\Admin\FriendLinkService;
|
||||||
|
use App\Admin\Components;
|
||||||
|
|
||||||
|
class FriendLinkController extends AdminController
|
||||||
|
{
|
||||||
|
protected string $serviceName = FriendLinkService::class;
|
||||||
|
|
||||||
|
protected string $pageTitle = '友情链接';//待完善-todo
|
||||||
|
|
||||||
|
public function list(): Page
|
||||||
|
{
|
||||||
|
$crud = $this->baseCRUD()
|
||||||
|
->filterTogglable(false)
|
||||||
|
->headerToolbar([
|
||||||
|
$this->createButton(true),
|
||||||
|
...$this->baseHeaderToolBar(),
|
||||||
|
])
|
||||||
|
->columns([
|
||||||
|
TableColumn::make()->name('id')->label('ID')->sortable(true),
|
||||||
|
TableColumn::make()->name('name')->label('名称'),
|
||||||
|
TableColumn::make()->name('created_at')->label('创建时间')->type('datetime')->sortable(true),
|
||||||
|
TableColumn::make()->name('updated_at')->label('更新时间')->type('datetime')->sortable(true),
|
||||||
|
$this->rowActions(true),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $this->baseList($crud);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function form(): Form
|
||||||
|
{
|
||||||
|
return $this->baseForm()->body([
|
||||||
|
TextControl::make()->name('name')->label('名称'),
|
||||||
|
TextControl::make()->name('path')->label('链接')->required(true),
|
||||||
|
amisMake()->ImageControl()->name('icon')->label('icon')->autoUpload(true),
|
||||||
|
Components::make()->sortControl(),
|
||||||
|
amisMake()->SwitchControl()->name('is_recommend')->label('推荐'),
|
||||||
|
amisMake()->SwitchControl()->name('is_enable')->label('显示'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function detail(): Form
|
||||||
|
{
|
||||||
|
return $this->baseDetail()->body([
|
||||||
|
TextControl::make()->static(true)->name('id')->label('ID'),
|
||||||
|
TextControl::make()->static(true)->name('name')->label('名称'),
|
||||||
|
TextControl::make()->static(true)->name('created_at')->label('创建时间'),
|
||||||
|
TextControl::make()->static(true)->name('updated_at')->label('更新时间')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -26,6 +26,8 @@ Route::group([
|
||||||
$router->resource('banner-places', \App\Admin\Controllers\BannerPlaceController::class);
|
$router->resource('banner-places', \App\Admin\Controllers\BannerPlaceController::class);
|
||||||
//图片管理
|
//图片管理
|
||||||
$router->resource('banners', \App\Admin\Controllers\BannerController::class);
|
$router->resource('banners', \App\Admin\Controllers\BannerController::class);
|
||||||
|
//友情链接
|
||||||
|
$router->resource('friend-links', \App\Admin\Controllers\FriendLinkController::class);
|
||||||
|
|
||||||
$router->resource('keywords', \App\Admin\Controllers\KeywordController::class);
|
$router->resource('keywords', \App\Admin\Controllers\KeywordController::class);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class FriendLink extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Admin;
|
||||||
|
|
||||||
|
use App\Models\FriendLink;
|
||||||
|
use Slowlyo\OwlAdmin\Services\AdminService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @method FriendLink getModel()
|
||||||
|
* @method FriendLink|\Illuminate\Database\Query\Builder query()
|
||||||
|
*/
|
||||||
|
class FriendLinkService extends AdminService
|
||||||
|
{
|
||||||
|
protected string $modelName = FriendLink::class;
|
||||||
|
}
|
||||||
|
|
@ -20,6 +20,7 @@ return new class extends Migration
|
||||||
$table->unsignedBigInteger('category_id')->nullable()->comment('文章分类');
|
$table->unsignedBigInteger('category_id')->nullable()->comment('文章分类');
|
||||||
$table->text('content')->nullable()->comment('文章内容');
|
$table->text('content')->nullable()->comment('文章内容');
|
||||||
$table->timestamp('published_at')->nullable()->comment('发布时间');
|
$table->timestamp('published_at')->nullable()->comment('发布时间');
|
||||||
|
$table->unsignedTinyInteger('is_recommend')->default(0)->comment('推荐开关');
|
||||||
$table->unsignedTinyInteger('is_enable')->default(1)->comment('显示开关');
|
$table->unsignedTinyInteger('is_enable')->default(1)->comment('显示开关');
|
||||||
$table->unsignedInteger('sort')->default(0)->comment('排序');
|
$table->unsignedInteger('sort')->default(0)->comment('排序');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('friend_links', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('name');
|
||||||
|
$table->string('icon')->nullable()->comment('图标');
|
||||||
|
$table->string('path');
|
||||||
|
$table->unsignedTinyInteger('is_recommend')->default(0)->comment('推荐开关');
|
||||||
|
$table->unsignedTinyInteger('is_enable')->default(1)->comment('显示开关');
|
||||||
|
$table->unsignedInteger('sort')->default(0)->comment('排序');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('friend_links');
|
||||||
|
}
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue