Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):
class Shop extends Eloquent {}
Using custom table name
protected $table = 'my_shops';
#!/bin/bash | |
[ -d hongbao ] && rm -rf hongbao | |
mkdir hongbao | |
cd hongbao | |
git init | |
git config user.name "duwan" | |
git config user.email "[email protected]" |
javascript | |
ES6ValidationInspection | |
JSAccessibilityCheckInspection | |
JSBitwiseOperatorUsageInspection | |
JSCheckFunctionSignaturesInspection | |
JSClosureCompilerSyntaxInspection | |
JSCommentMatchesSignatureInspection | |
JSComparisonWithNaNInspection | |
JSConsecutiveCommasInArrayLiteralInspection |
<?php | |
use Rhumsaa\Uuid\Uuid; | |
class UUIDModel extends Eloquent { | |
public $incrementing = false; | |
protected $softDelete = true; | |
public function __construct(array $attributes = array()) { |
#!/bin/bash | |
while read album | |
do | |
echo -e "Will download album $album" | |
google picasa get "$album" . | |
pushd "$album" | |
echo -e "Start to upload $album to Flickr" | |
find -type f|sort|xargs -I{} flickr_upload {} | |
popd |
# Install a Webserver | |
apt-get -y install apache2 | |
# Target docroot to /home/satis/web/ | |
# Install PHP5 CLI and needed programs. | |
apt-get -y install php5-cli php5-curl php5-json git wget | |
# Add a specifix user for our task | |
adduser satis |
<?php | |
class Iso7064mod112 { | |
public $code; | |
public function encode($code) { | |
$this->code = $code; | |
$c = $this->computeCheck($this->code); | |
if ($c == 10) { |
<?php | |
class BaseModel extends Eloquent { | |
public static function shouldReceive() | |
{ | |
$repo = get_called_class() . 'RepositoryInterface'; | |
$mock = Mockery::mock($repo); | |
App::instance($repo, $mock); |
Let's say you have an iOS project, and you want to use some external library, like AFNetworking. How do you integrate it?
Add the project to your repo:
git submodule add [email protected]:AFNetworking/AFNetworking.git Vendor/AFNetworking
or something to that effect.
<?php | |
require 'vendor/autoload.php'; | |
$resolver = new Illuminate\Database\ConnectionResolver; | |
$resolver->setDefaultConnection('default'); | |
$factory = new Illuminate\Database\Connectors\ConnectionFactory; | |
$connection = $factory->make(array( | |
'host' => 'localhost', | |
'database' => 'database', |