vendredi 15 janvier 2016

Larevel Jobs are are using different paths on execution

I have a Job who generates an image when an user is created, so I have something like:

imagepng($img, 'avatar/'.$name.'.png');     

My problem is, when I execute the seeders I need to use this:

imagepng($img, 'public/avatar/'.$name.'.png');

Why I don't have to tell laravel to use public when I'm not in seeders?, I think it should be becouse seeds are executed as Console, and when a new user is created from the app, it enter points is Http(and Http points to public).

Is there some nice way to solve this?, and some way to check if I'm executing a terminal command or entering througt http?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire