<?php

namespace App\Http\Controllers\dashboard;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\AboutModel;
use App\Models\AchievementsModel;
use Session;

class AboutController extends Controller
{
    public function about_index()
    {  
        $info = AboutModel::find(1);
        return view('dashboard.pages.about',  compact('info'));
    }
    public function about_update(Request $request)
    {  
        $data = $request->all();

        $update = AboutModel::find(1)->update($data);
        if($update){
            Session::flash('success', 'Updates complete ');
        }else{
            Session::flash('error', ' something wrong ');
        }
        return redirect()->back();
    }
    public function achievements_index()
    {  
        $info = AchievementsModel::find(1);
        return view('dashboard.pages.achievements',  compact('info'));
    }
    public function achievements_update(Request $request)
    {  
        $data = $request->all();

        $update = AchievementsModel::find(1)->update($data);
        if($update){
            Session::flash('success', 'Updates complete ');
        }else{
            Session::flash('error', ' something wrong ');
        }
        return redirect()->back();
    }
}
