mirror of
https://github.com/wearepixel/laravel-comments.git
synced 2026-11-14 22:12:35 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b5fca31b9 | ||
|
|
e7ff37cafe | ||
|
|
461094925d | ||
|
|
bf0eeb5579 | ||
|
|
f75584052f | ||
|
|
c7d599349d | ||
|
|
faeb83b7d2 | ||
|
|
e8b5b7a237 | ||
|
|
7bbc024302 |
@@ -1,7 +1,6 @@
|
|||||||
language: php
|
language: php
|
||||||
|
|
||||||
php:
|
php:
|
||||||
- 7.1
|
|
||||||
- 7.2
|
- 7.2
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -52,8 +52,8 @@ To let your models be able to receive comments, add the `HasComments` trait to t
|
|||||||
``` php
|
``` php
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Beyondcode\Comments\HasComments;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use BeyondCode\Comments\Traits\HasComments;
|
||||||
|
|
||||||
class Post extends Model
|
class Post extends Model
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-1
@@ -17,7 +17,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^7.1"
|
"php": "^7.2",
|
||||||
|
"illuminate/support": "~5.6.0|~5.7.0|~5.8.0|^6.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"orchestra/testbench": "^3.6",
|
"orchestra/testbench": "^3.6",
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class CreateCommentsTable extends Migration
|
|||||||
$table->morphs('commentable');
|
$table->morphs('commentable');
|
||||||
$table->text('comment');
|
$table->text('comment');
|
||||||
$table->boolean('is_approved')->default(false);
|
$table->boolean('is_approved')->default(false);
|
||||||
$table->unsignedInteger('user_id')->nullable();
|
$table->unsignedBigInteger('user_id')->nullable();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-1
@@ -43,6 +43,15 @@ class Comment extends Model
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function disapprove()
|
||||||
|
{
|
||||||
|
$this->update([
|
||||||
|
'is_approved' => false,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
protected function getAuthModelName()
|
protected function getAuthModelName()
|
||||||
{
|
{
|
||||||
@@ -57,4 +66,4 @@ class Comment extends Model
|
|||||||
throw new Exception('Could not determine the commentator model name.');
|
throw new Exception('Could not determine the commentator model name.');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ use BeyondCode\Comments\CommentsServiceProvider;
|
|||||||
abstract class TestCase extends \Orchestra\Testbench\TestCase
|
abstract class TestCase extends \Orchestra\Testbench\TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function setUp()
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->loadLaravelMigrations(['--database' => 'sqlite']);
|
$this->loadLaravelMigrations(['--database' => 'sqlite']);
|
||||||
|
|||||||
Reference in New Issue
Block a user