<?php namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use DB;

class PrintPatternModel extends Model {

	function selectAllPrintTemplate($q) // display all data from database
	{
        // $i = DB::table('print_pattern_list')
	// 				->where('TemplateCode', $q)
	// 				->get();
	$i = DB::table('print_pattern_list')->select('print_pattern_list.Id', 'print_pattern_list.TemplateCode', 'print_pattern_list.Path', 'print_pattern_list.Type', 'print_pattern_list.Size', 'print_pattern_list.DateCreated')
			->leftjoin('sizes', 'sizes.Size','=','print_pattern_list.Size')
			->where('print_pattern_list.TemplateCode','=',$q)
			->orderBy('sizes.Ordering', 'ASC')
			->get();
	return $i;
	

	
	}

	 function insertPrintPattern($data){
        $i = DB::table('print_pattern_list')->insert($data);
        return $i;
	}


	
}
