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 | |
function utf8_converter($array) { | |
array_walk_recursive($array, function(&$item, $key){ | |
if(!mb_detect_encoding($item, 'utf-8', true)){ | |
$item = utf8_encode($item); | |
} | |
}); | |
return $array; | |
} |
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
This is question is old but I found you can do this based on information from a tutorial by Tejas Jasani: http://www.theappguruz.com/blog/upgrading-from-laravel-4-2-to-5-in-web | |
Here are the key steps: | |
1 - Add the app/Http/Controllers directory to the "autoload" classmap directive of your composer.json file. | |
"autoload": { | |
"classmap": [ | |
"database", | |
"app/Http/Controllers" | |
], | |
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 | |
// Recursively walks a Collection or Array that contains children of the same kind and flatten into an single dimesion Collection or Array. | |
// Example: | |
// We have: | |
// A | |
// |_B | |
// |_C | |
// |_D | |
// We want: |
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 | |
class helpers { | |
public function uniqueCode($length = 10) { | |
$characters = '0123456789'; | |
$charactersLength = strlen($characters); | |
while (true) { | |
// uniqid gives 13 chars, but you could adjust it to your needs. | |
if (function_exists("random_bytes")) { | |
$bytes = random_bytes($length); | |
} elseif (function_exists("openssl_random_pseudo_bytes")) { |
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
// On PhpStorm, when ussing with laravel mix, for Alias path resolving in components you have to: | |
// - create a webpack.config.js file separately like: | |
const path = require('path') | |
const webpack = require('webpack') | |
module.exports = { | |
... | |
resolve: { | |
extensions: ['.js', '.json', '.vue'], |
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
const averange = (input) => { | |
const {sum, count} = sumAndCount(input) | |
return sum/count | |
} | |
const sumAndCount = (arr) => { | |
let count = 0 | |
const sum = arr.reduce((acc, element) => { |
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
{"lastUpload":"2019-10-25T14:45:28.109Z","extensionVersion":"v3.4.3"} |
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
import axios from "axios" | |
export function getSellers() { | |
return axios({ | |
url: "v1/sellers/", | |
method: "get", | |
}) | |
} | |
export function createInvoice(data) { |
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
// 'request' it's an axios instance, that it has a request interceptor setted on it (to add an auth header) | |
// This is all done in utils/request.js. So that all api calls made with 'request' had auth header setted on it | |
import request from "utils/request" | |
export function getResponsabilities(userId) { | |
return new Promise(async (resolve, reject) => { | |
try { | |
const res = await request({ | |
url: `v1/f12/${userId}/responsabilities`, | |
method: "get", |
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
/* eslint-disable no-unreachable */ | |
/* eslint-disable require-atomic-updates */ | |
// import _ from "lodash"; // LODASH is imported and used globally, configured in webpack | |
import axios from "axios" | |
import store from "store" // store is the Vuex store instance | |
import router from "router" // router is the Vue Router instance | |
import { warn, warnDialogParse } from "utils/alerts" // helpers to show alerts and error messages | |
// create an axios instance |