-
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.
Merge pull request #10 from jhoopes/form-admin
Form administration, updates, and json api implementation
- Loading branch information
Showing
41 changed files
with
1,970 additions
and
53 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ composer.lock | |
/node_modules | ||
/vendor | ||
/.idea | ||
|
||
*.iml |
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,127 @@ | ||
<?php | ||
|
||
|
||
return [ | ||
|
||
'api_middleware' => '', | ||
'check_permissions' => env('LVF_CHECK_PERMISSIONS', false), | ||
'values_soft_delete' => env('LVF_VALUES_SOFT_DELETE', false), | ||
|
||
/** | ||
* Registers open access to the form configuration and form field policies. | ||
* If set to false, you must specify your own policies for these when using the administration area | ||
*/ | ||
'openAccess' => true, | ||
|
||
/** | ||
* Allow editing of system level forms | ||
*/ | ||
'edit_system_forms' => true, | ||
|
||
|
||
/** | ||
* Admin Configuration | ||
*/ | ||
'use_web_routes' => env('LVF_USE_WEB_ROUTES', true), | ||
'use_base_api' => env('LVF_USE_BASE_API', true), | ||
'use_admin_api' => env('LVF_USE_ADMIN_API', true), | ||
'admin_middleware' => '', | ||
|
||
|
||
|
||
'entity_types' => [ | ||
'form_configuration' => \jhoopes\LaravelVueForms\Models\FormConfiguration::class, | ||
'form_field' => \jhoopes\LaravelVueForms\Models\FormField::class, | ||
], | ||
|
||
/** | ||
* Possible field types to allow for selection when adding a new field | ||
*/ | ||
'widget_types' => [ | ||
'column' => [ | ||
'name' => 'Column', | ||
'structural' => true, | ||
], | ||
'tab' => [ | ||
'name' => 'Tab', | ||
'structural' => true, | ||
], | ||
'static' => [ | ||
'name' => 'Static', | ||
], | ||
'text' => [ | ||
'name' => 'Text', | ||
], | ||
'autocomplete' => [ | ||
'name' => 'autocomplete' | ||
], | ||
'textarea' => [ | ||
'name' => 'Generic Textarea', | ||
], | ||
'dropdown' => [ | ||
'name' => 'Select / Dropdown', | ||
], | ||
'checkbox' => [ | ||
'name' => 'Checkbox', | ||
], | ||
'radio' => [ | ||
'name' => 'Radio', | ||
], | ||
'datepicker' => [ | ||
'name' => 'Date Picker', | ||
], | ||
'timepicker' => [ | ||
'name' => 'Time Picker' | ||
], | ||
'datetimepicker' => [ | ||
'name' => 'Date/Time Picker' | ||
], | ||
'files' => [ | ||
'name' => 'File Uploader', | ||
], | ||
'wysiwyg' => [ | ||
'name' => 'Rich text editor', | ||
], | ||
'code' => [ | ||
'name' => 'Code Editor' | ||
] | ||
], | ||
|
||
/** | ||
* Possible casting types for casting attributes to | ||
*/ | ||
'cast_types' => [ | ||
'integer' => 'Integer', | ||
'boolean' => 'Boolean', | ||
'string' => 'String', | ||
'array' => 'Array', | ||
'double' => 'Double / Float' | ||
], | ||
|
||
/** | ||
* Standard validation rules | ||
* These are rules most found in Laravel's validation rule set | ||
* The "hasOptions" key allows you to specify additional options for that validation rule. This is dependent on the rule itself | ||
*/ | ||
'standard_validation_rules' => [ | ||
['value'=>'accepted', 'name' => 'Accepted'], | ||
['value'=>'alpha', 'name' => 'Alphabetic Characters'], | ||
['value'=>'alpha_dash', 'name' => 'Alphabetic Characters w/dashes'], | ||
['value'=>'alpha_num', 'name' => 'Alpha-numeric Characters'], | ||
['value'=>'array', 'name' => 'Array'], | ||
['value'=>'between', 'name' => 'Between', 'hasOptions'=>'true', 'options' => ['Min', 'Max']], | ||
['value'=>'boolean', 'name' => 'Boolean'], | ||
['value'=>'date', 'name' => 'Date'], | ||
['value'=>'digits', 'name' => 'Required Number of Digits', 'hasOptions'=>'true', 'options' => ['#']], | ||
['value'=>'digits_between', 'name' => 'Between', 'hasOptions'=>'true', 'options' => ['Min', 'Max']], | ||
['value'=>'email', 'name' => 'Email'], | ||
['value'=>'file', 'name' => 'File'], | ||
['value'=>'integer', 'name' => 'Integer'], | ||
['value'=>'min', 'name' => 'Min', 'hasOptions'=>'true', 'options' => ['Min']], | ||
['value'=>'max', 'name' => 'Max', 'hasOptions'=>'true', 'options' => ['Max']], | ||
['value'=>'nullable', 'name' => 'Allowed Empty'], | ||
['value'=>'required_if', 'name' => 'Required If', 'hasOptions'=>'true', 'options' => ['Field', 'Value']], | ||
['value'=>'required_unless', 'name' => 'Required Unless', 'hasOptions'=>'true', 'options' => ['Field', 'Value']], | ||
['value'=>'string', 'name' => 'String'], | ||
] | ||
]; |
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,13 @@ | ||
<?php | ||
|
||
use Faker\Generator as Faker; | ||
|
||
$factory->define(\jhoopes\LaravelVueForms\Models\FormConfiguration::class, function(Faker $faker) { | ||
return [ | ||
'name' => $faker->word, | ||
'type' => $faker->word, | ||
'active' => $faker->randomElement([1, 0]), | ||
'entity_name' => $faker->word, | ||
'entity_type' => $faker->className, | ||
]; | ||
}); |
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
database/migrations/2020_04_18_005555_update_form_configurations_for_admin.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,44 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class UpdateFormConfigurationsForAdmin extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table('form_configurations', function (Blueprint $table) { | ||
$table->string('type')->nullable()->after('name'); | ||
$table->boolean('active')->default(1)->after('type'); | ||
$table->json('options')->nullable()->after('entity_model'); | ||
|
||
$table->string('entity_name')->nullable()->change(); | ||
$table->string('entity_model')->nullable()->change(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::table('form_configurations', function (Blueprint $table) { | ||
$table->dropColumn([ | ||
'type', | ||
'active', | ||
'options' | ||
]); | ||
|
||
$table->string('entity_name')->nullable(false)->change(); | ||
$table->string('entity_model')->nullable(false)->change(); | ||
}); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
database/migrations/2020_04_18_005610_update_form_fields_for_casts.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,34 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class UpdateFormFieldsForCasts extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table('form_fields', function (Blueprint $table) { | ||
$table->string('cast_to')->nullable()->after('parent_id'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::table('form_fields', function (Blueprint $table) { | ||
$table->dropColumn([ | ||
'cast_to' | ||
]); | ||
}); | ||
} | ||
} |
Oops, something went wrong.