- Install Geocoder Laravel: https://geocoder-php.org/docs/
- Publish config
php artisan vendor:publish
(Look for Geocoder) - Setup your Google Geocoding API-Key in
config/geocoder.php
This file contains 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 | |
Builder::macro('deferredPaginate', function ($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) { | |
$model = $this->newModelInstance(); | |
$key = $model->getKeyName(); | |
$table = $model->getTable(); | |
$paginator = $this->clone() | |
// We don't need them for this query, they'll remain | |
// on the query that actually gets the records. |
This file contains 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
/** | |
* Bootstrap any application services. | |
* | |
* @return void | |
*/ | |
public function boot() | |
{ | |
Component::macro('notify', function ($message, $title = '', $type = 'success') { | |
$this->dispatchBrowserEvent('notify', ['message' => $message, 'title' => $title, 'type' => $type]); | |
}); |
This file contains 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
window.findHighestZ = () => [...document.querySelectorAll('body *')] | |
.map(elt => parseFloat(getComputedStyle(elt).zIndex)) | |
.reduce((z, highest=Number.MIN_SAFE_INTEGER) => | |
isNaN(z) || z < highest ? (isNaN(highest) ? 1 : highest) : z | |
) | |
//vanilla | |
document.getElementById("foo").style.zIndex = window.findHighestZ() |
This file contains 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
public function showToasters(){ | |
// default info toaster with timeout | |
$this->toaster('your message'); | |
// makes it persistent | |
$this->toaster('your message')->persistent(); | |
// warning toaster with timeout | |
$this->toaster('your message')->warning(); |
This file contains 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 Auctane\Api\Controller\Auctane; | |
use Exception; | |
use Magento\Framework\App\CsrfAwareActionInterface; | |
use Magento\Framework\App\Request\InvalidRequestException; | |
use Magento\Framework\App\RequestInterface; | |
class Index extends \Magento\Framework\App\Action\Action implements CsrfAwareActionInterface | |
{ |
#Steps to install latest Laravel, LEMP on AWS Ubuntu 16.4 version. This tutorial is the improvised verision of this tutorial on Digitalocean based on my experience.
Run the following commands in sequence.
sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install zip unzip
This file contains 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 Jobs; | |
use Illuminate\Queue\InteractsWithQueue; | |
use Illuminate\Redis\Database as Redis; | |
class Foo extends Job | |
{ | |
use InteractsWithQueue; |
This file contains 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 | |
// Based on <https://github.com/mecha-cms/x.minify> | |
namespace x\minify\_ { // start namespace | |
$n = __NAMESPACE__; | |
\define($n . "\\token_boolean", '\b(?:true|false)\b'); | |
\define($n . "\\token_number", '-?(?:(?:\d+)?\.)?\d+'); |
NewerOlder