initial import
This commit is contained in:
22
app/Models/AiModel.php
Normal file
22
app/Models/AiModel.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AiModel extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'model_id',
|
||||
'model_type',
|
||||
];
|
||||
|
||||
public function apiProviders()
|
||||
{
|
||||
return $this->belongsToMany(ApiProvider::class, 'ai_model_api_provider');
|
||||
}
|
||||
}
|
||||
35
app/Models/ApiProvider.php
Normal file
35
app/Models/ApiProvider.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ApiProvider extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'api_url',
|
||||
'username',
|
||||
'password',
|
||||
'token',
|
||||
'plugin',
|
||||
'enabled',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'enabled' => 'boolean',
|
||||
];
|
||||
|
||||
public function styles()
|
||||
{
|
||||
return $this->hasMany(Style::class);
|
||||
}
|
||||
|
||||
public function aiModels()
|
||||
{
|
||||
return $this->belongsToMany(AiModel::class, 'ai_model_api_provider');
|
||||
}
|
||||
}
|
||||
28
app/Models/DummyPluginModel.php
Normal file
28
app/Models/DummyPluginModel.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DummyPluginModel extends Model
|
||||
{
|
||||
protected $table = null; // No actual table
|
||||
|
||||
protected $guarded = []; // Allow mass assignment for all attributes
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
protected $keyType = 'string';
|
||||
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
public function newCollection(array $models = [])
|
||||
{
|
||||
return new \Illuminate\Database\Eloquent\Collection($models);
|
||||
}
|
||||
|
||||
public function newEloquentBuilder($query)
|
||||
{
|
||||
return new \App\Filament\Resources\PluginResource\CollectionEloquentBuilder($query);
|
||||
}
|
||||
}
|
||||
17
app/Models/Image.php
Normal file
17
app/Models/Image.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
||||
|
||||
class Image extends Model
|
||||
{
|
||||
use HasFactory, HasUuids;
|
||||
|
||||
protected $fillable = [
|
||||
'path',
|
||||
'uuid',
|
||||
];
|
||||
}
|
||||
18
app/Models/Role.php
Normal file
18
app/Models/Role.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Role extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = ['name'];
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->hasMany(User::class);
|
||||
}
|
||||
}
|
||||
30
app/Models/Style.php
Normal file
30
app/Models/Style.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Style extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'prompt',
|
||||
'description',
|
||||
'preview_image',
|
||||
'parameters',
|
||||
'ai_model_id',
|
||||
'enabled',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'enabled' => 'boolean',
|
||||
];
|
||||
|
||||
public function aiModel()
|
||||
{
|
||||
return $this->belongsTo(AiModel::class);
|
||||
}
|
||||
}
|
||||
50
app/Models/User.php
Normal file
50
app/Models/User.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, HasFactory, Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
'role_id',
|
||||
];
|
||||
|
||||
public function role()
|
||||
{
|
||||
return $this->belongsTo(Role::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user