use native lara notifs, add phpsandbox package

This commit is contained in:
2018-07-14 17:42:53 +02:00
parent 66afe052b9
commit 6f908356dc
24 changed files with 206 additions and 495 deletions
+16 -21
View File
@@ -4,16 +4,29 @@ namespace App\Models;
use AdamWathan\EloquentOAuth\OAuthIdentity;
use App\Models\Concerns\Reportable;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
/**
* A user in the application
*
* @property Carbon $created_at
* @property Carbon $updated_at
* @property string $name - unique, for vanity URL
* @property string $email - unique, for login and social auth chaining
* @property string $password - hashed pw
* @property Proposal[]|Collection $proposals
* @property Table[]|Collection $tables
* @property OAuthIdentity[]|Collection $socialIdentities
* @property TableComment[]|Collection $tableComments
* @property Table[]|Collection $favouriteTables
* @property Table[]|Collection $followedDiscussions
* @property ContentReport[]|Collection $authoredReports
* @property Notification[]|Collection $notifications
* @property Notification[]|Collection $readNotifications
* @property Notification[]|Collection $unreadNotifications
*/
class User extends Authenticatable
{
@@ -47,13 +60,11 @@ class User extends Authenticatable
foreach ($self->proposals as $proposal) {
$proposal->delete();
}
$self->notificationsCaused()->delete();
});
}
/** Owned tables */
public function dataTables()
public function tables()
{
return $this->hasMany(Table::class, 'owner_id');
}
@@ -94,22 +105,6 @@ class User extends Authenticatable
return $this->hasMany(ContentReport::class, 'author_id');
}
/** Notifications for this user */
public function notifications()
{
return $this->hasMany(Notification::class);
}
/**
* Notifications caused by this user
*
* @return HasMany
*/
public function notificationsCaused()
{
return $this->hasMany(Notification::class, 'actor_id');
}
// --------- Relation Helpers ---------
public function addFavourite(Table $table)