Support the ongoing development of Laravel.io →
posted 10 years ago
Views
Last updated 1 year ago.

hash9211 liked this thread

1

isn't there a helper function to get the base path? so try: $newName = substr($directory, strlen(class_basename($directory));

Last updated 1 year ago.
0

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));
Last updated 1 year ago.

hash9211 liked this reply

1

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) ?> 
Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

JeffreyR jeffreyr Joined 11 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.