Getting started:
Related tutorials:
| <?php | |
| namespace Spark\Utility; | |
| use Closure; | |
| use Illuminate\Support\Str; | |
| use Symfony\Component\DomCrawler\Crawler; | |
| use Symfony\Component\HttpFoundation\File\File; | |
| class ImageExtractor |
| <?php | |
| namespace App\Providers; | |
| use Illuminate\Support\Arr; | |
| use Illuminate\Routing\Redirector; | |
| use Illuminate\Support\ServiceProvider; | |
| class AppServiceProvider extends ServiceProvider | |
| { |
| location ^~ /.well-known/acme-challenge/ { | |
| default_type "text/plain"; | |
| root /var/www/letsencrypt; | |
| } |
Getting started:
Related tutorials:
| class MyManagedResource extends ResourceController[String] { | |
| def index = Action(Ok("index")) | |
| def newScreen = Action(Ok("new")) | |
| def create = Action { | |
| Redirect(MyInjectableResource.reverseRoutes.index()) | |
| } | |
| def show(id: String) = Action(Ok("Show " + id)) |
| # Reference: https://www.exclamationlabs.com/blog/continuous-deployment-to-npm-using-gitlab-ci/ | |
| # GitLab uses docker in the background, so we need to specify the | |
| # image versions. This is useful because we're freely to use | |
| # multiple node versions to work with it. They come from the docker | |
| # repo. | |
| # Uses NodeJS V 9.4.0 | |
| image: node:9.4.0 | |
| # And to cache them as well. |
| # regex to split $uri to $fastcgi_script_name and $fastcgi_path | |
| fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
| # Check that the PHP script exists before passing it | |
| try_files $fastcgi_script_name =404; | |
| # Bypass the fact that try_files resets $fastcgi_path_info | |
| # see: http://trac.nginx.org/nginx/ticket/321 | |
| set $path_info $fastcgi_path_info; | |
| fastcgi_param PATH_INFO $path_info; |
| # Stop all containers | |
| docker stop `docker ps -qa` | |
| # Remove all containers | |
| docker rm `docker ps -qa` | |
| # Remove all images | |
| docker rmi -f `docker images -qa ` | |
| # Remove all volumes |
| <?php | |
| // Require Laravel Illuminate\Support packages. | |
| // | |
| // composer require illuminate/support | |
| // | |
| $attendancesByDate = $attendances->groupBy(function ($attendance) { | |
| return $attendance->time->toDateString(); | |
| }); |
Translations: Korean (by Yongwoo Lee)
Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.
I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).