I am very beginner in Laravel. I have Laravel 5.8 in my project.
I have this code:
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id');
$table->char('enable', 1)->default(0);
$table->string('name', 120)->nullable();
$table->string('surname', 120)->nullable();
$table->string('email', 120)->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
........
$table->rememberToken();
$table->timestamps();
$table->engine = "InnoDB";
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_unicode_ci';
});
Schema::create('comments', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('user_id')->unsigned();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->string('commentable_type');
$table->bigInteger('commentable_id');
$table->char('enable', 1)->default(0);
$table->char('to_stats', 1)->default(0);
$table->tinyInteger('rating')->default(0); // 1-5
$table->text('content');
$table->dateTime('date_time');
$table->ipAddress('ip');
$table->engine = "InnoDB";
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_unicode_ci';
How can I show users list:
-
sort after number of comments held
-
sort after number of votes which user has (comments-> rating)?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire