i wanted to display id,FileName & FilePath from Files table and id & name from User table along with the course table columns. But it is returning null from both files & user relations.How can i fix this? $course=Course::with([‘files:id,FileName,FilePath’,’user:id,name’]) ->select(‘id’,’courseDisplayName’,’aboutCourse’) ->where(‘userId’,$request->tutorId) ->get(); Course Model public function files() { return $this->belongsTo(Files::class, ‘fileId’, ‘id’); } public function ..

Read more

I had tried using this php code (filename: loginExe.php) <?php session_start(); include("../conn.php"); extract($_POST); $selAcc = $conn->query("SELECT * FROM examinee_tbl WHERE exmne_email=’$username’ AND exmne_password=’$pass’ "); $selAccRow = $selAcc->fetch(PDO::FETCH_ASSOC); if($selAcc->rowCount() > 0) { $_SESSION[‘examineeSession’] = array( ‘exmne_id’ => $selAccRow[‘exmne_id’], ‘examineenakalogin’ => true ); $res = array("res" => "success"); } else { $res = array("res" => "invalid"); } ..

Read more

I got error that says Method AppHttpControllersFrontendAtributAtributDashboardController::deleteData/{id} does not exist. I write my routes like this : Route::group([ ‘prefix’ => ‘atribut’, ‘as’ => ‘atribut.’ ], function () { Route::group([‘prefix’ => ‘tabHome’, ‘as’ => ‘tabHome.’], function () { Route::get(”, [AtributDashboardController::class, ‘showTab’])->name(‘showTab’); Route::post(”, [AtributDashboardController::class, ‘addData’])->name(‘addData’); Route::get(”, [AtributDashboardController::class, ‘deleteData/{id}’])->name(‘deleteData’); }); in the controller i also already write these ..

Read more

I’m new to PHP and currently learning namespace and trait. I have the following simple classes <?php namespace traits; trait CoffeeTrait { public function makeCoffee() { echo static::class . ‘ is making latte’ . PHP_EOL; } } <?php namespace traits; class CoffeeMaker { use CoffeeTrait; } <?php require_once ‘CoffeeMaker.php’; use traitsCoffeeMaker; // $object = new ..

Read more

When sending data, an empty value comes in Yii2, why is that? Data post: id, name. JS let is = document.querySelector(“meta[name=’csrf-token’]”).content, ss = document.querySelector(“meta[name=’csrf-param’]”).content; fetch(“http://site.se/react/save-babysitter”, { method: “POST”, headers: { “Content-Type”: “application/json”, “Accept”: “application/json”, “csrf-param”: ss, “X-CSRF-Token”: is }, body: JSON.stringify({ ‘id’: e.id, ‘name’: this.state.ChangeName }) }).then(response => response.json()) .then((data) => console.log(data)); PHP public function ..

Read more

I am using coupon urls for Woocommerce that I have enabled with this function: function coupon_links(){ if (!function_exists(‘WC’) || !WC()->session) { return; } $query_var = apply_filters(‘woocommerce_coupon_links_query_var’, ‘gutschein’); if (empty($_GET[$query_var])) { return; } WC()->session->set_customer_session_cookie(true); if (!WC()->cart->has_discount($_GET[$query_var])) { WC()->cart->add_discount($_GET[$query_var]); } } add_action(‘wp_loaded’, ‘coupon_links’, 30); add_action(‘woocommerce_add_to_cart’, ‘coupon_links’); Now, when I send the link "www.mysite.com/?gutschein=SALE" for example, the coupon ..

Read more

I’m using Laravel with Sweetalert and I tried to show a custom popup message which is showing a value of Laravel variable: $(document).on(‘click’, ‘#custombtn’, function(e) { e.preventDefault(); let form = $(this).parents(‘form’); swal( { title: "Alert!", text: "Youre wallet balance is: {!! digits2persian(json_decode($user_wallet->balance)) !!}", type: "warning", allowEscapeKey: false, allowOutsideClick: false, showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes", ..

Read more

I have code to get some data (terms = page1) built with WordPress. Currently, the data of page1 is acquired like "’terms’ =>’page1’" and displayed on XXX.jp/case/page1 page. I want to branch this data acquisition code for each category page (for example, in the case of page2, I want to acquire the data of page2). ..

Read more