Skip to content

Instantly share code, notes, and snippets.

View kennyray's full-sized avatar

Kenny Ray kennyray

View GitHub Profile
@kennyray
kennyray / Laravel Eloquent only()
Last active October 12, 2018 20:44
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')
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;
}
<?php
interface RemoteControl
{
public function powerOn() : void;
}
class Television
{
public function setPower(bool $state) : void
<?php
abstract class LifeForm
{
protected $firstName;
protected $middleName;
protected $lastName;
public function __construct(string $firstName, string $lastName= "", string $middleName = "")
{