14
Mar
2017

Vue.js

14 Mar 2017

Example 1

”`html

        <li class="dropdown">

            <a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="true">
                <i class="icon-bell2"></i>
                <span class="visible-xs-inline-block position-right">Activity</span>
                <span v-if="notifications.length > 0" class="status-mark border-pink-300"></span>
            </a>
13
Mar
2017

Git snippets

13 Mar 2017
    git config receive.denycurrentbranch ignore
    vi .git/hooks/post-receive

    #!/bin/bash
    cd ../
    env -i git reset --hard


    chmod +x .git/hooks/post-receive


    git diff --name-status SHA1 SHA2 | cut -f2
7
Mar
2017

Eloquent

07 Mar 2017

”`php

    $this->products()
        ->select('category_id',
            DB::raw('count(*) as total'))
        ->groupBy('category_id')
        ->get();


    Task::first();
    Task::all();
    Task::get();
7
Mar
2017

Code snippets

07 Mar 2017

Folders should be normal “755” and files, “644”

sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache

Snippets

”`php // dates Carbon::parse($createdAt)->addSeconds($this->expires)->isPast(); // check if expired

// token
7
Mar
2017

Console Laravel

07 Mar 2017

”`bash

// Phpunit

 ./vendor/bin/phpunit

php artisan make:test CategoryTest --unit

// Scaffolding

php artisan make:model Post -m
php artisan make:seed PostTableSeed
17
Feb
2017

Laravel PhpStorm

17 Feb 2017
    composer require barryvdh/laravel-ide-helper

Add to file app/config/app.php in Application Service Providers section

     Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,

Enable in (config/ide-helper.php)

'include_fluent' => true,
'include_helpers' => true,

Then

9
Jun
2015

apidoc

09 Jun 2015

Useful tool apidoc. Setup:

apt update
apt nodejs
apt install nodejs-legacy
apt install npm
npm install apidoc -g

Now check with command apidoc -h.

If everything is alright:

16
Apr
2015

Yii 2 snippets

16 Apr 2015
php yii migrate/create create_user_table
php yii migrate/up
Yii::$app->request->baseUrl
Url::toRoute

$query->from('given t')
    ->leftJoin('given_product as rp','t.id = rp.issuance_id')
    ->leftJoin('product as p','p.id = rp.product_id')
    ->where(['p.status'=>Product::STATUS_GIVEN]);


SET FOREIGN_KEY_CHECKS = 0;