  | 
		 		   | 
	  	    
          
            
			
	
			
			 
                ผมมีไฟล์ php ที่ชื่อว่า char.php ซึ่งมันคือการแปลงตัวเลขให้เป็นภาษาไทย เช่น 1000 เป็น หนึ่งพัน 
ที่นี้ผมต้องการ include ลงใน laravel พอ run คำสั่งมันแจ้ง error ว่า "Class 'App\Libraries\char' not found" 
ต้องปรับยังไงอ่ะครับ 
 
Code char.php(PHP) 
<?php
namespace App\Libraries;
 class hk_baht{
	public $result;
	public function __construct( $num ){
		$this->result=$this->toBaht( $num , true );
	}
	public function toBaht($number ){
		if( !preg_match( '/^[0-9]+(?:\.[0-9]{2}){0,1}$/' , $number=str_replace(',', '', $number) )){
			return 'This is not currency format';
		}
		$num = explode(".", $number); 
		$convert = $this->cv( $num[0]) . 'บาทถ้วน' . ( $st = $this->cv( $num[1]) ) . ($st>''? 'สตางค์' : ''); 
		return $convert; 
	}
	private function cv( $num ){
		$th_num = array('', array('หนึ่ง', 'เอ็ด'), array('สอง', 'ยี่'),'สาม','สี่','ห้า','หก','เจ็ด','แปด','เก้า','สิบ'); 
		$th_digit = array('','สิบ','ร้อย','พัน','หมื่น','แสน','ล้าน'); 
		$ln=strlen($num);
		$t='';
		for($i=$ln; $i>0;$i--){
			$x=$i-1;
			$n = substr($num, $ln-$i,1);
			$digit=$x % 6; 
			if($n!=0){ 
				if( $n==1 ){ $t .= $digit==1? '' : $th_num[1][$digit==0? ($t? 1 : 0) : 0]; }
				elseif( $n==2 ){  $t .= $th_num[2][$digit==1? 1 : 0]; } 
				else{ $t .= $th_num[$n]; } 
				$t .= $th_digit[($digit==0 && $x>0 ? 6 : $digit )]; 
			}else{
				$t .= $th_digit[ $digit==0 && $x>0 ? 6 : 0 ]; 
			}
		}
		return $t; 
	}
}
 
 
Code Controller(PHP) 
<?php
namespace App\Http\Controllers\account;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Libraries\char;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\URL;
class PreBudgetController extends Controller
{
    //
	public function preprint($id)
	{
		$x = char::hk_baht('1000');
		$total=$x->result;
		echo $total;
		/*$preprint = $id;
		$print = DB::connection('account')->table('tbadvance')
					  ->where('id','=',$id)*/
		return view('account.acc.print.pre_print');
	}
}
 
 
  Tag : PHP, Laravel  Framework               
                        | 
           
          
            | 
			
                             | 
           
          
            
              
                   | 
                   | 
                   | 
               
              
                   | 
                
                    
                      | Date :
                          2018-11-02 14:26:08 | 
                      By :
                          Clamore | 
                      View :
                          1291 | 
                      Reply :
                          3 | 
                     
                  | 
                   | 
               
              
                   | 
                   | 
                   | 
               
              | 
           
          
            | 
			 | 
           
         
	    
		             | 
		
			  |