-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CyberBuddy - Backport prompts and wire Botman (PoC)
- Loading branch information
csavelief
committed
Sep 24, 2024
1 parent
5b634a2
commit 9e595d0
Showing
6 changed files
with
139 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace App\Modules\CyberBuddy\Models; | ||
|
||
use App\Modules\CyberBuddy\Traits\HasTenant; | ||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
use Illuminate\Database\Eloquent\Model; | ||
|
||
/** | ||
* @property int id | ||
* @property string name | ||
* @property string template | ||
* @property int created_by | ||
*/ | ||
class Prompt extends Model | ||
{ | ||
use HasFactory, HasTenant; | ||
|
||
protected $table = 'cb_prompts'; | ||
|
||
protected $fillable = [ | ||
'name', | ||
'template', | ||
'created_by', | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace App\Modules\CyberBuddy\Observers; | ||
|
||
use App\Modules\CyberBuddy\Traits\IsTenantAware; | ||
|
||
class PromptObserver | ||
{ | ||
use IsTenantAware; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
database/migrations/2024_09_24_212100_create_prompts_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class CreatePromptsTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('cb_prompts', function (Blueprint $table) { | ||
|
||
$table->id(); | ||
$table->timestamps(); | ||
|
||
// Scope collections | ||
$table->intOrBigIntBasedOnRelated('created_by', Schema::connection(null), 'users.id')->cascadeOnDelete(); | ||
$table->foreign('created_by')->references('id')->on('users')->cascadeOnDelete(); | ||
|
||
// The collection properties | ||
$table->string('name')->unique(); | ||
$table->string('template', 5000); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('cb_prompts'); | ||
} | ||
} |