Skip to content

Instantly share code, notes, and snippets.

@doulmi
doulmi / download
Last active November 30, 2017 15:44
Laravel download formated json file
$aides = Aide::all();
File::put('aides/aides.json', $aides->toJson(JSON_PRETTY_PRINT));
return response()->download('aides/aides.json', 'aides.json');
@doulmi
doulmi / Laraval way to read lines from a file
Last active November 30, 2017 15:44
Laraval way to read lines from a file
/**
* Read lines from the file, auto detecting line endings.
*
* @param string $filePath
*
* @return array
*/
protected function readLinesFromFile($filePath)
{
// Read file into an array of lines with auto-detected line endings
@doulmi
doulmi / default.conf
Created March 24, 2018 15:40
NGiNX Configuration for Vue-Router in HTML5 Mode
server {
listen 80 default_server;
listen [::]:80 default_server;
root /your/root/path;
index index.html;
server_name you.server.com;
<?php
namespace Tests\Feature;
use App\Models\CartItem;
use App\Models\Sku;
use App\Models\Spu;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
use App\Models\User;
<?php
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Tymon\JWTAuth\Facades\JWTAuth;
use ReflectionClass;
abstract class TestCase extends BaseTestCase
{