PHP code example of razorcreations / ajax-field

1. Go to this page and download the library: Download razorcreations/ajax-field 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/ */

    

razorcreations / ajax-field example snippets


	// Inside your resources fields definition
	AjaxField::make('Foo')->setUrl('/api/ajaxselect/foo'),

	// If you are using integers or floats for the values ensure to chain on the type methods...
	AjaxField::make('Foo')->setUrl('/api/ajaxselect/foo')->typeInt(),

	AjaxField::make('Foo')->setUrl('/api/ajaxselect/foo')->setValueKey('id')->setLabelKey('name'),

	// Create a parent field 
	Text::make('Foo', 'foo');
	
	// Create ajax field, with parent method 
	AjaxField::make('Bar')->setUrl('/api/ajaxselect/foo')->parent('foo'),

	AjaxField::make('Foo')->setUrl('/api/ajaxselect/foo')->responsive(),