Category : controller

can you correction my code $tongkol = $dataSurat->pilih_kepala; $integerIDs = array_map(‘intval’, explode(‘,’, $tongkol)); for ($i = 0; $i < sizeof($integerIDs); $i++) { $this->pegawai->groupStart(); $this->pegawai->where("find_in_set($integerIDs[$i], id_pegawai)"); $this->pegawai->groupEnd(); $query = $this->pegawai->get()->getResult(); var_dump($query); i want result like this, 2 object inside 1 array array(2) { [0]=> object(stdClass)#105 (18) { ["id_pegawai"]=> string(1) "6" ["nip"]=> string(3) "123" ["nama"]=> string(13) "RENNY, ..

Read more

i have this route: web.php: Route::get(‘main’,[HomePageController::class,’show’]); that pass this function: HomePageController.php class HomePageController extends Controller { function show() { $data = Classes::all(); return view(‘index’,[‘classes’=>$data]); } } and i want to pass another function in the same route but i keep getting "Undefined variable" whenever i try to do this: web.php Route::get(‘main’,[HomePageController::class,’show’]); Route::get(‘main’,[HomePageController::class,’showfeeds’]); HomePageController.php class HomePageController ..

Read more

I’m getting Trying to get property of non-object while trying to this code: //QuestController public function reward(Quest $quest){ $users = User::find($quest->accepter_id); $own = (auth()->user()); $quest = Quest::find($quest->id); $wallet = $users->wallet; //error started here $own_wallet = $own->wallet; $users->wallet = $wallet + $quest->reward; //here also $own->wallet = $own_wallet – $quest->reward; $quest->rewarded = true; $users->save(); $own->save(); $quest->save(); return ..

Read more

I am new to Laravel. I want to register new users using registerController. But when I try to register, it is showing error as unable to handle request. My registration form in blade.php as: <?php $res= DB::table(‘states’)->orderBy(‘name’,’asc’)->get(); ?> <form action="{{ $register_url }}" method="post" class="form-register"> @csrf <div class="row"> <div class="col-md-12"> <div class="input-group form-group"> <select name="role" class="form-control" ..

Read more

Here is my Controller class Mahasiswa extends Controller { public function index() { $data[‘judul’] = ‘Daftar Mahasiswa’; $data[‘mhs’] = $this->model(‘Mahasiswa_model’)->get_AllMahasiswa(); $this->view(‘templates/header’, $data); $this->view(‘mahasiswa/index’, $data); $this->view(‘templates/footer’); } } And this is my model class Mahasiswa_model { private $mhs = [ ]; public function getAllMahasiswa() { return $this->mhs; } } Error: Fatal error: Uncaught Error: Call to ..

Read more

i have a little problem. I do an E-commerce Website with Stripe. For my Success page i have an error No route found for "GET http://……….:8000//commande/merci/cs_test_b1YFH01tTs7d5uQplLjAzlx8KLtdhMgXITQIyAFmNhcvnjW1m21nChFX8u" This in my code in my StripeController : $checkout_session = Session::create([ ‘customer_email’ => $this->getUser()->getEmail(), ‘line_items’ => [ $productsForStripe ], ‘mode’ => ‘payment’, ‘success_url’ => $YOUR_DOMAIN . ‘commande/merci/{CHECKOUT_SESSION_ID}’, ‘cancel_url’ => ..

Read more

How do you access multiple functions from one controller in a laravel project routing file? Syntax will suffice thanks. These are the two routes I want to combine Route::get(‘openreports/chart’, ‘[email protected]’)->middleware(‘auth’)>name(‘openreports/chart’); Route::get(‘openreports/chart’, ‘[email protected]’)->middleware(‘auth’)->name(‘openreports/chart’); Sourc..

Read more

I’m trying to create a new post. If I pass the user_id from angular, the post is created without fail. However, if I use Auth::User()-> id or even just ‘2’ for instance, I get an {user_id: ["The user id field is required."]} public function store(CommentsRequest $request) { $id = Auth::user()->id; $comment = new Comment; $comment->fill($request->all()); ..

Read more