View eloquent_dym_modules.php
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 | |
$model_confg = array( | |
"Models" => | |
array(array('className'=> "Books", 'classTable'=>'books', "fillable" => "book_name"), array('className'=> "Authors", 'classTable'=>'authors', "fillable" => "")), | |
"Relations" => | |
array("Authors" => | |
array("books" => | |
array("function" => function( $self ) { | |
return $self->belongsToMany('Books'); |
View mongodb_realtionship_testing.php
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 | |
$connection = new MongoClient( "mongodb://" ); | |
$db = $connection->parseforce; | |
function one_to_one_select($flow = array(), $collection) { | |
//if(MongoId::isValid($value)) { | |
$data = array(); | |
if($flow['where']['pointer'] == "_id") { |
View many_to_many_flow.php
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 | |
$flow = array( | |
"api_endpoint" => $this->get('from'), | |
"index" => $this->get("index"), // leave blank for an all query | |
"where" => array("pointer" => "id", | |
"table" => "events", | |
"type" => "MANY_TO_ONE") | |
); | |
if($flow['where']['type'] == "MANY_TO_ONE") { |
View orders_db_migrate_mock.rb
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
create_table :orders do |t| | |
t.string 'name' | |
end | |
add_index :orders, :tags, using: 'gin' | |
add_index :orders, :ratings, using: 'gin' | |
# app/models/order.rb | |
class Order < ApplicationRecord | |
end | |
View grape-api-mock.rb
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
module Orders | |
class API < Grape::API | |
version 'v1', using: :header, vendor: 'invoate' | |
format :json | |
prefix :api | |
helpers do | |
def current_user | |
@current_user ||= User.authorize!(env) | |
end |
View requests-vs-curl.php
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 | |
// Requests for PHP Code | |
$endpoint = "https://{$data['account']}.harvestapp.com/invoices"; | |
$hashAuth = base64_encode($data['username'].":".$data['password']); | |
$response = Requests::get($endpoint, array('Content-Type' => 'application/json', | |
'accept' => 'application/json', | |
'authorization' => "Basic ". $hashAuth)); |