Package Data | |
---|---|
Maintainer Username: | perezjbryan |
Package Create Date: | 2016-02-24 |
Package Last Update: | 2017-07-18 |
Language: | CSS |
License: | MIT |
Last Refreshed: | 2024-11-17 03:05:04 |
Package Statistics | |
---|---|
Total Downloads: | 5,259 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 2 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Step 1: Add laravel5 path repo for toddish/verify package
"repositories": [
{
"type": "vcs",
"url": "https://github.com/industrious-mouse/Verify-L4"
}
],
Step 2: Install via composer
> composer require bpez/infuse:5.*
Step 3: Add the ServiceProvider
// config/app.php
'providers' => [
...
'Bpez\Infuse\InfuseServiceProvider' ,
] ,
Step 4: Add to middleware
// app\http\Kernel.php
protected $middleware = [
...
'Bpez\Infuse\Middleware\InfuseBeforeMiddleware',
'Bpez\Infuse\Middleware\InfuseAfterMiddleware'
];
Step 5: Configure auth file
// config/auth.php
...
'driver' => 'verify',
'model' => 'InfuseUser',
...
'password' => [
'email' => 'infuse::emails.password',
...
],
...
Step 6: Publish Configurations & public assets & run migrations
> 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"
Step 7: Add to composer.json
"post-update-cmd": [
...
"php artisan vendor:publish --provider="\Bpez\Infuse\InfuseServiceProvider" --tag=infuse_public --force"
],
Step 8: Add to .htaccess
RewriteEngine On
...
RewriteCond %{HTTP:Cookie} devicePixelRatio [NC]
RewriteRule \.(?:jpe?g|gif|png|bmp)$ bpez/infuse/other/retinaimages.php [NC,L]
Step 9: Run infuse migrations
> php artisan migrate
Step 10: Add support to server retina images
RewriteCond %{HTTP:Cookie} devicePixelRatio [NC]
RewriteRule \.(?:jpe?g|gif|png|bmp)$ /packages/bpez/infuse/retinaimages.php [NC,L]
> https://github.com/websoftwares/Throttle
> http://laravel.com/docs/cache
> https://github.com/frenzyapp/turbolinks
> https://github.com/rails/turbolinks
> https://github.com/kossnocorp/jquery.turbolinks
> sudo curl https://raw.github.com/villimagg/Artisan-on-Steroids/master/artisan -o /usr/local/bin/artisan && sudo chmod +x /usr/local/bin/artisan
imports:
- vendor/bpez/infuse/behat.yml
model(mapConifig -> getbModelInstance(s) -> boot -> apiCalls) -> process(route -> renderView)
Turn database field to a html form select. Take in single instanct or multiple.
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'),
...
);
Adds a description to a database field.
describeColumn(array(
array(
"column" => $columnName,
"desc" => "description here",
"popover" => true
)
...
);
Only allow one database entry to be display and created.
onlyOne();
Add a SQL where clause to configuration.
addPermanentFilters(array(
array(
"column" => $columnName,
"operator" => "=",
"value" => 87
)
...
);
Add a default value for when an entry is saved.
defaultColumnValues(array(
"column_name_1" => $value1,
"column_name_2" => $value2,
...
);
Transform field to multiple select. Where IDs are kept track separated by a coma.
addMultiSelect(array(
array(
"column" => $columnName,
"array" => array(),
),
...
);
array(
array('id' => 1, ", 'name' => 'display name'),
array('id' => 2, ", 'name' => 'display name'),
...
)
One To Many relationships are defined here. Define children relations like format below.
hasMany(array(
array("SomeModelName", "Display Name", array("column_name_1", "column_name2"...) $optionsArray),
...
);
Ex. Child Columns array may have an array nested to match an id with a value like below:
$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",
...
)
array("category" => $categories)
$optionsArray = array(
"order_column" => "display_order",
"order_direction" => "ASC",
"order_integer" => true
)
Ex. For adding custom export and import functions.
$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.",
)
Ex. Split table to act like 2 child tables separated by where clauses.
$optionsArray = array(
"split" => array(
"Gallery Assets" => "main_gallery = 1",
"Gallery 2 Assets" => "main_gallery = 0"
)
)
Changes column to an column to be used for ordering entries. Integer is used for the type. Makes field not editable by user and value automatically set.
displayOrder(array("display_order_column"));
Configure columns for file upload functionality.
fileUpload(
array(
array("column" => "column_name"),
)
)
Turns a text field to a addCkeditor.
addCkeditor(
array("column_name_1", "column_name_2", ...)
)
Add extra action to entry's actions (show | edit | delete | YourActionHere ). Returning an array("type" => "success", "message" => $message) can tap into notification system. Type can be ("success" || "error" || "info" || "warning"). Or returning false will trigger default error message.
callFunction(array(
array(
"function" => "importSomeThing",
"display_name" => "Import some thing",
"long_process" => "Processing please wait...",
"target" => "_BLANK"
),
...
);
Ex. importSomeThing implementation. Returns an array to the admin marked with type ("success" || "error") and message along with it.
public function importSomeThings()
{
// ... some work here
$message = "Thanks";
return array("type" => "success", "message" => $message);
}
Add top level action under the "Other Actions" dropdown on the scaffold listing page. Function should be static function from the top level model. User instance is passed into static function. Returning an array("type" => "success", "message" => $message) can tap into notification system. Type can be ("success" || "error" || "info" || "warning"). Or returning false will trigger default error message.
addOtherAction(array(
array(
"function" => "seedUrls",
"display_name" => "Import some thing",
),
...
);
Ex. seedUrls implementation
public function seedUrls($currentUser)
{
// ... some work here
$message = "Thanks";
return array("type" => "success", "message" => $message);
}
Lets you select the column ordering for the edit/create page. Pass in an array with the column names in the desired order.
editListingOrder(array(
"created_at",
"updated_at",
"destination_site",
"display_state",
"property",
"mobile_video_img",
"sub_title",
"video",
"title",
));
Setup models to work with infuse by extending the InfuseModel and using InfuseModelLibrary trait.
class BlogPost extends InfuseModel {
use InfuseModelLibrary;
}
Fetch the full url path for the file name saved to the specific column. Call the url method and pass in the column name as a parameter.
$post = new BlogPost;
$post->url($columnName); // Will return a url similar to http://somedomain.com/upload/some/path/name.jpg
Building on top of url functionality return an instance of a thumbor client. Only works on columns the have a file saved to them. Thumbor is a smart imaging service. It enables on-demand crop, resizing and flipping of images. Thumbor documentation and thumber client documentation can found here:
Services configuration required please see service configuration below for setup.
$post = new BlogPost;
$post->thumbor($columnName)->smartCrop(true)->resize(699, 525); // Will return a url to the cropped or filtered version
<?php $post = new BlogPost; ?>
<img src="{{$post->thumbor($columnName)->smartCrop(true)->resize(699, 525)}}" data-no-retina />
Same functionality as InfuseModel url method. For other image resources.
Util::thumbor($url);
<?php $post = new BlogPost; ?>
<img src="{{Util::thumbor($url)->smartCrop(true)->resize(699, 525)}}" data-no-retina />
For delivering assets originating from same origin through CloudFront CDN. Services configuration required please see service configuration below for setup.
Util::cdn($url);
/config/services.php
'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',
],
Include the Util::infuse() on your page (put it at the bottom of your template, before your closing tag)
{!! Util::infuse() !!}
</body>
</html>
S3 CORS needs to be enabled and config needed for retina support:
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>Authorization</AllowedHeader>
</CORSRule>
</CORSConfiguration>'self-hosted' => 'http://d54343425.cloudfront.net',
],
Created with http://dillinger.io
Do do list