Last active
September 4, 2017 19:31
-
-
Save technoknol/cd26093c84200fd48cddff512073cffa to your computer and use it in GitHub Desktop.
Helper in Laravel
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
"autoload": { | |
"classmap": [ | |
"database" | |
], | |
"psr-4": { | |
"App\\": "app/" | |
}, | |
"files":[ | |
"app/helpers.php" /* This line was added to load helper file. Then fire 'composer dump-autoload' command in terminal */ | |
] | |
}, |
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 | |
// FILE:: put this file here | |
// app/helpers.php | |
/* | |
* Custom helpers functions for project by | |
* Shyam Makwana | |
* | |
* Added By: Shyam Makwana | |
* Date: 03rd May 2017 | |
* | |
*/ | |
use Illuminate\Support\Facades\Log; | |
/* | |
* Check if string given is valid json or not | |
* | |
* @developer Shyam Makwana | |
* @param $str String given to check for valid json | |
* @return bool Returns true if json is valid or false | |
*/ | |
function isJson($str) { | |
$json = json_decode($str); | |
return $json && $str != $json; | |
} | |
/* | |
* Logs arguments in log file. | |
* | |
* @developer Shyam Makwana | |
* @return void | |
*/ | |
function logInfo() { | |
Log::info(func_get_args()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment