Skip to content

Instantly share code, notes, and snippets.

Avatar

Kenny Ray kennyray

View GitHub Profile
View remotes.php
<?php
interface RemoteControl
{
public function powerOn() : void;
}
class Television
{
public function setPower(bool $state) : void
View classes.php
<?php
abstract class LifeForm
{
protected $firstName;
protected $middleName;
protected $lastName;
public function __construct(string $firstName, string $lastName= "", string $middleName = "")
{
View gist:b35f4c6640be9539c5d16581de7714e0
class CountdownTimer {
constructor(minutesLabel = null, secondsLabel = null) {
this.minutesLabel = minutesLabel;
this.secondsLabel = secondsLabel;
this.totalSeconds = (this.minutesLabel.textContent / 60) + this.secondsLabel.textContent;
this.timer = null;
}
@kennyray
kennyray / Laravel Eloquent only()
Last active Oct 12, 2018
Laravel Eloquent only()
View Laravel Eloquent only()
$fullModel = Model::find(1) // Get model with id 1
$idArray = $fullModel->only('id') // array containing id
// this does not work. You'll get back an empty collection
// It is trying to pull the id column off the collection object,
// not the models it contains
$models = Model::all()
$ids = $models->only('id')