moon display
This commit is contained in:
@@ -12,15 +12,37 @@ use DB;
|
||||
|
||||
class MoonsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Function to display the moons and pass data to the blade template
|
||||
*/
|
||||
public function displayMoons() {
|
||||
//get all of the moons from the database
|
||||
$moons = DB::table('moons')->get();
|
||||
dd($moons);
|
||||
//declare the html variable and set it to null
|
||||
$html = '';
|
||||
foreach($moons as $moon) {
|
||||
$html .= '<td>' . $moon['system'] . '</td>';
|
||||
//Setup formats as needed
|
||||
$spm = $moon['System'] . ' - ' . $moon['Planet'] . ' - ' . $moon['Moon'];
|
||||
$rentalEnd = date('d.m.Y', $moon['RentalEnd']);
|
||||
//Add the data to the html string to be passed to the view
|
||||
$html .= '<tr>';
|
||||
$html .= '<td>' . $spm . '</td>';
|
||||
$html .= '<td>' . $moon['StructureName'] . '</td>';
|
||||
$html .= '<td>' . $moon['FirstOre'] . '</td>';
|
||||
$html .= '<td>' . $moon['FirstQuantity'] . '</td>';
|
||||
$html .= '<td>' . $moon['SecondOre'] . '</td>';
|
||||
$html .= '<td>' . $moon['SecondQuantity'] . '</td>';
|
||||
$html .= '<td>' . $moon['ThirdOre'] . '</td>';
|
||||
$html .= '<td>' . $moon['ThirdQuantity'] . '</td>';
|
||||
$html .= '<td>' . $moon['FourthOre'] . '</td>';
|
||||
$html .= '<td>' . $moon['FourthQuantity'] . '</td>';
|
||||
$html .= '<td>' . $moon['Price'] . '</td>';
|
||||
$html .= '<td>' . $moon['Renter'] . '</td>';
|
||||
$html .= '<td>' . $rentalEnd . '</td>';
|
||||
$html .= '</tr>';
|
||||
}
|
||||
|
||||
return view('moons.moon')->with($moons);
|
||||
return view('moons.moon')->with($html);
|
||||
}
|
||||
|
||||
public function addMoon() {
|
||||
|
||||
Reference in New Issue
Block a user