Your IP : 216.73.216.79


Current Path : /var/www/html/dynaweb-starter/plugin/dynaweb-site/src/Repositories/
Upload File :
Current File : /var/www/html/dynaweb-starter/plugin/dynaweb-site/src/Repositories/FrontendComponentRepository.php

<?php

namespace Dynaweb\DynawebSite\Repositories;

class FrontendComponentRepository extends BaseRepository
{
    /***
    * Populate Dropdown
    */
    public function populate()
    {
        return $this->model::query()
        ->pluck('code', 'id')
        ->map(fn (string $category) => __($category))
        ->all();
    }

    /***
     * Get Data By code
     */
    public function getByCode($code)
    {
        return $this->model::query()
        ->where('code', $code)
        ->first();
    }

    /***
     * Get Data By code
     */
    public function setContentByCode($code, $content)
    {
        $model = $this->getByCode($code);
        $model->content = $content;
        $model->save();
    }

}