当前位置: 首页>>代码示例>>PHP>>正文


PHP Vehicle::find方法代码示例

本文整理汇总了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');
 }
开发者ID:andrescoulson,项目名称:ChancesAPI,代码行数:8,代码来源:VehicleController.php

示例2: destroy

 public function destroy($id)
 {
     $vehicle = Vehicle::find($id);
     $result = $vehicle->delete();
     if ($result) {
         return $this->index();
     } else {
         return $this->index();
     }
 }
开发者ID:dbakiu,项目名称:dvc,代码行数:10,代码来源:VehicleController.php

示例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'));
     }
 }
开发者ID:GlitchedMan,项目名称:a3l-webinterface,代码行数:46,代码来源:VehiclesController.php

示例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/');
     }
 }
开发者ID:Fercho05,项目名称:chancerosApi,代码行数:22,代码来源:UsersofChanceController.php

示例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);
 }
开发者ID:abhikalotra,项目名称:Samples1,代码行数:21,代码来源:controller.php

示例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');
 }
开发者ID:x4rMa,项目名称:Vehicle-Inspection-System,代码行数:10,代码来源:VehicleInspectionController.php

示例7: get_brand_info

 public function get_brand_info(Request $request)
 {
     $id = $request->input('id');
     $vehicle = Vehicle::find($id);
     return $vehicle;
 }
开发者ID:nilesh93,项目名称:Distribution_Management_System,代码行数:6,代码来源:BrandController.php

示例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');
开发者ID:GlitchedMan,项目名称:a3l-webinterface,代码行数:31,代码来源:routes.php

示例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;
         }
     }
 }
开发者ID:abhikalotra,项目名称:Samples1,代码行数:94,代码来源:model.php

示例10: del_vehicles

 public function del_vehicles(Request $request)
 {
     $id = $request->input('id');
     $vehicle = Vehicle::find($id);
     $vehicle->delete();
 }
开发者ID:nilesh93,项目名称:Distribution_Management_System,代码行数:6,代码来源:VehicleController.php


注:本文中的Vehicle::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。