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


PHP Project::findOrFail方法代码示例

本文整理汇总了PHP中app\models\Project::findOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::findOrFail方法的具体用法?PHP Project::findOrFail怎么用?PHP Project::findOrFail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Project的用法示例。


在下文中一共展示了Project::findOrFail方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 /**
  * Return a paginated list of notes
  * 
  * @return \Dingo\Api\Http\Response
  */
 public function index($projectId)
 {
     $notes = Project::findOrFail($projectId)->notes()->paginate(app('request')->get('per_page', 10));
     $queryParams = array_diff_key($_GET, array_flip(['page']));
     $notes->appends($queryParams);
     return $this->response->paginator($notes, new NoteTransformer());
 }
开发者ID:missionsme,项目名称:projects,代码行数:12,代码来源:ProjectNotesController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(PayoutRequest $request, $id)
 {
     $project = Project::findOrFail($id);
     $input = $request->all();
     $input = $request->all();
     $input['updated_by'] = Auth::user()->id;
     $input['payment_date'] = date('Y-m-d H:i:s');
     $project->fill($input);
     $project->save();
     Session::flash('success', Lang::get('ruban.payout.created'));
     return Redirect::route('ruban.payouts.index');
 }
开发者ID:mahitiinfo,项目名称:rubanbridge,代码行数:17,代码来源:PayoutController.php

示例3: show

 /**
  * Return a single project
  * 
  * @return \Dingo\Api\Http\Response
  */
 public function show($id)
 {
     $project = Project::findOrFail($id);
     return $this->response->item($project, new ProjectTransformer());
 }
开发者ID:missionsme,项目名称:projects,代码行数:10,代码来源:ProjectsController.php

示例4: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $product = Product::find($id);
     if (!$product) {
         return response()->json('Le produit n\'existe pas.', 404);
     }
     $validator = Validator::make($request->all(), ['range_id' => 'integer', 'project_id' => 'integer']);
     if ($validator->fails()) {
         return response()->json($validator->errors()->all(), 400);
     }
     if ($request->input('range_id')) {
         try {
             $range = Range::findOrFail($request->input('range_id'));
         } catch (Exception $e) {
             return response()->json('La gamme n\'existe pas.', 404);
         }
     }
     if ($request->input('project_id')) {
         try {
             $project = Project::findOrFail($request->input('project_id'));
         } catch (Exception $e) {
             return response()->json('Le projet n\'existe pas.', 404);
         }
     }
     $product->update($request->all());
     return $product;
 }
开发者ID:oarGroupeCesi,项目名称:madera_api,代码行数:34,代码来源:ProductController.php

示例5: update

 public function update(Request $request, $id)
 {
     $project = Project::findOrFail($id);
     $project->project_name = $request->input('project_name');
     $project->project_type = $request->input('project_type');
     $project->project_budget = $request->input('project_budget');
     $project->project_timeline = $request->input('project_timeline');
     $project->project_size = $request->input('project_size');
     $project->project_framework = $request->input('project_framework');
     $project->project_theme = $request->input('project_theme');
     $project->project_cms = $request->input('project_cms');
     $project->save();
     return redirect('projects');
 }
开发者ID:bebaps,项目名称:projectphilter,代码行数:14,代码来源:ProjectController.php

示例6: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $module = Module::find($id);
     if (!$module) {
         return response()->json('Le module n\'existe pas.', 404);
     }
     $validator = Validator::make($request->all(), ['name' => 'string', 'height' => 'integer', 'width' => 'integer', 'quantity' => 'integer', 'modulenature_id' => 'integer', 'project_id' => 'integer']);
     if ($validator->fails()) {
         return response()->json($validator->errors()->all(), 400);
     }
     if ($request->input('modulenature_id')) {
         try {
             $modulenature = Modulenature::findOrFail($request->input('modulenature_id'));
         } catch (Exception $e) {
             return response()->json('La nature de module n\'existe pas.', 404);
         }
     }
     if ($request->input('project_id')) {
         try {
             $project = Project::findOrFail($request->input('project_id'));
         } catch (Exception $e) {
             return response()->json('Le projet n\'existe pas.', 404);
         }
     }
     $module->update($request->all());
     return $module;
 }
开发者ID:oarGroupeCesi,项目名称:madera_api,代码行数:34,代码来源:ModuleController.php

示例7: getPreview

 public function getPreview()
 {
     $id = \Input::get('p') ? \Input::get('p') : Null;
     if (empty($id)) {
         App::abort(404, 'Invalid Project Id');
     }
     $login_url = $this->login_url;
     $post = Project::findOrFail($id);
     $guserdetails = $this->project_repo->getuserrecords($post->user_id);
     $userdetails = $guserdetails[0];
     $_total_pledge_amount = $this->projectfund->where('P_ID', $id)->where('status', 'Pledged')->sum('paid_amount');
     $_total_backers_on_project = $this->projectfund->where('P_ID', $id)->where('status', 'Pledged')->count();
     $_pof_value = $_total_pledge_amount / $post->funding_goal * 100;
     $_pof = $_pof_value > 1 ? $_pof = sprintf("%d%%", $_pof_value) : ($_pof_value == 0 ? sprintf("%d%%", $_pof_value) : sprintf("%.2f%%", $_pof_value));
     return view('project.share-preview', ['post' => $post, '_menus' => $this->menuItems, 'rewards' => Reward::where('P_ID', $id)->get(), '_total_pledge_amount' => $_total_pledge_amount, '_total_backers_on_project' => $_total_backers_on_project, '_pof' => $_pof, 'login_url' => $login_url, 'userdetails' => $userdetails, 'useraddedproj' => 0]);
 }
开发者ID:udayc,项目名称:travel,代码行数:16,代码来源:ProjectController.php

示例8: postPayments

 public function postPayments(Request $request)
 {
     $authId = Auth::user()->id;
     //dd($authId);
     //$getReceiverAccount = \App\Models\ReciverAccount::where('user_id' , $authId)->first();
     //dd($getReceiverAccount);
     $rewardLogId = $request->input('_log_id_');
     $rewardLogRow = \App\Models\RewardsLogDuringPayment::where('id', $rewardLogId)->first();
     $rewardLogRowDecodedObj = json_decode($rewardLogRow->array_obj);
     $project_id = $rewardLogRowDecodedObj->project_id;
     $backingAmount = $rewardLogRowDecodedObj->backing->amount;
     $stripeToken = $request->input('stripeToken');
     $currency = $request->input('currency');
     $error = '';
     $post = \App\Models\Project::findOrFail($rewardLogRowDecodedObj->project_id);
     $getReceiverAccount = $post->user_id ? \App\Models\ReciverAccount::where('user_id', $post->user_id)->first() : Null;
     if ($getReceiverAccount->secret_key) {
         //\Stripe\Stripe::setApiKey(\Config::get('stripe.stripe.secret'));
         \Stripe\Stripe::setApiKey($getReceiverAccount->secret_key);
     }
     try {
         // throw new Exception("The Stripe Token was not generated correctly");
         $post = \App\Models\Project::findOrFail($project_id);
         $charge = \Stripe\Charge::create(array("amount" => $backingAmount * 100, "currency" => $currency, "capture" => false, "card" => $stripeToken, "description" => 'Captured  amount #' . $backingAmount . $currency . ' for pledge project-id #' . $project_id), array('idempotency_key' => $this->generateRandomString()));
         //echo $charge->status;
         //dd($charge);
         if ($charge->status == 'succeeded') {
             $transactionId = $charge->id;
             $actionMsg_1 = Auth::user()->name . ' has pledged for project  # ' . $post->name;
             $actionMsg_2 = Auth::user()->name . ' has invested ' . $backingAmount . $currency . ' for project  # ' . $post->name;
             $settingsRow = \App\Setting::where('config_key', 'commission_from_each_fund')->first();
             $commissionVal = $settingsRow->config_value;
             $projectFunds = new \App\Models\ProjectFund();
             $projectFunds->P_ID = $project_id;
             $projectFunds->U_ID = Auth::user()->id;
             $projectFunds->paid_amount = $backingAmount;
             $projectFunds->site_commission = $backingAmount * $commissionVal / 100;
             $projectFunds->amount_to_project_owner = $backingAmount - $backingAmount * $commissionVal / 100;
             $projectFunds->status = 'Pledged';
             $projectFunds->rewards_log_during_payment_id = $rewardLogId;
             $projectFunds->transaction_id = $transactionId;
             $projectFunds->save();
             // commission_from_each_fund
             \Event::fire('transaction.log', new \App\Events\Transaction($request, ['transaction_id' => $transactionId, 'user_id' => Auth::user()->id, 'msg' => $actionMsg_1, 'credit' => '0.00', 'debit' => $backingAmount, 'status' => 'Pledged']));
             \Event::fire('activity.log', new \App\Events\Activity($request, ['project_id' => $project_id, 'user_id' => Auth::user()->id, 'action' => 'invested', 'msg' => $actionMsg_2]));
         }
     } catch (Exception $e) {
         $e_json = $e->getMessage();
         $error = $e_json['error'];
         return \Redirect::to('checkout/payments')->withInput()->with('stripe_errors', $error['message']);
     }
     return \Redirect::to('checkout/success');
 }
开发者ID:udayc,项目名称:travel,代码行数:53,代码来源:CheckoutController.php

示例9: mockToParts

 public function mockToParts($projectID, $aircraftTypeId)
 {
     $project = Project::findOrFail($projectID);
     if ($project->is_mocked) {
         return;
     }
     $mocker = AircraftPart::with('aircraft', 'parts.atas')->where('aircraft_id', $aircraftTypeId)->get();
     //return $mocker;
     foreach ($mocker as $part) {
         for ($p = 0; $p < $part->quantity; $p++) {
             ProjectPart::create(['project_id' => $projectID, 'ATA' => $part['parts'][0]->ATA, 'in_project' => false, 'part_listing_id' => $part->part_listing_id, 'package_id' => $part['parts'][0]->package_id, 'condition' => 1, 'can_sell' => false]);
         }
     }
     $project->is_mocked = true;
     $project->save();
     return ProjectPart::with('condition', 'part')->where('project_id', $projectID)->orderBy('ATA')->get();
 }
开发者ID:wyrover,项目名称:aeroeco,代码行数:17,代码来源:ProjectsController.php


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