0 Best Reply Awards

  • Member Since 3 Years Ago
  • 15 Lessons Completed
  • 0 Favorites

28th September, 2017

bgies left a reply on Session Variables Not Saving / Persisting After Redirect • 1 year ago

@saurabh moving the StartSession::class to the middleware array worked for me, but I really want to know why, and what that changes. Can you add that to your answer?

Oh, FYI.. the kernel.php file is at app/Http/kernel.php

19th May, 2017

bgies left a reply on What Data Type To Use In Eloquent For Price • 1 year ago

The accepted datatype for money, according to GAAP (Generally Accepted Accounting Principles) is Decimal (9, 4).... if you need bigger numbers then Decimal (13, 4)...

You should never use floats for money as they are stored in the database as approximations and if you multiply many times your results will not be accurate

20th December, 2016

bgies started a new conversation How To Change PHP Versions In Homestead 4 • 1 year ago

It seems Homestead 4 comes with 4 installed versions of PHP (5.5 5.6 7.0 7.1), at least there are 4 listed in /etc/php.

Anyone know how we change the version it's using?

Great feature by the way.... it's something I've been looking for :).

bgies left a reply on Homestead Not Using Latest PHP Version? • 1 year ago

Just to clarify @tomi answer... if you run the command in a Windows terminal session, you are using the version of PHP on your windows box.... if you want to use the Homestead PHP version, you need to terminal into Homestead (Putty works great).

16th May, 2016

bgies left a reply on Laravel Framework File Permission - Security • 2 years ago

Just to state the obvious for anyone viewing this discussion.... if you give any of your folders 777 permissions, you are allowing ANYONE to read, write and execute any file in that directory.... what this means is you have given ANYONE (any hacker or malicious person in the entire world) permission to upload ANY file, virus or any other file, and THEN execute that file...


What bashy says above is absolutely correct, although not totally complete.

The NORMAL way to set permissions is to have your files owned by the webserver: sudo chown -R www-data:www-data /path/to/your/root/directory

if you do that, the webserver owns all the files, and is also the group, and you will have some problems uploading files or working with files via FTP, because your FTP client will be logged in as you, not your webserver, so add your user to the webserver user group: sudo usermod -a -G www-data ubuntu Of course, this assumes your webserver is running as www-data (the Homestead default), and your user is ubuntu (it's vagrant if you are using Homestead.

Then you set all your directories to 755 and your files to 644... SET file permissions sudo find /path/to/your/root/directory -type f -exec chmod 644 {} ; SET directory permissions sudo find /path/to/your/root/directory -type d -exec chmod 755 {} ;

I prefer to own all the directories and files (it makes working with everything much easier), so I do: sudo chown -R www-data:www-data /path/to/your/root/directory Then I give both myself and the webserver permissions: sudo find /path/to/your/root/directory -type f -exec chmod 664 {} ; sudo find /path/to/your/root/directory -type d -exec chmod 775 {} ;

Whichever way you set it up, then you need to give read and write permissions to the webserver for storage, cache and any other directories the webserver needs to upload or write too (depending on your situation), so run the commands from bashy above :

sudo chgrp -R www-data storage bootstrap/cache sudo chmod -R ug+rwx storage bootstrap/cache

Now, you're secure and your website works, AND you can work with the files fairly easily

Edit Your Profile

Want to change your profile photo? We pull from