mardi 28 mars 2017

How to get six character of a string in SQL code in laravel5?

I create a table with 5 columns and 'benefits' is one of the column.I can get whole data but I need to get the first 6 letters from the 'benefits' field. The benefits column have more than 300. my controller code

public function List(Request $request)
    {
        if($request->ajax()){
            $data = Package::get();  
            $list = array();
            $i=1;
            foreach ($data as $key => $Package) {
                $dd = array();
        if($Package->free_benifits != ""){

           array_push($dd, '<center>'.$Package->free_benifits.'</center>');
                }else {
                  array_push($dd, '<center>-</center>');
                }
      }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire