public function refundSelected($id) { $tenant = Tenant::find($id); $tname = $tenant->name . ' ' . $tenant->lname; $houses = House::where('tenant', $tname)->get(); return View::make('backend.code.payment.againsttenant', compact('tenant', 'houses')); }
/** * Execute the console command. * * @return mixed */ public function fire() { $houses = House::where('status', '=', 'booked')->where('frequency', '=', 4)->get(); foreach ($houses as $house) { $hid = $house->id; $rent = $house->rent; $water = $house->water; $garbage = $house->garbage; $frequency = $house->frequency; $tenant_id = $house->tenant; $tenant = Tenant::find($tenant_id); $t_name = $tenant->name; $t_agent = $tenant->agent_id; $balance = $rent + $water + $garbage; $invoice = new Invoice(); $invoice->type = 'to tenant'; $invoice->houseID = $hid; $invoice->recipient = $t_name; $invoice->agent_id = $t_agent; $invoice->balance = $balance; $invoice->duedate = '2015/03/21'; $invoice->save(); $invoicedetail = new Invoicedetail(); $invoicedetail->rent = $rent; $invoicedetail->water = $water; $invoicedetail->garbage = $garbage; $invoice->invoicedetail()->save($invoicedetail); } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { Tenant::find($id)->delete(); return Redirect::route('admin/tenant'); }
LaravelAtApi::sendMessage($to, $message); } return Redirect::intended('admin/invoice')->with('message', 'Semi-annually invoice(s) generated successfully'); }); Route::get('/cron/run/annualy/lvWVYpnQ7xqFLbjaoG1oDUlTHQ4GMlmx', function () { #Artisan::call('app:annually'); $houses = House::where('status', '=', 'booked')->where('frequency', '=', 4)->get(); foreach ($houses as $house) { $hid = $house->id; $houseName = $house->name; $rent = $house->rent; $water = $house->water; $garbage = $house->garbage; $frequency = $house->frequency; $tenant_id = $house->tenant; $tenant = Tenant::find($tenant_id); $t_name = $tenant->name; $to = $tenant->phone; $t_agent = $tenant->agent_id; $balance = $rent + $water + $garbage; $invoice = new Invoice(); $invoice->type = 'to tenant'; $invoice->houseID = $hid; $invoice->recipient = $t_name; $invoice->agent_id = $t_agent; $invoice->balance = $balance; $invoice->duedate = '2015/03/21'; $invoice->save(); $invoicedetail = new Invoicedetail(); $invoicedetail->rent = $rent; $invoicedetail->water = $water;