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 |
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 = "") | |
{ |
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; | |
} | |
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') |