View remotes.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 | |
interface RemoteControl | |
{ | |
public function powerOn() : void; | |
} | |
class Television | |
{ | |
public function setPower(bool $state) : void |
View classes.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 | |
abstract class LifeForm | |
{ | |
protected $firstName; | |
protected $middleName; | |
protected $lastName; | |
public function __construct(string $firstName, string $lastName= "", string $middleName = "") | |
{ |
View gist:b35f4c6640be9539c5d16581de7714e0
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
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; | |
} | |
View Laravel Eloquent only()
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
$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') |