<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\DB;


class Controller extends BaseController
{
    use AuthorizesRequests, ValidatesRequests;

    public function getCategoryName($id) {
        $category = DB::table('tbl_categories')->where('id', $id)->first();
        return $category->name;
    }
    
    public function validatersErrorString($errors){

        $msgString='';
    
        foreach($errors->all() as $error){
            $msgString.=' - '.$error.'<br>';
        }
    
        return $msgString;
    }
}
