Posts

Showing posts with the label laravel-blade

How can I remove spaces in view?

How can I remove spaces in view? I use laravel 5.3 My case is like this : My code in view : " @if(isset($country)) {{ $country }} @endif @if(isset($city)) @if(isset($country)) - @endif {{ $city }} @endif " The result like this : " England - London " I want the result like this : "England - London" How can I do it? What's the difference between result and expectation ? Just spaces ? – Sagar Gautam Jun 7 '17 at 8:36 @Sagar, Yes, it just spaces – Success Man Jun 7 '17 at 8:36 Answer is here stackoverflow.com/questions/26146045/… – kRicha ...

Remove time() string from filenames in Laravel when showing

Remove time() string from filenames in Laravel when showing I am using time() function to add time string to the file names like this and storing them in the database $filename = time() . $file->getClientOriginalName(); But How Can I remove this string when I show the files to the user and when the user downloads the file. I am using Laravel by the way. 1 Answer 1 The timestamp is 10 digits I believe, so doing: substr($filename,10): Would trim it from the beginning of the filename. When downloading a file, you can give the file name which is displayed/suggested to the user like this: return response()->download($filename, substr($filename, 0, 10), $headers); substr($filename, 0, 10): this has removed the file name except the time() string but using this substr($filename, 10) has solved my problem. and I wanna ask how could I make users download the file. I mean how...