Skip to content

Instantly share code, notes, and snippets.

View helpers.php
<?php
function faker($property = null)
{
$faker = Faker\Factory::create();
if ($property) {
return $faker->{$property};
}
View BaseRepository.php
<?php
namespace App\Shop\Base;
use App\Shop\Base\Interfaces\BaseRepositoryInterface;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Pagination\LengthAwarePaginator;
/**
@simonhamp
simonhamp / RemoteArtisan.php
Last active Feb 10, 2021
RemoteArtisan: A way to call another Laravel/Lumen application's artisan command from the context of the current application.
View RemoteArtisan.php
<?php
namespace App;
use Dotenv\Dotenv;
use Illuminate\Support\Str;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
class RemoteArtisan
@deividaspetraitis
deividaspetraitis / lumen-filesystem.md
Created Oct 19, 2017
Lumen flysystem ( filesystem ) integration
View lumen-filesystem.md

Lumen flysystem integration

By default lumen doesn't support laravel file system. In order to integrate to lumen we need follow these instructions:

  1. composer require league/flysystem
  2. Copy filesystems config file from Laravel ( https://github.com/laravel/laravel/blob/master/config/filesystems.php ) to your local Lumen installation document_root/config
  3. Bind filesystem to IoC for example in document_root/bootstrap/app.php by adding this code lines:

`` $app->singleton('filesystem', function ($app) {

@viralsolani
viralsolani / phpunit.xml
Created May 9, 2017
phpunit.xml Laravel 5.4 with sqlite memory database
View phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="bootstrap/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
@RamonGilabert
RamonGilabert / bluetooth.sh
Last active Mar 6, 2021
Bluetoothctl automation
View bluetooth.sh
#!/usr/bin/expect -f
set prompt "#"
set address [lindex $argv 0]
spawn sudo bluetoothctl -a
expect -re $prompt
send "remove $address\r"
sleep 1
expect -re $prompt