<?php
namespace App\Http\Controllers;
namespace App\Http\Controllers\Admin\Website;
use App\Models\Admin\Website\Team;
use App\Http\Controllers\Controller;
use App\Models\Admin\Website\Banner;
use App\Models\Admin\Website\webnews;
use App\Models\Admin\Website\Web_Event;
use App\Models\Admin\Website\BrandPartner;
use App\Models\Admin\Website\WebSetting;
class ApiController extends Controller
{
public function banner_api()
{
$banners = Banner::all();
foreach($banners as $banner){
$arr[] = [
'banner_title'=>$banner->title,
'image'=>asset('upload/'.$banner->image),
'status'=>$banner->status,
];
}
return response()->json([
'data' => $arr
], 200);
}
public function news_api()
{
$new = webnews::all();
foreach($new as $news){
$arr[] = [
'date'=>$news->date,
'image'=>asset('upload/'.$news->image),
'title'=>$news->title,
'description'=>$news->description,
'slug'=>$news->slug,
'status'=>$news->status,
]
;}
return response()->json([
'data' => $arr
], 200);
}
public function events_api()
{
$event = Web_Event::all();
foreach($event as $events){
$arr[] = [
'date'=>$events->date,
'image'=>asset('upload/'.$events->image),
'title'=>$events->title,
'description'=>$events->description,
'slug'=>$events->slug,
'status'=>$events->status,
]
;}
return response()->json([
'data' => $arr
], 200);
}
public function apiteam()
{
$tests = Team::all();
foreach($tests as $test){
$datas[] = [
'name'=>$test->name,
'profile'=>asset('upload/'.$test->profile),
'phone'=>$test->phone,
'email'=>$test->email,
'status'=>$test->status,
];
}
return response()->json([
'data' => $datas
], 200);
}
public function apibrand()
{
$tests = BrandPartner::all();
foreach($tests as $test){
$datas[] = [
'logo'=>asset('upload/'.$test->image),
'slug'=>$test->slug,
'status'=>$test->status,
];
}
return response()->json([
'data' => $datas
], 200);
}
public function setting_api()
{
$settings = WebSetting::all();
foreach($settings as $setting){
$arr[] = [
'company_name'=>$setting->company_name,
'email'=>$setting->email,
'phone'=>$setting->phone,
'alt_phone'=>$setting->alt_phone,
'address'=>$setting->address,
'fb_link'=>$setting->fb_link,
'company_logo'=>asset('upload/'.$setting->company_logo),
'twitter_link'=>$setting->twitter_link,
'youtube_link'=>$setting->youtube_link,
'instagram_link'=>$setting->instagram_link,
'map_url'=>$setting->map_url,
'meta_title'=>$setting->meta_title,
'meta_keywords'=>$setting->meta_keywords,
'meta_description'=>$setting->meta_description,
];
}
return response()->json([
'data' => $arr
], 200);
}
}
0 Comments