1. Go to this page and download the library: Download helfentalk/laravel-plugin library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
helfentalk / laravel-plugin example snippets
return [
'api_key' => env('HELFENTALK_KEY'),
// Tables the plugin may touch. Use 'all' for every table, or a list.
'allowed_tables' => ['workers', 'epasses', 'documents'],
// Scope: which ROWS a role may see/touch (own / team / all).
'role_rules' => [
'employee' => ['own_data_only' => true],
'manager' => ['scope' => 'team'],
'admin' => ['scope' => 'all'],
],
'user_column' => 'user_id',
'team_column' => 'team_id',
// --- Data actions (optional; omit for read-only) -------------------
// Map a table to its model — REQUIRED for writes so your business logic
// (SoftDeletes, observers, approval) runs. No model => read-only.
'models' => [
'workers' => \App\Models\Worker::class,
],
// What each role may DO per table: view / create / edit / delete.
// 'all' applies to every allowed table; a table key overrides it.
'capabilities' => [
'admin' => ['all' => ['view', 'create', 'edit', 'delete']],
'manager' => ['workers' => ['view', 'edit'], 'all' => ['view']],
'employee' => ['all' => ['view']],
],
// Columns the chatbot may set on create/edit (per table). Nothing else
// is ever written.
'writable_columns' => [
'workers' => ['status', 'notes'],
],
'max_write_rows' => 1, // cap rows one update/delete may affect
];
// config/helfentalk.php
'token' => [
'enabled' => true,
// YOUR auth guard for this route (NOT the HMAC used by connect/action):
'middleware' => ['auth:sanctum'], // or ['auth'] for session dashboards
'ttl' => 900, // seconds
// role auto-detects Spatie getRoleNames() or a 'role' attribute;
// set these only to override:
'role_field' => null,
'name_field' => null,
'department_field' => null,
],
// config/helfentalk.php
// So the plugin can run your controllers AS the person chatting (auth()->user(),
// policies and gates work normally):
'auth' => [
'model' => \App\Models\User::class,
'key' => 'id', // column matched against the user-context user_id
],
'actions' => [
'change_worker_status' => [
'label' => 'Change a worker’s status',
'controller' => [\App\Http\Controllers\WorkerController::class, 'update'],
'inputs' => [
// Use your REAL field names — the ones your controller/validation expect.
'worker' => 'The worker ID to update',
'status' => 'New status: "active" or "inactive"',
],
'confirm' => true, // preview + ask before the controller runs
'roles' => ['admin', 'manager'], // optional allow-list
'bindings' => ['worker' => \App\Models\Worker::class], // route-model binding
],
],
'actions' => [
// LIST — shown to the user as an interactive, clickable table.
'list_workers' => [
'label' => 'List or search workers (by status, etc.)',
'controller' => [\App\Http\Controllers\WorkerController::class, 'index'],
'read' => true, // a read action: runs now, returns rows
'entity' => 'workers', // table label
'view_route' => '/workers/{id}', // each row becomes a deep link
'inputs' => ['status' => 'Optional filter: active / inactive'],
'params' => ['per_page' => 50], // fixed query params your index() reads
'roles' => ['admin', 'manager'],
],
// COUNT — answers "how many …?" with just a number (no table).
'count_workers' => [
'label' => 'Count workers (returns only the number)',
'controller' => [\App\Http\Controllers\WorkerController::class, 'index'],
'count' => true, // returns only the total, no rows
'entity' => 'workers',
'inputs' => ['status' => 'Optional filter'],
'params' => ['per_page' => 1],
'roles' => ['admin', 'manager'],
],
],
'view_routes' => [
'workers' => '/workers/{id}', // {id} is filled from each row
],
bash
composer vendor:publish --tag=helfentalk-config
# Only needed if you enable write actions (for the audit log):
php artisan vendor:publish --tag=helfentalk-migrations
php artisan migrate
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.