1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2025-01-30 19:03:21 +00:00

Merge pull request #1958 from pixelfed/staging

Update Report model
This commit is contained in:
daniel 2020-01-22 20:06:18 -07:00 committed by GitHub
commit 87cca81228
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,6 +21,7 @@ class Report extends Model
public function reported() public function reported()
{ {
$class = $this->object_type; $class = $this->object_type;
switch ($class) { switch ($class) {
case 'App\Status': case 'App\Status':
$column = 'id'; $column = 'id';
@ -32,7 +33,12 @@ class Report extends Model
break; break;
} }
return (new $class())->where($column, $this->object_id)->firstOrFail(); return (new $class())->where($column, $this->object_id)->first();
}
public function status()
{
return $this->belongsTo(Status::class, 'object_id');
} }
public function reportedUser() public function reportedUser()