Laravel photo uploader class
Add a constructor. I'm pretty sure you can type hint your dependency too, so long as you know what you're working with, you can adjust to your needs.

use Symfony\Component\HttpFoundation\File\UploadedFile;

class Photo {    

    protected $fileName;
    protected $extension;
    protected $hashedName;
    protected $path;

    public function __construct(UploadedFile $input)
    {
        $this-&gt;fileName     = $input-&gt;getClientOriginalName();
        $this-&gt;extension    = $input-&gt;getClientOriginalExtension();
        $this-&gt;hashedName   = sha1(time() . $this-&gt;fileName);
        $this-&gt;path         = $this-&gt;hashedName . '.' .$this-&gt;extension;
    }

    // methods...

}


Please also note in your code you wrote protected $filename; then referenced back to that in your methods as $this-&gt;fileName - make sure you get the n or N consistent.

You can always make a getter for the path attribute instead of making it public keep it protected.

public function getPath()
{
    return $this-&gt;path;
}


Hope that helps!