Skip to content

Commit 7a754d4

Browse files
author
José Fernando Cordova
committed
Merge branch 'develop'
2 parents a48bda5 + 7e1c4ea commit 7a754d4

File tree

3 files changed

+38
-13
lines changed

3 files changed

+38
-13
lines changed

README.md

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,21 @@
1111
## Docker Environments
1212

1313
### Swarm Mode
14-
In the root directory and following the Docker instructions:
15-
<pre><code># Creating mount folder
14+
Clone this respository and run the following commands:
15+
```bash
16+
cd docker-laravel-api-dev/
17+
# Creating mount folder
1618
mkdir .docker/local-mysql-datadir
17-
docker stack deploy -c docker-compose.yml api-laravel-docker
18-
</code></pre>
19-
19+
docker stack deploy -c docker-compose.yml docker-laravel-api-dev
20+
# wait for it and follow the docker instructions!...
21+
```
2022
### Docker Compose
21-
In the root directory:
22-
<pre><code>docker-compose -f docker-compose.yml up --build -d</code></pre>
23-
23+
Clone this respository and run the following commands:
24+
```bash
25+
cd docker-laravel-api-dev/
26+
docker-compose -f docker-compose.yml up --build -d
27+
# wait for it to build and follow the docker instructions!...
28+
```
2429
### PWD
2530
With Play with Docker and following the docker instructions, it is easy to deploy and test this environment!
2631

@@ -30,7 +35,25 @@ With Play with Docker and following the docker instructions, it is easy to deplo
3035

3136
### Execute Laravel Pre-requisites
3237
In the root directory:
33-
<pre><code>docker container exec [dockerlaravelapidev_php_1 or container Id] composer install && cp.env.example .env && php artisan key:generate && php artisan migrate</code></pre>
38+
```bash
39+
# container lists
40+
docker ps
41+
# next, execute an interactive bash shell on the php container.
42+
docker container exec -t -i [dockerlaravelapidev_php_1 or container Id] bash
43+
```
44+
#### Run the following commands:
45+
46+
##### Compose and Swarm Mode
47+
```bash
48+
composer install && cp .env.example .env && php artisan key:generate && php artisan migrate
49+
chmod 755 -R storage
50+
# forward to the port 80, go to localhost and enjoy!...
51+
```
52+
##### Play With Docker (PWD)
53+
```bash
54+
composer install && php artisan migrate
55+
# forward to the port 80, go to localhost and enjoy!...
56+
```
3457

3558
### How to fix Error: laravel.log could not be opened?
3659
In the root directory or inside the container php:

app/Api/V1/Controllers/LoginController.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ public function login(LoginRequest $request, JWTAuth $JWTAuth): JsonResponse
3636
throw new HttpException(500);
3737
}
3838

39-
ApiResponse::response(200, 'Ok',
40-
['token' => $token, 'expires_in' => Auth::guard()->factory()->getTTL() * 60]);
39+
return ApiResponse::response(200, 'Ok', [
40+
'token' => $token,
41+
'expires_in' => Auth::guard()->factory()->getTTL() * 60
42+
]);
4143
}
4244
}

app/Helpers/ApiResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ class ApiResponse
77
/**
88
* @param string $code
99
* @param string $message
10-
* @param null $response
10+
* @param array $response
1111
* @return \Illuminate\Http\JsonResponse
1212
*/
13-
public static function response(string $code, string $message, $response = null): JsonResponse
13+
public static function response(string $code, string $message, $response = []): JsonResponse
1414
{
1515
return response()->json(['status' => $message, 'response' => $response], $code);
1616
}

0 commit comments

Comments
 (0)