<?php

namespace App\Http\Resources;

use App\Http\Resources\UserResource as UserResource;
use App\Http\Resources\ModelResource;
use Illuminate\Http\Resources\Json\JsonResource;
use App\Setting;
use Illuminate\Http\Request;

class SettingResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        
        
        $facebook = Setting::where('key','facebook')->first();
        $twitter = Setting::where('key','twitter')->first();
        $instagram = Setting::where('key','instagram')->first();
        $youtube = Setting::where('key','youtube')->first();
        $address = Setting::where('key','address')->first();
        $phone = Setting::where('key','phone')->first();
        $email = Setting::where('key','email')->first();
        $support = Setting::where('key','support')->first();
        $percentage = Setting::where('key','percentage')->first();
        $points = Setting::where('key','points')->first();
        $sub = Setting::where('key','sub')->first();
        
        
        
        
        
       
        $data =  [
            'email' => $email['value'],
            'phone' => $phone['value'],
            'address' => $address['value'],
            'support' => $support['value'],
            'facebook' => $facebook['value'],
            'youtube' => $youtube['value'],
            'twitter' => $twitter['value'],
            'instagram' => $instagram['value'],
            'percentage' => $percentage['value'],
            'points' => $points['value'],
            'sub' => $sub['value'],
            
            
            
            
            
      ];
     
         
      
      return $data;
    }
}
