mercredi 18 mai 2016

Do i have to make mutiple blade templates? laravel 5.2

i am quite new to laravel and blade templates , and i am quite confused what should i do in this situation.

I got mutiple tables - cpus table, motherboards table, memory table etc... each table contains information about parts specifications

I'm retrieving single column from a table

  $select_columns = [
   'cores',
   'threads',
   'frequency',
   'max_frequency',
   'l1',
   'l2',
   'l3',
   'thermal',
   'tech',
  ];

  $specs = \DB::table('cpus')->select($select_columns)->where('slug' , $slug)->first();

The information about specification and value should be displayed like this.

<table>
<tbody>
<tr>
<td>Specificiation</td> 
<td>value</td>              
</tr>

<tr>
<td>Specification</td> 
<td>value</td>              
</tr>

// other specifications

</tbody>
 </table>

I could easily output all tables rows with foreach loop using 1 template.

@foreach ($specs as $spec => $value)
<tr>
<td> </td>  
<td> </td>                
</tr>
@endforeach

but the - specificarions needs to be in different language, and i can't use

select(column as newvalue) 

because there are letters like 'Ā Ļ Ņ Ž ' and code would loook really weird if i would do that

So i guess the question is what exactly should i do about it?

Should i make each table a new template and display data like this?

<tr>
<td>Specification</td> 
<td></td>              
</tr>


<tr>
<td>Specification1</td> 
<td></td>                 
</tr>

I'm quite lost here.

Thanks in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire