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