Lara-Crud

Package for quick deployment admin panel on Laravel

The method determines the properties of fields


$this->setTypeField(array [$field => mixed $param])

Parameter List

array

Takes the array settings field.

param

Can be an array or string.

Example of setting text fields. You can override the field type.

Example: $this->setTypeField([ 'field_name' => 'textarea' or 'text' or 'number' or 'tel' ..., ... ]);

Example of setting the radio field.

Example: $this->setTypeField([ 'field_name' => ['radio', ['1' => 'Yes', '0' => 'No', '3' => 'Maybe']], ... ]);

Example of setting the checkbox field.

Example: $this->setTypeField([ 'field_name' => ['checkbox', '1'], ... ]);

Example of configuring the select field.

Example: $this->setTypeField([ 'field_name' => ['select', ['1' => '111', '2' => '222']], ... ]);

Example of configuring the select field. The data in the field is loaded with Ajax.

Example: $this->setTypeField([ 'field_name' => ['select', [CategoryModel::class, 'id', 'title']], ... ]);

Example of setting the field select relation many to many data in the field are loaded Ajax.

Example:
/**
* category_contacts - Relationship table    
*/

$this->setTypeField([
  'field_name' => ['select', [CategoryModel::class, 'id', 'title'], 'multiple', [CategoryModel::class, 'category_contacts', 'contacts_id', 'category_id']],
  ... or
  'field_name' => ['select', ['1' => 'Yes', '2' => 'No', '3' => 'Maybe'], 'multiple', [CategoryModel::class, 'category_contacts2', 'contacts_id', 'category_id']]
]);   

An example of setting the file field.

Parameter List

file

Field Type

file_upload_directory

The name of the directory where the files are downloaded. public\file_upload_directory

If the multiple constant is set multiple downloads of files.

Example: $this->setTypeField([ 'field_name' => ['file', 'file_upload_directory', 'multiple'], ... ]);