themsaid / laravel-langman

Language files manager in your artisan console.
MIT License
876 stars 166 forks source link

Fix create new file #14

Closed ahmedash95 closed 8 years ago

ahmedash95 commented 8 years ago

when i execute

php artisan langman:trans file.name

If file does not exist it returns

Language file file.php not found, would you like to create it? (yes/no) [no]:

then I type yes and the file gets created with content

<?php

then when I re-execute the command

it asks me for the name key of each language. there is no problem here . but the problem is the new content of the file

<?php

return [ 
    0 => 1,
   'name' => 'Name'
]

the reason of the first index 0 with value 1 is getFileContent() Method

return (array) include $filePath;

with empty file the content is '<?php \n' return 0 => 1

so a change to the content of the new file stub should be

file_put_contents($filePath, "<?php\n\nreturn [];");
themsaid commented 8 years ago

Oh, nice catch 👍

AliBedaer commented 8 years ago

well done bro (y) @ahmedash95