PHP code example of digitalisstudios / slick-forms
1. Go to this page and download the library: Download digitalisstudios/slick-forms 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/ */
digitalisstudios / slick-forms example snippets
use DigitalisStudios\SlickForms\Models\CustomForm;
// Create a form
$form = CustomForm::create([
'name' => 'Lead Capture Form',
'description' => 'Collect leads from landing page',
'is_active' => true,
]);
// Add fields
$form->fields()->create([
'field_type' => 'email',
'label' => 'Email Address',
'name' => 'email',
'is_
// config/slick-forms.php
'routes' => [
'middleware' => [
'admin' => ['web', 'auth', 'role:admin'], // Require admin role
'public' => ['web', 'throttle:60,1'], // Rate limit public forms
],
'builder' => [
'middleware' => 'admin', // Use admin middleware group
'show' => '{builder}/{form}',
],
'submissions' => [
'middleware' => 'admin',
// Override single route with custom middleware
'export_csv' => [
'uri' => '{submissions}/{form}/{export}/{csv}',
'middleware' => ['web', 'auth', 'can:export-submissions'],
],
],
],
// config/slick-forms.php
'load_routes' => false,
// routes/web.php
use DigitalisStudios\SlickForms\Http\Controllers\FormBuilderController;
use DigitalisStudios\SlickForms\Http\Controllers\FormRendererController;
Route::middleware(['auth'])->prefix('admin')->group(function () {
Route::get('/forms', [FormBuilderController::class, 'index']);
Route::get('/forms/builder/{form}', [FormBuilderController::class, 'show']);
});
// Public form route (no auth