49 lines
1.4 KiB
PHP
49 lines
1.4 KiB
PHP
<?php namespace AhmadFatoni\ApiGenerator\Controllers\API;
|
|
|
|
use Cms\Classes\Controller;
|
|
use BackendMenu;
|
|
use Config;
|
|
|
|
use Illuminate\Http\Request;
|
|
use AhmadFatoni\ApiGenerator\Helpers\Helpers;
|
|
use Illuminate\Support\Facades\Validator;
|
|
use Akami\Coffe30\Models\Slider;
|
|
class SliderAPIController extends Controller
|
|
{
|
|
protected $Slider;
|
|
|
|
protected $helpers;
|
|
|
|
public function __construct(Slider $Slider, Helpers $helpers)
|
|
{
|
|
parent::__construct();
|
|
$this->Slider = $Slider;
|
|
$this->helpers = $helpers;
|
|
}
|
|
|
|
public function index(){
|
|
$path = Config::get('app.cdn').Config::get('cms.storage.media.path');
|
|
|
|
$data = $this->Slider
|
|
->select("id", "img")
|
|
->with('translations:locale,model_id,attribute_data')
|
|
->get();
|
|
|
|
if($data) {
|
|
$data->each(function ($item, $key) {
|
|
$item->img = "http://sapalymahabat.com.tm" . \Config::get('cms.storage.media.path') . $item->img;
|
|
});
|
|
}
|
|
|
|
return $this->helpers->apiArrayResponseBuilder(200, 'success', $data);
|
|
}
|
|
|
|
|
|
public static function getAfterFilters() {return [];}
|
|
public static function getBeforeFilters() {return [];}
|
|
public static function getMiddleware() {return [];}
|
|
public function callAction($method, $parameters=false) {
|
|
return call_user_func_array(array($this, $method), $parameters);
|
|
}
|
|
|
|
} |