1
データベーステーブルTime_trackerを更新したいだけですが、何か試してもエラーが発生します。誰もこれで私を助けることができますか?現在のエラーはPaypalController.phpのErrorExceptionです。57: 非オブジェクトのプロパティを取得しようとしていますLaravel 5.2データベーステーブルの更新
これはコードです。
PaypalController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Illuminate\Mail\Mailer;
use App\Maintenance;
use App\Time_tracker;
class PaypalController extends Controller {
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function index() {
return view('paypal');
}
public function success() {
$price = \Session::get('value_price');
$value = $price;
if($value == '465'){
$user_id = Auth::user()->id;
$Totalpurchase = DB::table('time_tracker')->where('user_id', $user_id->user_id)->sum('purshase_time');
$purchase = $Totalpurchase + 15;
DB::table('users')
->where('user_id', $user_id)
->update(['status' => 'paid',
'purshase_time' => $purchase_time
]);
}elseif($value == '700'){
$user_id = Auth::user()->id;
$Totalpurchase = DB::table('time_tracker')->where('user_id', $user_id->user_id)->sum('purshase_time');
$purchase = $Totalpurchase + 25;
DB::table('users')
->where('user_id', $user_id)
->update(['status' => 'paid',
'purshase_time' => $purchase_time
]);
}elseif($value == '1300'){
$user_id = Auth::user()->id;
$Totalpurchase = DB::table('time_tracker')->where('user_id', $user_id->user_id)->sum('purshase_time');
$purchase = $Totalpurchase + 50;
DB::table('users')
->where('user_id', $user_id)
->update(['status' => 'paid',
'purshase_time' => $purchase_time
]);
}
return view('success');
}
public function failed() {
return view('failed');
}
}
はい、動作します。どうもありがとう! – Ace