-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Various tweaks and improvements, seed two filters
- Loading branch information
Bradie Tilley
committed
Jun 17, 2019
1 parent
16db1e9
commit 3c90b89
Showing
6 changed files
with
174 additions
and
29 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
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
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,99 @@ | ||
<?php namespace ABWebDevelopers\Portfolio\Updates; | ||
|
||
use Schema; | ||
use October\Rain\Database\Updates\Migration; | ||
use ABWebDevelopers\ImageResize\Models\Settings; | ||
|
||
class SeedFilters extends Migration | ||
{ | ||
public function up() | ||
{ | ||
$filters = Settings::get('filters'); | ||
|
||
$hasThumbnail = false; | ||
$hasHero = false; | ||
|
||
foreach ($filters as $key => $value) { | ||
if ($value['code'] == 'thumbnail') { | ||
$hasThumbnail = true; | ||
} elseif ($value['code'] == 'hero') { | ||
$hasHero = true; | ||
} | ||
} | ||
|
||
if (!$hasThumbnail) { | ||
$filters[] = [ | ||
"code" => "thumbnail", | ||
"description" => "Basic thumbnail filter", | ||
"rules" => [ | ||
[ | ||
"modifier" => "max_width", | ||
"value" => "500", | ||
], | ||
[ | ||
"modifier" => "max_height", | ||
"value" => "500", | ||
], | ||
[ | ||
"modifier" => "brightness", | ||
"value" => "50", | ||
], | ||
[ | ||
"modifier" => "background", | ||
"value" => "#fff", | ||
], | ||
[ | ||
"modifier" => "greyscale", | ||
"value" => "true", | ||
], | ||
[ | ||
"modifier" => "quality", | ||
"value" => "60", | ||
], | ||
[ | ||
"modifier" => "format", | ||
"value" => "jpg", | ||
], | ||
[ | ||
"modifier" => "mode", | ||
"value" => "cover", | ||
], | ||
], | ||
]; | ||
} | ||
|
||
if (!$hasHero) { | ||
$filters[] = [ | ||
"code" => "hero", | ||
"description" => "Standard hero filter", | ||
"rules" => [ | ||
[ | ||
"modifier" => "width", | ||
"value" => "1920", | ||
], | ||
[ | ||
"modifier" => "height", | ||
"value" => "500", | ||
], | ||
[ | ||
"modifier" => "mode", | ||
"value" => "cover", | ||
], | ||
[ | ||
"modifier" => "quality", | ||
"value" => "80", | ||
], | ||
[ | ||
"modifier" => "format", | ||
"value" => "jpg", | ||
], | ||
], | ||
]; | ||
} | ||
} | ||
|
||
public function down() | ||
{ | ||
|
||
} | ||
} |
Oops, something went wrong.