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
<?php | |
use Illuminate\Database\Seeder; | |
use Illuminate\Database\Eloquent\Model; | |
use App\User; | |
class DatabaseSeeder extends Seeder { | |
/** | |
* Run the database seeds. |
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
<?php | |
function to_ascii($str, $removeUnsupported = true) | |
{ | |
foreach (ascii_chars() as $key => $value) { | |
$str = str_replace($value, $key, $str); | |
} | |
if ($removeUnsupported) { | |
$str = preg_replace('/[^\x20-\x7E]/u', '', $str); |
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
# ---------------------------------------------------------------------- | |
# /PUBLIC folder .htaccess | |
# ---------------------------------------------------------------------- | |
# This .htaccess file is recommended | |
# to be placed at root/public folder | |
# of your Laravel powered application | |
# ---------------------------------------------------------------------- | |
# This file works with Laravel 3 and 4 | |
# ---------------------------------------------------------------------- | |
# Turning on the rewrite engine is necessary for the following rules and |
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
<?php | |
/* | |
* Resolver using Guzzle | |
*/ | |
if (!function_exists('resolve_http_redirection')) { | |
/** | |
* @param string $url | |
* @param int $limit | |
* @return mixed |
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
<?php | |
namespace App; | |
use Illuminate\Database\Eloquent\Model; | |
class Post extends Model | |
{ | |
/** | |
* Array of relationships to load. |
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
<?php | |
/** | |
* Turns associative arrays into multipart [['name' => 'key[0][deep]', 'contents' => 'value']] | |
*/ | |
function array_multipart(array $data = []) | |
{ | |
$dots = array_dot($data); | |
$multipart = []; |
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
<?php | |
Response::macro('streamed', function($type, $size, $name, $callback) { | |
$start = 0; | |
$length = $size; | |
$status = 200; | |
$headers = [ | |
'Content-Type' => $type, | |
'Content-Length' => $size, |
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
# ... | |
services: | |
# ... | |
service-name: | |
# ... | |
command: > | |
bash -c " | |
php artisan cache:clear && | |
php artisan config:clear && |
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
#!/bin/bash | |
echo 'Some Text' | ssh user@remotehost -T "cat > /remotefile.txt" | |
# The -T disables pseudo-terminal allocation and stops you from getting the message, | |
# Pseudo-terminal will not be allocated because stdin is not a terminal. | |
# @see https://superuser.com/a/400720/341320 |