Skip to content

Commit

Permalink
Ran linting
Browse files Browse the repository at this point in the history
  • Loading branch information
amitavroy committed Dec 28, 2024
1 parent 4541770 commit 978c1fd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 20 deletions.
2 changes: 1 addition & 1 deletion app/Domain/Product/Models/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected static function newFactory(): ProductFactory
protected function featuredImage(): Attribute
{
return Attribute::make(
get: fn(?string $value): mixed => $value
get: fn (?string $value): mixed => $value
? route('private-image', ['filename' => $value])
: config('app.default_product_pic')
);
Expand Down
4 changes: 2 additions & 2 deletions bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__ . '/../routes/web.php',
commands: __DIR__ . '/../routes/console.php',
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
then: function () {
Route::middleware('web')->group(base_path('routes/products.php'));
Expand Down
16 changes: 9 additions & 7 deletions resources/js/Pages/Product/Show.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ import { useForm, router } from '@inertiajs/vue3'
import { ref } from 'vue'
const { product } = defineProps({
product: Object
product: Object,
})
const breadCrumb = [
{ name: 'Commerce', link: route('product.index') },
{
name: 'View Products',
link: route('product.index')
link: route('product.index'),
},
{
name: 'Add Products',
link: null
}
link: null,
},
]
const fileInput = ref(null)
const productPicForm = useForm({
featured_image: null
featured_image: null,
})
function triggerFileInput() {
Expand All @@ -37,13 +37,15 @@ const handleFileUpload = (event) => {
productPicForm.featured_image = event.target.files[0]
productPicForm.submit(
'post',
route('product.add-feature-image', { product: product.id })
route('product.add-feature-image', { product: product.id }),
)
}
const handleProductImageDelete = () => {
if (confirm('Sure you delete this image?')) {
router.delete(route('product.remove-feature-image', { product: product.id }))
router.delete(
route('product.remove-feature-image', { product: product.id }),
)
}
}
</script>
Expand Down
14 changes: 4 additions & 10 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
use App\Http\Controllers\Notification\MarkNotificationReadController;
use App\Http\Controllers\Notification\NotificationController;
use App\Http\Controllers\OrderController;
use App\Http\Controllers\ProductController;
use App\Http\Controllers\ProductImageUploadController;
use App\Http\Controllers\ProfilePicUploadController;
use App\Http\Controllers\UserController;
use App\Http\Controllers\UserPasswordChangeController;
use App\Http\Controllers\UserSettingController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

Expand All @@ -22,7 +16,7 @@
Route::group(['middleware' => 'auth'], function () {
Route::get('/', HomeController::class)->name('home');
Route::post('/logout', LogoutController::class)->name('logout');

Route::resource('/customer', CustomerController::class)->only(['index', 'show']);
Route::resource('/order', OrderController::class)->only(['index', 'show']);

Expand All @@ -31,13 +25,13 @@
});

Route::get('/private-image', function (Request $request) {
if (!$request->has('filename')) {
if (! $request->has('filename')) {
abort(404);
}

$filename = $request->input('filename');
$path = storage_path('app/private/' . $filename);
if (!Storage::exists($filename)) {
$path = storage_path('app/private/'.$filename);
if (! Storage::exists($filename)) {
abort(404);
}

Expand Down

0 comments on commit 978c1fd

Please sign in to comment.