Remove old views system for blog articles

This commit is contained in:
Daniel_I_Am 2021-09-04 12:09:14 +02:00
parent aaa483289a
commit 13eb273772
2 changed files with 33 additions and 1 deletions

View File

@ -61,7 +61,7 @@ class BlogArticleController extends Controller
public function popular()
{
$data = BlogArticle::select()
->orderBy('views', 'desc')
->orderByUniqueViews('desc')
->orderBy('date', 'desc')
->where('published', true)
->limit(5)

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class RemoveViewsFromBlogArticles extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('blog_articles', function (Blueprint $table) {
$table->dropColumn('views');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('blog_articles', function (Blueprint $table) {
$table->integer('views')->default(0);
});
}
}