Skip to content

Commit

Permalink
change function name in Link class
Browse files Browse the repository at this point in the history
  • Loading branch information
RezaAb committed Jun 2, 2019
1 parent f8aaa78 commit 0e09489
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/models/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,31 @@ class Link extends Model {
protected $table = 'links';

static $cache = [];
public static function allCached($forceRefresh = false)
public static function getAllLinks($forceRefresh = false) // allCached(
{
if (!isset(self::$cache['all']) || $forceRefresh) {
self::$cache['all'] = Link::all();
}
return self::$cache['all'];
}
public static function returnUrls($forceRefresh = false) {
public static function getUrls($forceRefresh = false) // returnUrls(
{
if (!isset(self::$cache['all_urls']) || $forceRefresh) {
$configs = Link::allCached($forceRefresh);
self::$cache['all_urls'] = $configs->pluck('url')->toArray();
}
return self::$cache['all_urls'];
}
public static function getMainUrls($forceRefresh = false){
public static function getMainUrls($forceRefresh = false)
{
if (!isset(self::$cache['main_urls']) || $forceRefresh) {
$configs = Link::where('main', '=', true)->get(['url']);
self::$cache['main_urls'] = $configs->pluck('url')->toArray();
}
return self::$cache['main_urls'];
}
public function getAndSave($url, $label, $visibility){
public function addNewLink($url, $label, $visibility) // getAndSave(
{
$this->url = $url;
$this->display = $label;
$this->show_menu = $visibility;
Expand Down

0 comments on commit 0e09489

Please sign in to comment.