Created
September 9, 2015 18:25
-
-
Save rossriley/f0c677b79ae43d7dfa96 to your computer and use it in GitHub Desktop.
Add a contenttype / id prefix to an image upload path
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
<?php | |
// Appears in your bootstrap file, before the call to $app->run() | |
$app['upload'] = $app->extend('upload', function ($handler, $app) { | |
if ($app['request']->get('contenttype') == 'pages') { | |
if ($app['request']->get('contenttypeslug') && $app['request']->get('id')) { | |
$handler->setPrefix("/".$app['request']->get('contenttypeslug')."/".$app['request']->get('id')); | |
} | |
} | |
return $handler; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment