* Implemented webhooks

* oAuth wip

* Implement the whole auth flow

* Implement file upload limit depending on appsumo license
This commit is contained in:
Julien Nahum
2023-11-01 16:58:10 +01:00
committed by GitHub
parent 2e52518aa7
commit e9174238e4
19 changed files with 611 additions and 102 deletions

View File

@@ -2,8 +2,8 @@
namespace App\Models;
use App\Http\Requests\AnswerFormRequest;
use App\Models\Forms\Form;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
@@ -11,6 +11,9 @@ class Workspace extends Model
{
use HasFactory;
const MAX_FILE_SIZE_FREE = 5000000; // 5 MB
const MAX_FILE_SIZE_PRO = 50000000; // 50 MB
protected $fillable = [
'name',
'icon',
@@ -37,6 +40,26 @@ class Workspace extends Model
return false;
}
public function getMaxFileSizeAttribute()
{
if(is_null(config('cashier.key'))){
return self::MAX_FILE_SIZE_PRO;
}
// Return max file size depending on subscription
foreach ($this->owners as $owner) {
if ($owner->is_subscribed) {
if ($license = $owner->activeLicense()) {
// In case of special License
return $license->max_file_size;
}
}
return self::MAX_FILE_SIZE_PRO;
}
return self::MAX_FILE_SIZE_FREE;
}
public function getIsEnterpriseAttribute()
{
if(is_null(config('cashier.key'))){