My method to delete an image from database and local storage.
public function destroy($id) {
$image = DB::table('images')->where('id', '=', $id)->first();
//print_r($image);
//return 'end';
File::delete(public_path() . '/images/gallery/thumb-' . $image->path);
File::delete(public_path() . '/images/gallery/' . $image->path);
$image->delete();
return Redirect::back()
->with('form_success', 1)
->with('form_message', 'Image successfully deleted!');
}
If I try to return value of $image
I get:
stdClass Object ( [id] => 49 [site_id] => 1 [page_id] => [location] => gallery [alt] => [path] => 60e52a2755ffe8923d5ac1232f5d9154.jpg )
So what's wrong with my code? Now my Laravel version is 4.2.1, but i try to downgrade him to 4.1.17, but no changes.