add workflow actions for manipulating server_state

This commit is contained in:
Arno Kaimbacher 2019-02-21 14:07:00 +01:00
parent b7b04a61d6
commit c86c9fe9f4
14 changed files with 141 additions and 24 deletions

View file

@ -5,6 +5,7 @@ namespace App\Models;
use App\Library\Xml\DatasetExtension;
use App\Models\Collection;
use App\Models\License;
use App\Models\User;
use App\Models\Project;
use App\Models\Description;
use App\Models\Title;
@ -78,6 +79,14 @@ class Dataset extends Model
return $this->belongsTo(Project::class, 'project_id', 'id');
}
/**
* Get the account that the dataset belongs to
*/
public function user()
{
return $this->belongsTo(User::class, 'account_id', 'id');
}
public function collections()
{
return $this

View file

@ -7,6 +7,7 @@ use Illuminate\Foundation\Auth\User as Authenticatable;
use Zizaco\Entrust\Traits\EntrustUserTrait;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Collection;
use App\Models\Dataset;
class User extends Authenticatable
{
@ -39,12 +40,19 @@ class User extends Authenticatable
*/
protected $hidden = ['password', 'remember_token'];
public function datasets()
{
//model, foreign key on the User model is account_id, local id of user
return $this->hasMany(Dataset::class, 'account_id', 'id');
}
public function setPasswordAttribute($password)
{
if ($password) {
$this->attributes['password'] = app('hash')->needsRehash($password) ? Hash::make($password) : $password;
}
}
public function getAvatarUrl()
{