Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
YoussF committed Feb 11, 2020
1 parent 976fd7e commit 9689170
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 8 deletions.
17 changes: 10 additions & 7 deletions Docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ docker image tag bradtraversy/nginx bradtraversy/nginx:testing
docker pull mysql
# Inspect and see image
docker image inspect mysql
# Visualise docker image history
docker history image_name
# Search for an image on Dockerhub
docker search mysql
```

## Docker Networks
Expand Down Expand Up @@ -65,8 +69,14 @@ docker container stop $(docker container ls -aq)
docker container rm $(docker container ls -aq)
# Stop and remove all containers:
docker stop $(docker container ls -aq) && docker rm $(docker container ls -aq)
# Stop and remove all containers (shorthand):
docker rm -f [container_name]
#Remove all caches images:
docker rmi $(docker images -a -q)
# Get interactive shell on specified container
docker exec -it [container_name or container_ID] bash
# Rename container
docker rename old_name new_name
```

## Docker compose
Expand All @@ -78,10 +88,3 @@ docker-compose up -d
# down
docker-compose down
```

## Advantages of conternerized applications for developers:

- **Accelerate Developer Onboarding** A new hired dev can get an entire environment up and running very quickly. With the use of things like docker-compose, etc...
- **Eliminate App Conflicts** We can run multiple version of the same app very easily.
- **Environment Consistency** Developers can replicate the production environment on there own machines.
- **Ship Software Faster**
Binary file added Laravel/Laravel Cheatsheet.pdf
Binary file not shown.
14 changes: 14 additions & 0 deletions Laravel/Laravel-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Create boilerplate for a resource
```bash
# Generate model, migration and factory
docker exec nimbl-dev-php-container php artisan make:model Invoice -m -f
# Generate Api Controller
docker exec nimbl-dev-php-container php artisan make:controller InvoiceController --api
# Generate Database Seeder
docker exec nimbl-dev-php-container php artisan make:seeder InvoicesTableSeeder
# Generate API Resource
docker exec nimbl-dev-php-container php artisan make:resource InvoiceResource
# Generate API ResourceCollection
docker exec nimbl-dev-php-container php artisan make:resource InvoiceCollection
```

18 changes: 17 additions & 1 deletion Laravel.md → Laravel/Laravel.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ make:seeder UserTableSeeder # Make user database table seeder

make:test Create a new test class
```

# Composer
```bash
composer create-project laravel/laravel folder_name
composer install
composer update
composer dump-autoload [--optimize]
composer self-update
```

## Eloquent
```php
<?
Expand All @@ -56,7 +66,9 @@ App\User::findOrFail(1);
App\User::find([1, 2, 3]);
# Find mathcing records ids or thow not found Exception if any is missing
App\User::findOrFail([1, 2, 3]);

# Load model with relationships
App\User::with('posts.comments')->findOrFail(300)
App\Compagny::with(['account.owner','contacts'])->find(1)
# Filter Query
App\User::where('active', 1);
# Multiple filters
Expand Down Expand Up @@ -152,6 +164,9 @@ $billable->newSubscription('main', 'monthly')->trialDays(10)->withCoupon('AMSTER
## Tinker
```php
<?
// Faker
$faker = Faker\Factory::create();
$faker->name
// Log as user id 1
auth()->loginUsingId(1)
```
Expand Down Expand Up @@ -201,3 +216,4 @@ try {
#### References
- [Laravel 6.x docs](https://laravel.com/api/6.x/index.html)
- [Source](https://quickadminpanel.com/blog/list-of-21-artisan-make-commands-with-parameters/)
- [Laravel in Docker for api development](Laravel-api.md)

0 comments on commit 9689170

Please sign in to comment.