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
<atn-countup data-start-time="1"></atn-countup> | |
myApp.directive('atnCountup', [ | |
'$interval', | |
function ( $interval ) { | |
return { | |
restrict: 'E', | |
template: | |
'<div id="atn-time-diff">'+ | |
'<span id="atn-time-diff-hour">{{ hour }}:</span>'+ | |
'<span id="atn-time-diff-minute">{{ minute }}:</span>'+ |
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 | |
Paginator::currentPageResolver(function() use ($paged){ | |
return $paged; | |
}); | |
//change page url | |
$data['punchInformation'] = InOut::paginate(5); | |
$data['punchInformation']->setPath('admin.php?page=attendance-management-system'); | |
//set query srting | |
$data['punchInformation']->appends(array( | |
'pagefdsa' => 'attendance-management-system', |
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 IOC | |
{ | |
protected static $resolvers = []; | |
public static function register($name, $resolver) | |
{ | |
static::$resolvers[$name] = $resolver; | |
} |
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
//In the Observer pattern a subject object will notify an observer object if the subject's state changes. | |
//https://sourcemaking.com/design_patterns/observer/php | |
//If a subject is changed it will notify in observer objects that there is some change in observer | |
//In laravel observer works when we used created,updated,deleted method.It's mean when a model is created a specific command will execute | |
<?php | |
interface Observer{ | |
public function add(Company $company); | |
public function notify($price); | |
} |
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
$lat = '23.833874'; | |
$lng = '90.425119'; | |
$distance = 20; | |
$tableName = 'map'; | |
//query to find nearest place | |
SELECT *, ( 6371 * acos ( cos ( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng )) + sin ( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distances FROM $tableName HAVING distances < $distance ORDER BY distances |
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
HHVM is hip hop virtual machine | |
Eloquent group by and order by | |
Repository design pattern | |
It's like as we use eloquent in laravel with is the wrapper of orm.When we inheit a class Model form every model when we created and that time if we call an method of that model like "create()" that is stored in Model extended class.That's the repository model,it works like as a extra layer between application and database layer.For more explanation go here http://code.tutsplus.com/tutorials/the-repository-pattern-in-laravel-5--cms-25464 | |
AngularJs pagination | |
Easy http://plnkr.co/edit/81fPZxpnOQnIHQgp957q?p=preview | |
Intermidiate http://plnkr.co/edit/Wtkv71LIqUR4OhzhgpqL?p=preview |
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 | |
/** | |
* Created by PhpStorm. | |
* User: kingpabel | |
* Date: 3/23/16 | |
* Time: 4:40 PM | |
*/ | |
namespace app\Http\Middleware; |
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 | |
Route::post(‘oauth/access_token’, function() { | |
return Response::json(Authorizer::issueAccessToken()); | |
}); | |
Route::group(['middleware' => ['oauth']], function () { | |
Route::get('api', function () { | |
$user_id = Authorizer::getResourceOwnerId(); // the token user_id | |
$user = \App\User::find($user_id);// get the user data from database |
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 | |
/** | |
* Created by Kingpabel. | |
* User: kingpabel | |
* Date: 3/13/16 | |
* Time: 3:02 AM | |
*/ | |
namespace app; |
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 | |
'grant_types' => [ | |
"password" => [ | |
"class" => "\League\OAuth2\Server\Grant\PasswordGrant", | |
"access_token_ttl" => 604800, | |
"callback" => '\App\PasswordGrantVerifier@verify' | |
] | |
], |