- Extend the
Illuminate\Routing\Routerto the (for example)App\Illuminate\Routing\Router. - Add method
setMiddlewareandsetMiddlewareGroupsto yourApp\Illuminate\Routing\Router
<?php
namespace App\Illuminate\Routing;
use Illuminate\Routing\Router as BaseRouter;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App\Console\Commands; | |
| use Dotenv\Dotenv; | |
| use Exception; | |
| use Illuminate\Console\Command; | |
| use Illuminate\Support\Arr; | |
| use RuntimeException; | |
| use Symfony\Component\Process\Exception\ProcessSignaledException; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| public function getWeeks(int $month, int $year = null): array { | |
| $year = is_null($year) ? Carbon::now()->year : $year; | |
| $date = Carbon::createFromFormat('Y-m', $year . '-' . $month) | |
| ->firstOfMonth(); | |
| $oDate = $date->copy(); | |
| $data = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0"?> | |
| <ruleset name="Laravel Code Standard" namespace="Laravel\CS\Standard"> | |
| <description>Code Standard used for Laravel App</description> | |
| <file>./app</file> | |
| <file>./routes</file> | |
| <exclude-pattern>./bootstrap/*</exclude-pattern> | |
| <exclude-pattern>./config/*</exclude-pattern> | |
| <exclude-pattern>./database/*</exclude-pattern> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ########## DO NOT INCLUDE THIS ########## | |
| # File Location: /etc/supervisor/conf.d/celery-beat-appcom.conf | |
| ######################################### | |
| [program:celery_beat_appcom] | |
| process_name=%(program_name)s | |
| command=/home/johndoe/django-app/celery-beat/run-appcom-celery-beat.sh | |
| startsecs=10 | |
| autostart=true | |
| autorestart=true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| location ^~ /.well-known/acme-challenge/ { | |
| default_type "text/plain"; | |
| root /var/www/letsencrypt; # make sure you create this directory | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.core.management import call_command | |
| from django.core.management.base import BaseCommand | |
| from django.db import connection | |
| class Command(BaseCommand): | |
| help = 'Delete all tables and run all migrations' | |
| def add_arguments(self, parser): | |
| parser.add_argument('--seed', nargs='*', help='Run the DB seeders.') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def override_method(cls, after=True): | |
| def decorator(func): | |
| new_parent_method_name = '_' + func.__name__ + '_parent' | |
| setattr(cls, new_parent_method_name, getattr(cls, func.__name__)) | |
| @wraps(func) | |
| def wrapper(self, *args, **kwargs): | |
| if after: | |
| parent_result = getattr(self, new_parent_method_name)(*args, **kwargs) | |
| return func(self, parent_result, *args, **kwargs) |
NewerOlder