Skip to content

Commit 0866ffa

Browse files
authored
Merge pull request #5 from avored/dev
meging dev to master
2 parents aa77d33 + ff21df6 commit 0866ffa

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

src/Image/Service.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,18 @@ class Service
3131
*/
3232
public function upload($image, $path = null, $makeDiffSizes = true)
3333
{
34-
$this->directory(public_path($path));
34+
$this->directory(storage_path('app/public/' . $path));
3535
$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);
3838

3939
if (true === $makeDiffSizes) {
4040
$sizes = config('avored-framework.image.sizes');
4141
foreach ($sizes as $sizeName => $widthHeight) {
4242
list($width, $height) = $widthHeight;
4343
$this->make($relativePath);
4444
$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;
4646
$this->saveImage($imagePath, 100);
4747
}
4848
}

src/Models/Contracts/CategoryInterface.php

+9
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,13 @@ public function query();
5151
* @return \AvoRed\Framework\Models\Database\Category
5252
*/
5353
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+
5463
}

src/Models/Repository/CategoryRepository.php

+12
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,16 @@ public function create($data)
6868
{
6969
return Category::create($data);
7070
}
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+
}
7183
}

0 commit comments

Comments
 (0)