CodeSleeve / laravel-stapler

Stapler-based file upload package for the Laravel framework.
MIT License
557 stars 109 forks source link

Stapler stops working when I use certain packages in the same project. #24

Closed tmunzar closed 9 years ago

tmunzar commented 10 years ago

I have this huge issue working with Stapler that it completely stops uploading pictures whenever I add certain packages to the same project. These packages break it so bad that I have simply removing them doesn't fix the issue. I have to recreate the whole project from scratch and be wary of not using them ever again because they break the project.

Here are the two culprits that have caused this issue:

https://github.com/panique/laravel-sass https://github.com/shift31/laravel-elasticsearch

I can live without the SASS compiler since I'm using Koala instead now but the my project really requires elasticsearch. Can anyone point out why this is happening and can provide a fix for the issue

tmunzar commented 10 years ago

Ok, on further testing I've narrowed down to this: Stapler works perfectly fine when making a new entry in the database using the Model's "create" function. e.g Picture::create(Input::all());

The problem only seems to occur when I'm trying to update an existing model. Like here:

$profile = Profile::where('user_id','=',$id)->first(); $profile->avatar = $filesrc; $profile->save();

It happens as follows when it does this:

Please note that the previous post also holds true. This issue only comes up when I use certain packages alongside stapler in the same project.

tabennett commented 10 years ago

Off the top of my head, I have no idea why those packages would cause this to happen. I haven't used either of those packages before, so I'm kinda in the dark here. Do you have any project files I could use to try and re-create this issue? Without being able to see your models, controllers, etc I don't know that I'm going to be able to help out that much.

hotmeteor commented 9 years ago

I'm also getting zero errors, but also zero uploads to local filesystem or s3.

My packages:

"laravel/framework": "4.2.*",
"guzzlehttp/guzzle": "~4.0",
"laracasts/validation": "~1.0",
"way/generators": "~2.0",
"zizaco/confide": "dev-username-optional",
"zizaco/entrust": "1.2.*@dev",
"aws/aws-sdk-php": "2.*",
"codesleeve/laravel-stapler": "1.0.*"
tabennett commented 9 years ago

@hotmeteor Are you using Eloquent's boot() method in your model? If you are, you'll need to make a call to parent::boot() first. https://github.com/CodeSleeve/stapler/blob/master/docs/troubleshooting.md

hotmeteor commented 9 years ago

It was my foolish mistake. I was trying to do

$user->save(Input::all());

instead of

$user->fill(Input::all());
$user->save();

Thanks for the response.

tabennett commented 9 years ago

@tmunzar are you still having this issue? Is it possible that you're overriding the boot method inside your Eloquent model? See here for more info on what I'm talking about.