本文整理汇总了PHP中Vehicle::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Vehicle::find方法的具体用法?PHP Vehicle::find怎么用?PHP Vehicle::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vehicle
的用法示例。
在下文中一共展示了Vehicle::find方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: destroy
public function destroy()
{
$datos = Input::all();
$vehicle = Vehicle::find($datos['id']);
$vehicle->status = 0;
$vehicle->save();
return Redirect::intended('/vehiclelist');
}
示例2: destroy
public function destroy($id)
{
$vehicle = Vehicle::find($id);
$result = $vehicle->delete();
if ($result) {
return $this->index();
} else {
return $this->index();
}
}
示例3: postEdit
public function postEdit()
{
$rules = array('vehicleid' => 'required|numeric|exists:vehicles,id', 'playerid' => 'required|numeric|exists:players,playerid', 'reason' => 'required');
$validator = Validator::make(Input::all(), $rules);
if ($validator->passes() && Auth::user()->canEditVehicle(Input::get('playerid'))) {
$alive = 0;
if (Input::get('alive') == 1) {
$alive = 1;
}
$active = 0;
if (Input::get('active') == 1) {
$active = 1;
}
$delete = 0;
if (Input::get('delete') == 1) {
$delete = 1;
}
if ($delete) {
$log = new Adminlog();
$log->type = 'vehicle';
$log->editor = Auth::user()->id;
$log->objectid = Input::get('vehicleid');
$log->playerid = DB::table('players')->where('playerid', Input::get('playerid'))->first()->uid;
$log->reason = Input::get('reason');
$log->difference = $log->getDifference(array('deleted' => 0), array('deleted' => 1));
$log->save();
DB::table('vehicles')->where('id', Input::get('vehicleid'))->delete();
} else {
$vehicle = Vehicle::find(Input::get('vehicleid'));
$log = new Adminlog();
$log->type = 'vehicle';
$log->editor = Auth::user()->id;
$log->objectid = Input::get('vehicleid');
$log->playerid = DB::table('players')->where('playerid', Input::get('playerid'))->first()->uid;
$log->reason = Input::get('reason');
$log->difference = $log->getDifference(array('alive' => $vehicle->alive, 'active' => $vehicle->active), array('alive' => $alive, 'active' => $active));
$log->save();
$vehicle->alive = $alive;
$vehicle->active = $active;
$vehicle->save();
}
return Redirect::to('/vehicles')->with(array('message' => 'Die Änderung wurde erfolgreich übernommen.', 'type' => 'success'));
} else {
return Redirect::to('/vehicles')->with(array('message' => 'Leider ist ein Fehler aufgetreten, die Änderung wurde verworfen.', 'type' => 'danger'));
}
}
示例4: store
public function store()
{
$data = Input::all();
$idchance = $data['chances_id'];
$iduser = Auth::user()->id;
$data['users_id'] = $iduser;
$chance = Chance::find($idchance);
$userofchances = UserofChance::where('chances_id', '=', $idchance)->where('users_id', '=', $iduser)->get();
if (empty($userofchances)) {
$message = json_encode(array('message', 'You have already taken this chance'));
return $message;
}
$vehicle = Vehicle::find($chance->vehicles_id);
if ($vehicle->users_id == $iduser) {
$message = json_encode(array('message', 'You created this chance'));
} else {
UserofChance::create($data);
$chance->capacity = $chance->capacity - 1;
$chance->save();
return Redirect::intended('/chanceslist/');
}
}
示例5: vehicleRevisions
public function vehicleRevisions($id)
{
if (Vehicle::find($id)) {
$vehicle = Vehicle::find($id);
$vehicleStatus = true;
} else {
$vehicle = Vehicle::withTrashed()->find($id);
$vehicleStatus = false;
}
$vehicle['vehicles_class_name'] = Vehicle::vehicleClassName($id);
$registration = $vehicle->registrationTrashed;
$owners = $vehicle->owners;
$authorizedDr = $vehicle->authorizedDrivers;
$documents = $vehicle->documents;
$insurance = $vehicle->insuranceTrashed;
$lien = $vehicle->lienTrashed;
$deletedOnwers = $vehicle->deletedOwners;
$deletedAuthorizedDrivers = $vehicle->deletedAuthorizedDrivers;
$data = compact('registration', 'vehicle', 'vehicleStatus', 'owners', 'deletedOnwers', 'authorizedDr', 'deletedAuthorizedDrivers', 'documents', 'insurance', 'lien');
return View::make('vehicle.revisions', $data);
}
示例6: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
return View::make('vehiclesinspection.show')->with('vehicle', Vehicle::find($id))->with('title', 'Vehicle Inspection Profile');
}
示例7: get_brand_info
public function get_brand_info(Request $request)
{
$id = $request->input('id');
$vehicle = Vehicle::find($id);
return $vehicle;
}
示例8: foreach
foreach ($logs[$key]->difference as $differencekey => $difference) {
$logs[$key]->differences[] = array($differencekey, $difference[0], $difference[1]);
}
$log->search_letter = strtolower(substr($log->type, 0, 1));
switch ($log->type) {
case 'player':
$logs[$key]->type = 'Spieler';
$logs[$key]->object_name = Player::find($log->objectid)['name'];
break;
case 'gang':
$logs[$key]->type = 'Gang';
$logs[$key]->object_name = Gang::find($log->objectid)['name'];
break;
case 'vehicle':
$logs[$key]->type = 'Fahrzeug';
$logs[$key]->object_name = Vehicle::find($log->objectid)['classname'];
break;
}
}
return View::make('main', array('level_label' => $level_label, 'counter' => $counter))->nest('content', 'logs', array('level_label' => $level_label, 'logs' => $logs, 'search' => $search, 'type' => $type));
}));
Route::get('/statistics', array('before' => 'auth', function () use($level_label, $counter) {
$statistics = DB::table('statistics')->orderBy('timestamp', 'asc')->get();
return View::make('main', array('level_label' => $level_label, 'counter' => $counter))->nest('content', 'statistics', array('level_label' => $level_label, 'statistics' => $statistics));
}));
Route::get('/donators', array('before' => 'auth|admin', function () use($level_label, $counter) {
$donators = DB::table('players')->where('donatorlvl', '>', 0)->paginate(50);
foreach ($donators as $key => $donator) {
$date = new DateTime($donator->donatordate);
$duration = $donator->donatorduration < 1 ? 1 : $donator->donatorduration;
$date->modify('+' . $duration . ' month');
示例9: getVehiclePendingFinesMessage
/**
* GET ASSOCIATED PENDING FINES MESSAGES OF VEHICLE
* @param int $id ID OF VEHICLE
* @return html FINES MESSAGES
*/
public static function getVehiclePendingFinesMessage($id)
{
$vehicle = Vehicle::find($id);
$voilationsCount = $vehicle->voilationsPending->count();
$msg = "";
// PENDING VEHICLE VOILATIONS EXISTS
if ($voilationsCount > 0) {
$vehicle_voilations_unique_id_ar = $vehicle->voilationsPending->lists('vehicle_fine_unique_id');
$vehicle_ids = implode(", ", $vehicle_voilations_unique_id_ar);
$msg .= "<div class='row'><div class='col-md-12'>This Vehicle has {$voilationsCount} pending fines ({$vehicle_ids})</div></div>";
// BEGIN VEHICLE OWNERS FINE
$vehicleOwners = $vehicle->owners;
foreach ($vehicleOwners as $vehicleOwner) {
if ($vehicleOwner->voilationsPending->count() > 0) {
$vehicleOwnerFinesIds[$vehicleOwner->id] = $vehicleOwner->voilationsPending->lists('driver_fine_unique_id');
}
}
// IF VEHICLE OWNER FINES EXISTS
if (isset($vehicleOwnerFinesIds) && count($vehicleOwnerFinesIds) > 0) {
foreach ($vehicleOwnerFinesIds as $ownerId => $vehicleOwnerFinesId) {
$owner = Driver::find($ownerId);
$ownerName = $owner->drivers_fname . " " . $owner->drivers_mname . " " . $owner->drivers_lname;
// FINES ID IS IN ARRAY, SO IMPLODE IT
$finesIdStr = implode(',', $vehicleOwnerFinesId);
$msg .= "<div class='row'><div class='col-md-12'>Owner ({$ownerName}) has " . count($vehicleOwnerFinesId) . " pending fines ({$finesIdStr})</div></div>";
}
}
// END VEHICLE OWNERS FINE
// BEGIN VEHICLE AUTHORIZED DRIVERS FINE
$vehicleAuthorized = $vehicle->authorizedDrivers;
foreach ($vehicleAuthorized as $vehicleAuthorized) {
if ($vehicleAuthorized->voilationsPending->count() > 0) {
$vehicleAuthorizedFinesIds[$vehicleAuthorized->id] = $vehicleAuthorized->voilationsPending->lists('driver_fine_unique_id');
}
}
if (isset($vehicleAuthorizedFinesIds) && count($vehicleAuthorizedFinesIds) > 0) {
foreach ($vehicleAuthorizedFinesIds as $authorizedId => $vehicleAuthorizedFinesId) {
$authorized = Driver::find($authorizedId);
$authorizedName = $authorized->drivers_fname . " " . $authorized->drivers_mname . " " . $authorized->drivers_lname;
// FINES ID IS IN ARRAY, SO IMPLODE IT
$finesIdStrAuthorized = implode(',', $vehicleAuthorizedFinesId);
$msg .= "<div class='row'><div class='col-md-12'>Authorized Driver ({$authorizedName}) has " . count($vehicleAuthorizedFinesId) . " pending fines ({$finesIdStrAuthorized})</div></div>";
}
}
// END VEHICLE AUTHORIZED DRIVER FINE
if (!empty($msg)) {
return $msg;
}
} else {
// BEGIN VEHICLE OWNERS FINE
$vehicleOwners = $vehicle->owners;
foreach ($vehicleOwners as $vehicleOwner) {
if ($vehicleOwner->voilationsPending->count() > 0) {
$vehicleOwnerFinesIds[$vehicleOwner->id] = $vehicleOwner->voilationsPending->lists('driver_fine_unique_id');
}
}
// IF VEHICLE OWNER FINES EXISTS
if (isset($vehicleOwnerFinesIds) && count($vehicleOwnerFinesIds) > 0) {
foreach ($vehicleOwnerFinesIds as $ownerId => $vehicleOwnerFinesId) {
$owner = Driver::find($ownerId);
$ownerName = $owner->drivers_fname . " " . $owner->drivers_mname . " " . $owner->drivers_lname;
// FINES ID IS IN ARRAY, SO IMPLODE IT
$finesIdStr = implode(',', $vehicleOwnerFinesId);
$msg .= "<div class='row'><div class='col-md-12'>Owner ({$ownerName}) has " . count($vehicleOwnerFinesId) . " pending fines ({$finesIdStr})</div></div>";
}
}
// END VEHICLE OWNERS FINE
// BEGIN VEHICLE AUTHORIZED DRIVERS FINE
$vehicleAuthorized = $vehicle->authorizedDrivers;
foreach ($vehicleAuthorized as $vehicleAuthorized) {
if ($vehicleAuthorized->voilationsPending->count() > 0) {
$vehicleAuthorizedFinesIds[$vehicleAuthorized->id] = $vehicleAuthorized->voilationsPending->lists('driver_fine_unique_id');
}
}
if (isset($vehicleAuthorizedFinesIds) && count($vehicleAuthorizedFinesIds) > 0) {
foreach ($vehicleAuthorizedFinesIds as $authorizedId => $vehicleAuthorizedFinesId) {
$authorized = Driver::find($authorizedId);
$authorizedName = $authorized->drivers_fname . " " . $authorized->drivers_mname . " " . $authorized->drivers_lname;
// FINES ID IS IN ARRAY, SO IMPLODE IT
$finesIdStrAuthorized = implode(',', $vehicleAuthorizedFinesId);
$msg .= "<div class='row'><div class='col-md-12'>Authorized Driver ({$authorizedName}) has " . count($vehicleAuthorizedFinesId) . " pending fines ({$finesIdStrAuthorized})</div></div>";
}
}
// END VEHICLE AUTHORIZED DRIVER FINE
if (!empty($msg)) {
return $msg;
}
}
}
示例10: del_vehicles
public function del_vehicles(Request $request)
{
$id = $request->input('id');
$vehicle = Vehicle::find($id);
$vehicle->delete();
}