From 854dd96e221b9bc2c255f2a4fb49fc9221719d28 Mon Sep 17 00:00:00 2001 From: kroutony Date: Sun, 23 Feb 2020 16:43:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E7=BE=A9=E5=9F=BA=E6=9C=ACpost?= =?UTF-8?q?=E6=9E=B6=E6=A7=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Article.php | 9 +++++ app/Portfolio.php | 9 +++++ app/Post.php | 12 +++++++ app/Traits/PostBlueprintGettable.php | 21 ++++++++++++ config/data-presets.php | 16 +++++++++ config/posts.php | 5 +++ ...020_02_23_064758_create_articles_table.php | 33 +++++++++++++++++++ ...0_02_23_064813_create_portfolios_table.php | 33 +++++++++++++++++++ 8 files changed, 138 insertions(+) create mode 100644 app/Article.php create mode 100644 app/Portfolio.php create mode 100644 app/Post.php create mode 100644 app/Traits/PostBlueprintGettable.php create mode 100644 config/posts.php create mode 100644 database/migrations/2020_02_23_064758_create_articles_table.php create mode 100644 database/migrations/2020_02_23_064813_create_portfolios_table.php diff --git a/app/Article.php b/app/Article.php new file mode 100644 index 0000000..ace0edb --- /dev/null +++ b/app/Article.php @@ -0,0 +1,9 @@ +bigIncrements('id'); + $table->text('title')->comment('標題'); + $table->text('content')->nullable()->comment('內容'); + $table->text('excerpt')->nullable()->comment('摘要'); + $table->unsignedBigInteger('user_id')->comment('作者'); + $table->unsignedBigInteger('feature_image_id')->nullable()->comment('主圖'); + $table->timestamps(); + + $table->foreign('user_id')->references('id')->on('users'); + $table->foreign('feature_image_id')->references('id')->on('media_files'); + } +} diff --git a/config/data-presets.php b/config/data-presets.php index bc4a952..156f110 100644 --- a/config/data-presets.php +++ b/config/data-presets.php @@ -68,6 +68,22 @@ return [ 'editor' ] ], + [ + // 管理Article + 'name' => 'admin manage post article', + 'displayName' => 'adminManagePostArticle', + 'assignTo' => [ + 'editor' + ] + ], + [ + // 管理Portfolio + 'name' => 'admin manage post portfolio', + 'displayName' => 'adminManagePostPortfolio', + 'assignTo' => [ + 'editor' + ] + ], ], // 預設的設定值 'options' => [ diff --git a/config/posts.php b/config/posts.php new file mode 100644 index 0000000..84cc13b --- /dev/null +++ b/config/posts.php @@ -0,0 +1,5 @@ +processSchema($table); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('articles'); + } +} diff --git a/database/migrations/2020_02_23_064813_create_portfolios_table.php b/database/migrations/2020_02_23_064813_create_portfolios_table.php new file mode 100644 index 0000000..d57fe65 --- /dev/null +++ b/database/migrations/2020_02_23_064813_create_portfolios_table.php @@ -0,0 +1,33 @@ +processSchema($table); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('portfolios'); + } +}