isn't there a helper function to get the base path? so try: $newName = substr($directory, strlen(class_basename($directory));
Yep, use class_basename()
or simply just basename()
which is already there for exactly this in php core.
$directories = array_map('basename', File::directories($path));
hash9211 liked this reply
The first answer was also good, but Tlgreg gave the complete answer in combination with the laravel code.
Here is the code intergrated into my files:
<?php
$directorySelect = array();
foreach( $directories as $directory ) :
$directorySelect[$directory] = $directory;
endforeach; $directories = array_map('basename', $directorySelect);
echo Form::select('KAMdossierNummers', $directories) ?>
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community