本文整理汇总了PHP中Property::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Property::where方法的具体用法?PHP Property::where怎么用?PHP Property::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Property
的用法示例。
在下文中一共展示了Property::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
/**
* Display the specified resource.
* GET /accountreceivables/{id}
*
* @param int $id
* @return Response
*/
public function show($id)
{
$invoices = Invoice::with('invoicedetail')->find($id);
if ($invoices->type === "to tenant") {
$total = $invoices->invoicedetail->rent + $invoices->invoicedetail->water + $invoices->invoicedetail->electricity + $invoices->invoicedetail->security + $invoices->invoicedetail->service + $invoices->invoicedetail->garbage;
} elseif ($invoices->type === "refund") {
$total = $invoices->invoicedetail->rentD + $invoices->invoicedetail->waterD + $invoices->invoicedetail->electricityD + $invoices->invoicedetail->g_repairs + $invoices->invoicedetail->transport_cost + $invoices->invoicedetail->o_bills + $invoices->invoicedetail->storage_fees + $invoices->invoicedetail->fixed_unit;
} elseif ($invoices->type === "deposits") {
$total = $invoices->invoicedetail->rentD + $invoices->invoicedetail->waterD + $invoices->invoicedetail->electricityD + $invoices->invoicedetail->g_repairs + $invoices->invoicedetail->transport_cost + $invoices->invoicedetail->o_bills + $invoices->invoicedetail->storage_fees + $invoices->invoicedetail->fixed_unit + $invoices->invoicedetail->rent;
}
$houseid = $invoices->id;
$hid = $invoices->houseID;
$housename = House::where('id', $hid)->pluck('name');
$propertyid = House::where('id', $hid)->pluck('propertyID');
$propertyname = Property::where('id', $propertyid)->pluck('name');
$allbal = Invoice::where('houseID', $hid)->sum('balance');
if ($invoices->amountpaid <= 0) {
$outstandingbal = $allbal;
} else {
$outstandingbal = $allbal - $invoices->balance;
}
$balance = $invoices->balance;
if ($outstandingbal == $invoices->balance) {
$amountdue = $invoices->balance;
} else {
$amountdue = $invoices->balance + $outstandingbal;
}
$title = "Print Invoice";
return View::make('backend.code.invoice.show', compact('invoices', 'housename', 'title', 'outstandingbal', 'propertyname', 'invoicedetails', 'total', 'balance', 'amountdue'));
}
示例2: store
/**
* Store a newly created resource in storage.
* POST /properties
*
* @return Response
*/
public function store()
{
$input = Input::all();
$v = Validator::make(Input::All(), array('name' => 'required|max:50|', 'description' => 'required|max:400|min:10', 'ownerID' => 'required'));
if ($v->passes()) {
$agent_id = Sentry::getUser()->id;
$property = new Property();
$property->name = Input::get('name');
$property->description = Input::get('description');
$property->ownerID = Input::get('ownerID');
$property->agent_id = $agent_id;
$property->save();
$newprop = Property::where('name', Input::get('name'))->first();
$newprop_id = $newprop->id;
foreach (Input::get('CBgroup1', array()) as $value) {
$housedue = new Housedue();
$housedue->propertyID = $newprop_id;
$housedue->receivable = $value;
$converted = strtolower(preg_replace("/[[:blank:]]+/", "_", $value));
$housedue->db_name = $converted;
$housedue->save();
}
return Redirect::intended('admin/property');
}
return Redirect::back()->withInput()->withErrors($v)->with('message', 'There were validation errors');
}
示例3: show
/**
* Display the specified resource.
* GET /accountreceivables/{id}
*
* @param int $id
* @return Response
*/
public function show($id)
{
$housedues = Housedue::findOrFail($id);
$houseduepid = $housedues->propertyID;
$propetyName = Property::where('id', $houseduepid)->pluck('name');
return View::make('backend.code.housedue.show', compact('housedues', 'propetyName'));
}
示例4: update
/**
* Update the specified resource in storage.
* PUT /properties/{id}
*
* @param int $id
* @return Response
*/
public function update($id)
{
$property = Property::where('id', $id)->update(Input::all());
if ($property) {
return ['status' => true, 'property' => $property];
} else {
return ['status' => false];
}
}
示例5: main
public function main()
{
$data['properties'] = Property::where('status', 1)->orderBy('created_at', 'desc')->limit(3)->get();
View::share('page_title', 'Homepage');
View::share('sliders', Property::where('status', 1)->orderBy(DB::raw('RAND()'))->limit(10)->get());
View::share('sidebar', true);
View::share('homepage', true);
return View::make('public.home', $data);
}
示例6: got_property
public static function got_property($id)
{
$property = Property::where('location_id', '=', $id);
if ($property->count() > 0) {
return true;
} else {
return false;
}
}
示例7: store
/**
* Store a newly created resource in storage.
* POST /accountreceivables
*
* @return Response
*/
public function store()
{
$input = Input::all();
$v = Validator::make(Input::All(), array('invoiceID' => 'required|max:50|', 'houseID' => 'required', 'amount' => 'required|min:2', 'paymenttype' => 'required', 'amountpayed' => 'required', 'paymenttyperef' => 'required'));
if ($v->passes()) {
$findHouse = Input::get('houseID');
$propertyId = House::where('name', $findHouse)->pluck('propertyID');
$propertyName = Property::where('id', $propertyId)->pluck('name');
$agent_id = Sentry::getUser()->id;
$gamount = Input::get('amount');
$gpayed = Input::get('amountpayed');
$initpaid = Input::get('initpaid');
$b = $gamount - $gpayed;
$id = Input::get('invoiceID');
$balance = $gamount - $gpayed;
$invoice = Invoice::find($id);
$invoiceid = $invoice->id;
$invoice->balance = $gamount - $gpayed;
$invoice->amountpaid = $gpayed + $initpaid;
$invoice->save();
$reciept = new Receipt();
$reciept->invoiceID = $invoice->id;
$reciept->agent_id = $agent_id;
$reciept->type = $invoice->type;
$reciept->houseID = $invoice->houseID;
$reciept->recipient = $invoice->recipient;
$reciept->invoice_amt = $gpayed + $initpaid + $b;
$reciept->amountpaid = $gpayed;
$reciept->balance = $gamount - $gpayed;
$reciept->duedate = $invoice->duedate;
$reciept->save();
$findTenant = $invoice->recipient;
$ftname = strtok($findTenant, " ");
$tenants = Tenant::where('name', $ftname)->get();
foreach ($tenants as $tenant) {
$t_name = $tenant->name;
$to = $tenant->phone;
}
$payment = new Payment();
$payment->invoiceID = Input::get('invoiceID');
$payment->amount = Input::get('amount');
$payment->amountpayed = Input::get('amountpayed');
$payment->houseID = $findHouse;
$payment->client = $invoice->recipient;
$payment->property = $propertyName;
$payment->balance = $gamount - $gpayed;
$payment->paymenttype = Input::get('paymenttype');
$payment->paymenttyperef = Input::get('paymenttyperef');
$payment->save();
#send an sms to the tenant
$message = ' Hi ' . $t_name . ', Your payment of Ksh. ' . number_format($gpayed, 2) . ' for invoice no. ' . $invoiceid . ' of ' . $findHouse . ' has been received successfully, due balance ' . number_format($balance, 2) . ', Thank you';
Queue::push('SendSMS', array('message' => $message, 'number' => $to));
return Redirect::route('show/receipts/index')->withFlashMessage('Payment received successfully');
}
return Redirect::back()->withInput()->withErrors($v)->with('message', 'There were validation errors');
}
示例8: showReceipt
public function showReceipt($id)
{
$receipts = Receipt::find($id);
$hid = $receipts->houseID;
$housename = $hid;
$propertyid = House::where('name', $hid)->pluck('propertyID');
$propertyname = Property::where('id', $propertyid)->pluck('name');
$inid = $receipts->invoiceID;
$allbal = Invoice::where('houseID', $hid)->sum('balance');
$current_bal = Invoice::where('id', $inid)->pluck('balance');
$outstandingbal = $allbal - $current_bal;
$amountdue = $allbal;
$balance = $receipts->balance;
return View::make('backend.code.invoice.showr', compact('receipts', 'amountdue', 'housename', 'outstandingbal', 'propertyname', 'invoicedetails', 'total', 'balance', 'amountdue'));
}
示例9: getPreview
public function getPreview($template, $type = null)
{
$prop = Property::where('brchead', 'exists', true)->where('brchead', '!=', '')->first()->toArray();
//print_r($prop);
//die();
//return View::make('print.brochure')->with('prop',$prop)->render();
if (!is_null($type) && $type != 'pdf') {
$content = View::make('brochuretmpl.' . $template)->with('prop', $prop)->render();
return $content;
} else {
//return PDF::loadView('print.brochure',array('prop'=>$prop))
// ->stream('download.pdf');
return PDF::loadView('brochuretmpl.' . $template, array('prop' => $prop))->setOption('margin-top', '0mm')->setOption('margin-left', '0mm')->setOption('margin-right', '0mm')->setOption('margin-bottom', '0mm')->setOption('dpi', 200)->setPaper('A4')->stream($prop['propertyId'] . '.pdf');
//return PDF::html('print.brochure',array('prop' => $prop), 'download.pdf');
}
}
示例10: array
$sdata = array('sequence' => $nseq, 'propertyId' => Config::get('ia.property_id_prefix') . $nseq);
if ($property->where('_id', '=', $_id)->update($sdata)) {
print $p['_id'] . '->' . $sdata['propertyId'] . '<br />';
}
}
});
Route::get('tonumber', function () {
$property = new Property();
$props = $property->get()->toArray();
$seq = new Sequence();
foreach ($props as $p) {
$_id = new MongoId($p['_id']);
$price = new MongoInt32($p['listingPrice']);
$fmv = new MongoInt32($p['FMV']);
$sdata = array('listingPrice' => $price, 'FMV' => $fmv);
if ($property->where('_id', '=', $_id)->update($sdata)) {
print $p['_id'] . '->' . $sdata['listingPrice'] . '<br />';
}
}
});
Route::get('regeneratepic/{obj?}', function ($obj = null) {
set_time_limit(0);
if (is_null($obj)) {
$product = new Product();
} else {
switch ($obj) {
case 'product':
$product = new Product();
break;
case 'page':
$product = new Page();
示例11: edit
/**
* Show the form for editing the specified resource.
* GET /accountreceivables/{id}/edit
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$invoices = Invoice::find($id);
$hid = $invoices->houseID;
$housename = $hid;
$propertyid = House::where('name', $hid)->pluck('propertyID');
$propertyname = Property::where('id', $propertyid)->pluck('name');
if (is_null($invoices)) {
return Redirect::route('invoice.index');
}
return View::make('backend.code.invoice.edit', compact('invoices', 'properties', 'housename', 'propertyid', 'propertyname'));
}
示例12: index
/**
* Display a listing of the resource.
* GET /properties
*
* @return Response
*/
public function index()
{
$properties = Property::where('agent_id', '=', Sentry::getUser()->id)->get();
return View::make('backend.code.property.index', compact('properties'))->with('message', 'Select a property to create Units');
}
示例13: function
$user->save();
});
Route::post('request_location', function () {
if (Request::ajax()) {
$location = strtolower(Input::get('location'));
$all_types = Type::all();
$all_developers = Developer::all();
$response = array('count' => 0, 'types' => array(0 => 'Any'), 'developers' => array(0 => 'Any'));
foreach ($all_types as $a) {
$response['types'][$a->id] = ucwords($a->name);
}
foreach ($all_developers as $a) {
$response['developers'][$a->id] = ucwords($a->name);
}
// LETS FIND PROPERTIES WITH
$properties = Property::where('location_id', $location)->get();
$count = count($properties);
if ($count > 0) {
$response['count'] = 1;
$response['types'] = array(0 => 'Any');
$response['developers'] = array(0 => 'Any');
foreach ($properties as $p) {
if (!in_array($p->type->id, array_keys($response["types"]))) {
$response['types'][$p->type->id] = ucwords($p->type->name);
}
if (!in_array($p->developer->id, array_keys($response["developers"]))) {
$response['developers'][$p->developer->id] = ucwords($p->developer->name);
}
}
}
header("content-type:application/json");
示例14: array
return Redirect::to("Villa_General_Belgrano/Propiedad/{$id}/{$nombre}");
}
});
Route::get('/Casas', array('as' => 'casas', 'uses' => 'PropertiesController@listCasas'));
Route::get('/Locales', array('as' => 'locales', 'uses' => 'PropertiesController@listLocales'));
Route::get('/Complejos', array('as' => 'complejos', 'uses' => 'PropertiesController@listComplejos'));
Route::get('/Departamentos', array('as' => 'departamentos', 'uses' => 'PropertiesController@listDepartamentos'));
Route::get('/Terrenos', array('as' => 'terrenos', 'uses' => 'PropertiesController@listTerrenos'));
Route::get('/Fondos_de_Comercio', array('as' => 'fondos de comercio', 'uses' => 'PropertiesController@listFondosComercio'));
Route::get('/Fondos de Comercio', array('as' => 'fondos de comercio2', 'uses' => 'PropertiesController@listFondosComercio'));
Route::get('/Alquileres_Permanantes', array('as' => 'alquileres_permanentes', 'uses' => 'PropertiesController@listAlquileresPermanentes'));
Route::get('/Alquileres_Temporarios', array('as' => 'alquileres_temporarios', 'uses' => 'PropertiesController@listAlquileresTemporarios'));
Route::get('/Oportunidades', array('as' => 'oportunidades', 'uses' => 'PropertiesController@listOportunidades'));
});
Route::get('/', function () {
$properties = Property::where('homepage', '=', 1)->get();
return View::make('index2', array('properties' => $properties));
});
Route::get('/contacto', function () {
return View::make('contacto');
});
Route::post('/contacto', function () {
$rules = array('nombre' => 'required|min:3', 'telefono' => 'required|min:5', 'email' => 'required|email', 'consulta' => 'required|min:5');
$messages = array('required' => 'El campo :attribute es obligatorio', 'email' => 'El email ingresado no es válido', 'min' => 'El campo :attribute debe tener al menos :min caracteres');
$validator = Validator::make(Input::all(), $rules, $messages);
if ($validator->fails()) {
return Redirect::to("/contacto")->withErrors($validator)->withInput();
} else {
$input = Input::all();
$input = array('nombre' => $input['nombre'], 'telefono' => $input['telefono'], 'email' => $input['email'], 'consulta' => $input['consulta']);
Mail::send('emails.consulta', $input, function ($message) {
示例15: number_format
$invoicedetail->security = $security;
$invoice->invoicedetail()->save($invoicedetail);
$message = ' Hi ' . $t_name . ', this is to notify you that your invoice of Ksh ' . number_format($balance, 2) . ' for ' . $propname . ' unit ' . $houseName . ' is due on ' . $lastmonth . '.Thanks';
Queue::push('SendSMS', array('message' => $message, 'number' => $to));
}
return 'Semi-annually invoice(s) generated successfully';
});
Route::get('/cron/run/annualy/lvWVYpnQ7xqFLbjaoG1oDUlTHQ4GMlmx', function () {
$startDate = time();
$lastmonth = date('Y-m-d', strtotime('+5 day', $startDate));
$houses = House::where('status', '=', 'booked')->where('frequency', '=', 4)->get();
foreach ($houses as $house) {
$hid = $house->id;
$houseName = $house->name;
$propid = $house->propertyID;
$propname = Property::where('id', $propid)->pluck('name');
$rent = $house->rent;
$water = $house->water;
$garbage = $house->garbage;
$electricity = $house->electricity;
$security = $house->security;
$frequency = $house->frequency;
$tenant_id = $house->tenant;
$tenantnames = strtok($tenant_id, " ");
$tenant = Tenant::where('name', $tenantnames)->first();
$t_name = $tenant->name;
$to = $tenant->phone;
$t_agent = $tenant->agent_id;
$balance = $rent + $water + $garbage + $electricity + $security;
$invoice = new Invoice();
$invoice->type = 'to tenant';