File tree 3 files changed +25
-4
lines changed
3 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -31,18 +31,18 @@ class Service
31
31
*/
32
32
public function upload ($ image , $ path = null , $ makeDiffSizes = true )
33
33
{
34
- $ this ->directory (public_path ( $ path ));
34
+ $ this ->directory (storage_path ( ' app/public/ ' . $ path ));
35
35
$ name = $ image ->getClientOriginalName ();
36
- $ image ->move (public_path ( $ path ), $ name );
37
- $ relativePath = public_path ( $ path . DIRECTORY_SEPARATOR . $ name );
36
+ $ image ->move (storage_path ( ' app/public/ ' . $ path ), $ name );
37
+ $ relativePath = storage_path ( ' app/public/ ' . $ path . DIRECTORY_SEPARATOR . $ name );
38
38
39
39
if (true === $ makeDiffSizes ) {
40
40
$ sizes = config ('avored-framework.image.sizes ' );
41
41
foreach ($ sizes as $ sizeName => $ widthHeight ) {
42
42
list ($ width , $ height ) = $ widthHeight ;
43
43
$ this ->make ($ relativePath );
44
44
$ this ->resizeImage ($ width , $ height , 'crop ' );
45
- $ imagePath = public_path ( $ path ) . DIRECTORY_SEPARATOR . $ sizeName . '- ' . $ name ;
45
+ $ imagePath = storage_path ( ' app/public/ ' . $ path ) . DIRECTORY_SEPARATOR . $ sizeName . '- ' . $ name ;
46
46
$ this ->saveImage ($ imagePath , 100 );
47
47
}
48
48
}
Original file line number Diff line number Diff line change @@ -51,4 +51,13 @@ public function query();
51
51
* @return \AvoRed\Framework\Models\Database\Category
52
52
*/
53
53
public function create (array $ data );
54
+
55
+ /**
56
+ * Get an Category Options for Vue Components
57
+ *
58
+ * @return \Illuminate\Database\Eloquent\Collection
59
+ */
60
+ public function options ();
61
+
62
+
54
63
}
Original file line number Diff line number Diff line change @@ -68,4 +68,16 @@ public function create($data)
68
68
{
69
69
return Category::create ($ data );
70
70
}
71
+
72
+ /**
73
+ * Get an Category Options for Vue Components
74
+ *
75
+ * @return \Illuminate\Database\Eloquent\Collection
76
+ */
77
+ public function options ()
78
+ {
79
+ $ empty = new Category ();
80
+ $ empty ->name = 'Please Select ' ;
81
+ return Category::all ()->prepend ($ empty );
82
+ }
71
83
}
You can’t perform that action at this time.
0 commit comments