WARNING:: LARAVEL SUPER-BEGINNER, BE GENTLE::
In my controller:
public function get_index(){
$lease_rates = DB::table('lease_rates');
$this->layout->nest('content','admin.lease_rates', array('lease_rates' => $lease_rates, ));
In my lease_rates table:
id lease_year class_letter rate
1 2012 A 635
2 2012 B 648
... .... ... ...
5 2012 E 789
6 2011 A 629
In my lease_rates.blade.php:
<input type="text"
name="{{ $lease_rates->rate->find(1) }}"
value="{{ $lease_rates->rate->find(1) }}">
<input type="text"
name="{{ $lease_rates->rate->find(2) }}"
value="{{ $lease_rates->rate->find(2) }}">
Obviously the above doesn’t work. The end result that I want:
- Sort the array sent to the page by lease_year, descending then by class_letter ascending.
- Put the values of the rate for each id into text boxes where the textbox name is the id and the text displayed is the rate for said id.
- After that works, I’ll need to submit any changes made to the table
- After that, I’ll work on adding records
Thanks so much! Like I said, I’m new, but eager to learn (and even more eager to get this thing done)
Did you look at the docs for the Fluent Query Builder (or Eloquent ORM)? http://laravel.com/docs/database/fluent
You could do something like this (not checked, but you should get the idea):
You could also use the Eloquent ORM, to make it even easier.