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
Assume we have a following situation: | |
- We have a task that has associated checklists (one or many). | |
- Every checklist has associated items (again, one or many). | |
In Laravel 4, we can use Eager Loading to fetch all associated data. | |
Let's take a look. | |
First, we have have a TaskChecklistItem model as following: |
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
Sometimes we need to extend out model, with more than data that is fetched from database, for example. | |
But on the other hand, we don't want to do that manually, and we want our framework to do that instead of us. | |
Here's an example, how to do that using Laravel 4. | |
Assume we have model Task, that has some fillable columns. Beside those, predefined columns, we want to attach additional data, let's say, parent task (and all its data). | |
First, we will define relationship between 'task' and 'task parent'. It is one-to-many relationship. We'll do it based on column named 'parent_id'. | |
public function parentTask(){ |
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
TIP 1: Exception when performing many requests | |
----------------------------------------------------------------------------------------------- | |
If you have more than one $this->call() or $this->client->request(), inside one test method, | |
you may experience problems like: | |
{"error":{"type":"ErrorException","message":"Undefined variable: header","file":"/*,"line":1}} | |
or | |
Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException | |
You can solve this problem, if you do $this->client->restart(), before every next request that you're making. |
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 AngularJS, you have several ways to display/hide some HTML block. | |
I'll mention most common one, and point out main differencies between them. | |
1. ng-hide/ng-show: By using these two directives, you can hide or show html block, by simple passing expression. Example: | |
<div ng-hide='checked' > Hide me, if checked is true </div> | |
2. another way of doing same thing, is to use ng-class. You can conditionally apply some class to HTML block, and by doing that, hide or show it. | |
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 case you want to do authentication and redirection, depending on whether user is logged in or not, | |
you can do it by listening $routeChangeStart event. | |
This way, you don't need to use additional plugins, | |
or to add 'resolve' parameters to your routes (which can be difficult to maintain). | |
In following example, if non-logged user tries to reach authenticated route, user will be redirected to login page. | |
If logged user tries to reach login/register page, user will be redirected to home page. | |
$rootScope.$on('$routeChangeStart', function(event, next, current){ | |
if(AuthFactory.isAuthenticated()){ |
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
Angular expressions are crucial while developing Angular application. | |
Sometimes, while working with them, you may see double curlies | |
which are actually displayed on page, while it is loading. | |
Common scenario are titles, headings and different flash messages, | |
which contain Angular expressions, but which are not always rendered 'on time'. | |
e.g. | |
<h1> Welcome back, {{user.name}} </h1> | |
There are several ways to prevent user from seeing those: |
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
# Zwivel Ad Platform | |
## Requirements | |
- PHP >= 5.5.9 | |
- check your php version with **php -v** from command line | |
- PHP Extensions | |
- OpenSSL PHP Extension | |
- Mbstring PHP Extension | |
- Tokenizer PHP Extension |
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
APP_ENV=stage | |
APP_DEBUG=true | |
APP_KEY=TuOO60ykdxiBM7E8TTOa1cTxpihHqxvs | |
DB_HOST=localhost | |
DB_DATABASE=stage_zwivel_advertising | |
DB_USERNAME=root | |
DB_PASSWORD=root | |
CACHE_DRIVER=file |
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
'use strict'; | |
_app | |
.provider("$exceptionHandler", { | |
$get: function( ErrorLogService ) { | |
return( ErrorLogService ); | |
} | |
} | |
) | |
.factory('ErrorLogService', function($log, $window, stacktraceService, routes) { |
OlderNewer