PHP code example of bpez / infuse

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

    

bpez / infuse example snippets


> composer 

// config/app.php
'providers' => [
    ...
    'Bpez\Infuse\InfuseServiceProvider' ,
] ,

// app\http\Kernel.php
protected $middleware = [
  ...
  'Bpez\Infuse\Middleware\InfuseBeforeMiddleware',
  'Bpez\Infuse\Middleware\InfuseAfterMiddleware'
];

// config/auth.php
...
'driver' => 'verify',
'model' => 'InfuseUser',
...
'password' => [
    'email' => 'infuse::emails.password',
    ...
  ],
...

model(mapConifig -> getbModelInstance(s) -> boot -> apiCalls) -> process(route -> renderView)

addSelect(array(
    array(
        "column" => $columnName,
        "array" => array(),
        "insertBlank" => false,
        "topSelect" => false,
        "nested" => $nested,
        "nestedLastArray" => $nestedLastArray )
    ),
    ...
);

array(
    array('id' => 1, ", 'name' => 'display name'),
    array('id' => 2, ", 'name' => 'display name'),
    ...
)

$nested = array(
    "Floorplan",
    array("model" => "ImageAsset", "column" => "title")
);

$nestedLastArray = array(
    array('id' => 1, ", 'name' => 'display name'),
    array('id' => 2, ", 'name' => 'display name'),
    ...
);

describeColumn(array(
    array(
        "column" => $columnName,
        "desc" => "description here",
        "popover" => true
    )
    ...
);

onlyOne();

addPermanentFilters(array(
    array(
        "column" => $columnName,
        "operator" => "=",
        "value" => 87
    )
    ...
);

defaultColumnValues(array(
    "column_name_1" => $value1,
    "column_name_2" => $value2,
    ...
);

addMultiSelect(array(
    array(
        "column" => $columnName,
        "array" => array(),
    ),
    ...
);

array(
    array('id' => 1, ", 'name' => 'display name'),
    array('id' => 2, ", 'name' => 'display name'),
    ...
)

hasMany(array(
    array("SomeModelName", "Display Name", array("column_name_1", "column_name2"...) $optionsArray),
    ...
);

$childColumnArray = array(
  "column_1",
  "column_2",
  array("column_3" => array(
    array("id" => 1, "name" => "some name"),
    array("id" => 2, "name" => "some name 2")
  ),
  "column_4",
  ...
)

$optionsArray = array(
  "order_column" => "display_order",
  "order_direction" => "ASC",
  "order_integer" => true
)

$optionsArray = array(
    "import_csv_function" => "importUserModelInstancMethod",
    "import_csv_function_url" => "/path/to/example/template.csv",
    "import_csv_function_text" => "Import CSV for users. Use template provided.",
    "export_csv_function" => "exportUserModelInstanceMethod",
    "export_csv_function_text" => "Export CSV template to import.",
)

$optionsArray = array(
    "split" => array(
		"Gallery Assets" =>	"main_gallery = 1",
		"Gallery 2 Assets" =>	"main_gallery = 0"
	)
)

displayOrder(array("display_order_column"));

fileUpload(
  array(
    array("column" => "column_name"),
  )
)

addCkeditor(
    array("column_name_1", "column_name_2", ...)
)

callFunction(array(
    array(
        "function" => "importSomeThing",
        "display_name" => "Import some thing",
        "long_process" => "Processing please wait...",
        "target" => "_BLANK"
    ),
    ...
);

public function importSomeThings()
{
	// ... some work here
	$message = "Thanks";
	return array("type" => "success", "message" => $message);
}

addOtherAction(array(
    array(
        "function" => "seedUrls",
        "display_name" => "Import some thing",
    ),
    ...
);

public function seedUrls($currentUser)
{
	// ... some work here
	$message = "Thanks";
	return array("type" => "success", "message" => $message);
}

editListingOrder(array(
    "created_at",
    "updated_at",
    "destination_site",
    "display_state",
    "property",
    "mobile_video_img",
    "sub_title",
    "video",
    "title",
));

class BlogPost extends InfuseModel {

	use InfuseModelLibrary;

}

$post = new BlogPost;
$post->url($columnName); // Will return a url similar to http://somedomain.com/upload/some/path/name.jpg

$post = new BlogPost;
$post->thumbor($columnName)->smartCrop(true)->resize(699, 525); // Will return a url to the cropped or filtered version

Util::thumbor($url);

Util::cdn($url);

'thumbor' => [
    // Thumbor security key here
	'security-key' => '843208u4325032u502532582358235',
	// Use cloudfront in front of thumbor for scalability.
	'host' => 'http://d443523423.cloudfront.net',
],

'cloudfront' => [
    // Distribution domain for file uploaded through infuse.
	's3-uploads' => 'http://d4253425.cloudfront.net',
	// Distribution domain for assets originating from same origin.
	'self-hosted' => 'http://d54343425.cloudfront.net',
],
cmd
> php artisan vendor:publish --provider="\Bpez\Infuse\InfuseServiceProvider" --tag=infuse_public --force
> php artisan vendor:publish --provider="\Bpez\Infuse\InfuseServiceProvider" --tag=infuse_config
> php artisan vendor:publish --provider="\Bpez\Infuse\InfuseServiceProvider" --tag=infuse_structure
> php artisan migrate --path="vendor/bpez/infuse/migrations"
json
"post-update-cmd": [
    ...
    "php artisan vendor:publish --provider="\Bpez\Infuse\InfuseServiceProvider" --tag=infuse_public --force"
],
cmd
> php artisan migrate

htaccess
RewriteCond %{HTTP:Cookie} devicePixelRatio [NC]
RewriteRule \.(?:jpe?g|gif|png|bmp)$ /packages/bpez/infuse/retinaimages.php [NC,L]
html
 $post = new BlogPost; 
html
 $post = new BlogPost;