- https://speakerdeck.com/willroth/50-laravel-tricks-in-50-minutes
- https://www.reddit.com/r/laravel/comments/3to60i/50_laravel_tricks/
- 1. Automatic Model Validation
| <?php | |
| /* | |
| Find html2element in | |
| Version < 4.8: /wp-content/plugins/js_composer/assets/js/backend/composer-view.js | |
| Version > 4.9: wp-content/plugins/js_composer/assets/js/dist/backend-actions.min.js | |
| */ | |
| html2element: function(html) { | |
| var attributes = {}, | |
| $template; | |
| if (_.isString(html)) { |
| # Set composer folder for this command and update | |
| commands: | |
| 01updateComposer: | |
| command: export COMPOSER_HOME=/root && /usr/bin/composer.phar self-update | |
| option_settings: | |
| # Add environment variable to set composer home folder | |
| - namespace: aws:elasticbeanstalk:application:environment | |
| option_name: COMPOSER_HOME | |
| value: /root |
| <?php | |
| /////////////////////////////////////////////////// | |
| // STEP 1 - CREATE CLASS THAT WILL BE USED GLOBALY | |
| /////////////////////////////////////////////////// | |
| namespace App\MyApp; | |
| class MyApp { | |
| public function sayHello($data = []) | |
| { | |
| echo "Hello World from Facade!"; | |
| } |
| #!/usr/bin/env swift | |
| // | |
| // PrintBootCampESDInfo.swift | |
| // | |
| // Created by nuomi1 on 8/5/18. | |
| // Copyright © 2018年 nuomi1. All rights reserved. | |
| // | |
| import Foundation |
| #!/bin/bash | |
| adb=your/android/sdk/path/platform-tools/adb | |
| folder=. | |
| $adb shell am broadcast -a com.android.systemui.demo --es command enter | |
| $adb shell am broadcast -a com.android.systemui.demo --es command clock --es hhmm 0520 | |
| $adb shell am broadcast -a com.android.systemui.demo --es command battery --es level 100 --es plugged false | |
| $adb shell am broadcast -a com.android.systemui.demo --es command network \ | |
| --es mobile show \ | |
| --es fully true \ |
| Redis::connection()->del('queues:myqueue'); |
| /** | |
| * A function to reorder the default display of fields on the WooCommerce Bookings form | |
| * Put this function in your theme's functions.php file | |
| */ | |
| function custom_order_booking_fields ( $fields ) { | |
| $reorder = array(); | |
| $reorder[] = $fields['wc_bookings_field_duration']; // Duration | |
| $reorder[] = $fields['wc_bookings_field_resource']; // Resource | |
| $reorder[] = $fields['wc_bookings_field_persons']; // Persons |