Remove old views system for blog articles
This commit is contained in:
parent
aaa483289a
commit
13eb273772
@ -61,7 +61,7 @@ class BlogArticleController extends Controller
|
|||||||
public function popular()
|
public function popular()
|
||||||
{
|
{
|
||||||
$data = BlogArticle::select()
|
$data = BlogArticle::select()
|
||||||
->orderBy('views', 'desc')
|
->orderByUniqueViews('desc')
|
||||||
->orderBy('date', 'desc')
|
->orderBy('date', 'desc')
|
||||||
->where('published', true)
|
->where('published', true)
|
||||||
->limit(5)
|
->limit(5)
|
||||||
|
|||||||
@ -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);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user