| 1 | <?php |
||
| 6 | class Link extends Model { |
||
| 7 | |||
| 8 | protected $table = 'links'; |
||
| 9 | |||
| 10 | static $cache = []; |
||
| 11 | |||
| 12 | public static function allCached($forceRefresh = false) |
||
| 20 | |||
| 21 | public static function returnUrls($forceRefresh = false) { |
||
| 30 | |||
| 31 | public static function getMainUrls($forceRefresh = false){ |
||
| 40 | |||
| 41 | |||
| 42 | public function getAndSave($url, $display){ |
||
| 47 | |||
| 48 | |||
| 49 | protected $fillable = array('url', 'display'); |
||
| 50 | |||
| 51 | } |
||
| 52 |
Let’s assume you have a class which uses late-static binding:
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClassto useselfinstead: