add: full multi-tenancy control

This commit is contained in:
Cauê Faleiros
2026-02-02 15:31:15 -03:00
commit c6ec92802b
1711 changed files with 258106 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
<?php
namespace Webkul\EmailTemplate\Contracts;
interface EmailTemplate {}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('email_templates', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('subject');
$table->text('content');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('email_templates');
}
};

View File

@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('email_templates', function (Blueprint $table) {
$table->string('name')->unique()->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('email_templates', function (Blueprint $table) {
$table->dropUnique(['name']);
$table->string('name')->change();
});
}
};

View File

@@ -0,0 +1,15 @@
<?php
namespace Webkul\EmailTemplate\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\EmailTemplate\Contracts\EmailTemplate as EmailTemplateContract;
class EmailTemplate extends Model implements EmailTemplateContract
{
protected $fillable = [
'name',
'subject',
'content',
];
}

View File

@@ -0,0 +1,7 @@
<?php
namespace Webkul\EmailTemplate\Models;
use Konekt\Concord\Proxies\ModelProxy;
class EmailTemplateProxy extends ModelProxy {}

View File

@@ -0,0 +1,18 @@
<?php
namespace Webkul\EmailTemplate\Providers;
use Illuminate\Support\ServiceProvider;
class EmailTemplateServiceProvider extends ServiceProvider
{
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
$this->loadMigrationsFrom(__DIR__.'/../Database/Migrations');
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace Webkul\EmailTemplate\Providers;
use Webkul\Core\Providers\BaseModuleServiceProvider;
class ModuleServiceProvider extends BaseModuleServiceProvider
{
protected $models = [
\Webkul\EmailTemplate\Models\EmailTemplate::class,
];
}

View File

@@ -0,0 +1,18 @@
<?php
namespace Webkul\EmailTemplate\Repositories;
use Webkul\Core\Eloquent\Repository;
class EmailTemplateRepository extends Repository
{
/**
* Specify Model class name
*
* @return mixed
*/
public function model()
{
return 'Webkul\EmailTemplate\Contracts\EmailTemplate';
}
}