mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-06 02:33:48 +00:00
69 lines
2.3 KiB
PHP
69 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use App\Notifications\SharedSendViaEmail;
|
|
use Illuminate\Notifications\Notifiable;
|
|
|
|
/**
|
|
* App\Share
|
|
*
|
|
* @property int $id
|
|
* @property int $user_id
|
|
* @property string $token
|
|
* @property int $item_id
|
|
* @property string $type
|
|
* @property string|null $permission
|
|
* @property int $protected
|
|
* @property string|null $password
|
|
* @property \Illuminate\Support\Carbon|null $created_at
|
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
|
* @property-read string $link
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share newQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share query()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share whereCreatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share whereId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share whereItemId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share wherePassword($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share wherePermission($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share whereProtected($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share whereToken($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share whereType($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share whereUpdatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share whereUserId($value)
|
|
* @mixin \Eloquent
|
|
* @property int|null $expire_in
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Share whereExpireIn($value)
|
|
*/
|
|
class Share extends Model
|
|
{
|
|
use Notifiable;
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
protected $appends = ['link'];
|
|
|
|
/**
|
|
* Generate share link
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getLinkAttribute() {
|
|
|
|
return url('/shared', ['token' => $this->attributes['token']]);
|
|
}
|
|
|
|
/**
|
|
* Send the sahared link notification.
|
|
*
|
|
* @param string $token $emails
|
|
* @return void
|
|
*/
|
|
public function sendSharedLinkViaEmail($emails, $token)
|
|
{
|
|
$this->notify(new SharedSendViaEmail($emails, $token));
|
|
}
|
|
}
|