oc-social-plugin/models/Setting.php

34 lines
825 B
PHP
Raw Normal View History

2021-10-28 22:35:15 +02:00
<?php namespace Zoomyboy\Social\Models;
use Model;
2021-10-30 12:16:27 +02:00
use Zoomyboy\Social\Classes\FacebookService;
use Zoomyboy\Social\Classes\InstagramService;
2021-10-28 22:35:15 +02:00
/**
* Setting Model
*/
class Setting extends Model
{
public $implement = ['System.Behaviors.SettingsModel'];
public $settingsCode = 'zoomyboy_social';
public $settingsFields = 'fields.yaml';
2021-10-30 12:16:27 +02:00
public function getFacebookPagesOptions(): array
2021-10-28 22:35:15 +02:00
{
2021-10-30 12:16:27 +02:00
return Page::where('type', app(FacebookService::class)->getType())->pluck('name', 'id')->toArray();
2021-10-28 22:35:15 +02:00
}
public static function synchedPages(): array
{
return (new static([]))->getSynchedPagesOptions();
}
public function getInstagramUsersOptions(): array
{
2021-10-30 12:16:27 +02:00
return Page::where('type', app(InstagramService::class)->getType())->pluck('name', 'id')->toArray();
2021-10-28 22:35:15 +02:00
}
}