chatbot nuevo
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class ChatMenu extends Model
|
||||
{
|
||||
protected $table = 'chat_menus';
|
||||
protected $fillable = ['nombre', 'mensaje', 'es_raiz', 'activo'];
|
||||
protected $casts = ['es_raiz' => 'boolean', 'activo' => 'boolean'];
|
||||
|
||||
public function options(): HasMany
|
||||
{
|
||||
return $this->hasMany(ChatMenuOption::class, 'menu_id')->orderBy('orden');
|
||||
}
|
||||
|
||||
public static function raiz(): ?self
|
||||
{
|
||||
return static::where('es_raiz', true)->where('activo', true)->first();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user