Skip to content

Commit

Permalink
Added ENV Configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
divinrkz committed Mar 8, 2021
1 parent 3bcf83f commit 14d4dd1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ APP_NAME=Ecommerce
APP_ENV=local
APP_KEY=base64:gpzJEN4AwReJpm1PrIZIeWxD6cDD+zMtAPqcetGDYAM=
APP_DEBUG=true
APP_URL=http://Server.test
APP_MODE=development
APP_DEV_URL=http://localhost:8000
APP_PROD_URL=http://Server.test

LOG_CHANNEL=stack
LOG_LEVEL=debug
Expand Down
6 changes: 5 additions & 1 deletion app/Http/Controllers/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ public function all(): JsonResponse
$productFiles = array();
foreach ($product->images as $image) {
$file = File::query()->find($image);
$productFile = array('id' => $image, 'file_path' => $file->file_url, 'file_url' => ($file->file_url));
$domain = (env('APP_MODE') == 'local') ? env('APP_DEV_URL'): env('APP_PROD_URL');
$productFile = array(
'id' => $image,
'file_path' => $file->file_url,
'file_url' => $domain . ($file->file_url));
array_push($productFiles, $productFile );
dd($productFiles);

Expand Down

0 comments on commit 14d4dd1

Please sign in to comment.