Skip to content

Instantly share code, notes, and snippets.

View anthonybudd's full-sized avatar

Anthony C. Budd anthonybudd

View GitHub Profile
<?php
Class Event extends WP_Model{
public $postType = 'event';
public $attributes = [
'start_date',
];
public function _finderArchive($args){
<?php
$products = Product::finder('archive', [
'page' => 1,
]);
dd($products);
<?php
$products = Product::all();
dd($products);
<?php
Product::insert([
'color' => 'blue',
'weight' => '100'
]);
Product::insert([
'color' => 'red',
'weight' => '100'
<?php
$product = Product::insert([
'weight' => '100'
]);
dd($product->weightInKGs);
<?php
$product = new Product;
dump($product->new);
$product = Product::find(3);
dump($product->new);
$product->color = 'red';
dump($product->dirty);
<?php
$product = Product::find(3);
$product->delete();
<?php
$product = Product::find(1);
dd($product);
<?php
$product = new Product();
$product->color = 'white';
$product->weight = 300;
$product->title = 'the post title';
$product->content = 'the post content';
$product->save();
dump($product);
<?php
$products = Product::in([3, 5, 7]);
dd($products);