Channel.php 659 Bytes
<?php
namespace App\Models\Legal;

use App\Helper\CacheKeyTools;
use App\Models\BaseModel;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Cache;

/**
 * Class Channel
 * @package App\Models
 */
class Channel extends BaseModel
{
    use SoftDeletes;

    const TIME = 86400;


    /**
     * @return mixed
     */
    public static function getChannelName()
    {
        if (!$res = Cache::get(CacheKeyTools::channelname())) {
            $res = Channel::query()->where(['pid'=>0])->pluck('name', 'id')->toArray();
            Cache::put(CacheKeyTools::channelname(), $res, self::TIME);
        }
        return $res;
    }



}