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\Traits; | |
use Illuminate\Database\Eloquent\Builder; | |
trait HasStatus | |
{ | |
public static function bootHasStatus() | |
{ | |
$status_column = (new static)->getStatusColumnName(); |
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
/** | |
* custom validation rule to be binded to non form elements fields | |
* @Author: nagy | |
*/ | |
angular.module('app').directive('validate', function ($parse){ | |
return { | |
require: 'ngModel', | |
link: function(scope, elem, attr, ngModel) { | |
scope.$watch(attr.ngModel, function(){ | |
var isValid = $parse(attr.validate)(scope); |
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
"use strict"; | |
/** | |
* @Author: nagy | |
*/ | |
angular.module('app').directive('typeahead', ['$rootScope', 'APP_CONFIG', '$http', function($rootScope, APP_CONFIG, $http) { | |
return { | |
restrict: 'EA', | |
scope: { | |
model : '=ngModel', | |
disabled: '=?ngDisabled', |
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
if(!function_exists('curl_request')){ | |
/** | |
* create a curl request | |
* @param stringx $url | |
* @param array $postData post data if you used the http post method | |
* @param array $headers | |
* @param string $method [description] | |
* @return mixed response from the curl request | |
*/ | |
function curl_request($url, $postData, $headers, $method="post"){ |
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
/** | |
* Modal based on angular-strap model | |
*/ | |
angular.module('app').factory('modalFactory', ['$modal', function($modal) { | |
var modal; | |
var modalFactory = {}; | |
var options = {}; | |
//show message |
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
/** | |
* manage alerts service based on angular-strap | |
*/ | |
angular.module('app').factory('alertFactory', ['$alert', function($alert) { | |
var options = { | |
title : 'Success', | |
content : 'Operation done succcessfully', | |
type: 'success', | |
placement: 'alert-top' |
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
// check/uncheck select box | |
angular.module('app').directive('triStateCheckbox', function() { | |
return { | |
replace: true, | |
restrict: 'E', | |
scope: { | |
checkboxes: '=' | |
}, | |
template: '<input type="checkbox" ng-model="master" ng-change="masterChange()">', | |
controller: function($scope, $element) { |
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
// get first matched object in array or collection by object property | |
angular.module('app').filter('getBy', function() { | |
return function(propertyName, propertyValue, collection) { | |
var i = 0, | |
len = collection.length; | |
for (; i < len; i++) { | |
if (collection[i][propertyName] == +propertyValue) { | |
return collection[i]; | |
} | |
} |