Why every time I run PHP Artisan Serve it appears like the dashboard that I gor this from where?

This is my first time use laravel blade and composer, i am so confuse after i run php artisan serve When I enter the http://localhost:8000/news that should appear the display of the code I wrote in news.blade.php but when I run it out as shown in this below
enter image description here

Anyone can explain me what is this and why this is appear after i run php artisan serve.
this is what CMD looks like after running php artisan serve.
enter image description here

WooCommerce: Which hooks affect anything about product?

I am developing a plugin for WooCommerce that sends available products to a third party advertising server; The server requires every product information (including title, description, categories, etc…) and product stock value and price. The goal is to use other parties to act as an alternative marketplace, therefore those markets should be aware of the product information, price and stock quantity.
The problem is I don’t know which hooks affect these data so that I can notify the advertising server with newest information. I need every hook and by every hook I mean ALL of the hooks (Adding a product, modifying a product, deleting a product, changing a product stock or price, selling a product, reserving a stock for an end-user in checkout process, everything that affects product info or price or stock)
I’ve checked WooCommerce docs but there are so many hooks with confusing names and many of them do not have usage description. I even looked up in chat GPT but many answers where old and the remaining were insufficient.

Arabic letter have different shapes when search in php mysql all result do not appear

i have problem in search
arabic letter have different shapes for one letter like

أ  إ  ا
ي ى
ه ة

all these letters have different unicode
i want to union search when enter letter like (ا)the query must get all word contain
all other shape of (ا) (أ-إ-ا)

i make input field with id search

$search = $_POST['search'];
$stmt = $con->prepare("select * from `newdrs` 
INNER JOIN `district` ON newdrs.prosec=district.DistCode
INNER JOIN `case_kind` ON newdrs.case_kind=case_kind.id
where accused_names like'%$search%' ");
$stmt->execute();
$employee_details = $stmt->fetchAll(PDO::FETCH_ASSOC);

i want to search with one letter shapes and get all other shame

أحمد
احمد
إحمد

PHPMailer can work on GitHub pages and vercel [closed]

PHPMailer can work on GitHub pages and vercel

i want have created a contact form but i want to add logic but i see PHPMailer is great option but my website hosted on GitHub to Vercel then PHPMailer(i uploaded code on private repository on GitHub and connect to vercel account to make my website live on Internet) can on it

Neither the property “patient” nor one of the methods in joining tables Symfony 6

I am trying in Symfony 6 to join two tables by one relational column, where one table has OneToMany relation to the other.

This is my controller logic

#[Route('/admin/patients', name: 'app_patients')]
public function patients(PatientsRepository $patients, EntityManagerInterface $entityManager): Response
{

    $query = $entityManager->createQuery(
        'SELECT patients, patientsInfo
    FROM AppEntityPatients patients
    JOIN AppEntityPatientsInformation patientsInfo
    WHERE patientsInfo.patientID = patients.id'
    );


    $data = $query->getResult();

    return $this->render('main/tables.html.twig', ['data' => $data]);
}

my twig template

                                {% for item in data %}
                                <tr>
                                    <td>{{ item.patient.id }}</td>
                                    <td><i class="fas fa-user-nurse fs-5"></i> {{ item.patient.name }}</td>
                                    <td>{{ item.patientsInfo.nationality }}</td>
                                    <td>{{ item.patient.unhcrID }}</td>
                                    <td>No</td>
                                    <td>{{ item.patient.creationDate|date('Y-m-d') }}</td>
                                    <td>None</td>
                                    <td>
                                        <a class="btn btn-primary" role="button">More</a>
                                        <a class="btn btn-danger" role="button">Delete</a>
                                    </td>
                                </tr>
                            {% endfor %}

The error it throws is

Neither the property “patient” nor one of the methods “patient()”, “getpatient()”/”ispatient()”/”haspatient()” or “__call()” exist and have public access in class “AppEntityPatients”.

how to get value from inside a variable

In my code, the result of total_tax_1 is 0 even tho there are any value stored in tax1_amount.

public function store(Request $request)
{
    $sum_sub_total          = (@count($request->warehouse_details)>0 ? array_sum(array_column($request->warehouse_details,'dpp_subtotal')) : 0);
    $total_taxes            = 0;
    $totalTax1              = array_sum(array_column($request->warehouse_details,'tax1_amount'));
    $totalTax2              = 0;
    //...

    if($request->is_use_tax == 1){
        $tax = Tax::find($request->id_tax);
        $totalTax2 = ($sum_sub_total * $tax->percentage);
    }
    $total_taxes = $totalTax1 + $totalTax2;

    $data_wh = [
        //...
        'total_tax'                 => $total_taxes,
        'total_amount'              => $sub_total_after_disc + $total_taxes,
        //...
        'total_tax_2'               => $totalTax2,
        'total_tax_1'               => $totalTax1,
    ];

    $warehouse_details = [];

    //create list Wh Detail
    $i = 0;
    foreach($request->warehouse_details as $wh_detail){
        //...
        $tax_per_row = 0;
        if($sub_total_after_disc != 0){
            $tax_per_row = (($wh_detail['subtotal'] - $disc_item) / $sub_total_after_disc) * $total_taxes;
        }

        $pph22Amount = 0;
        $pph22Rate = 0;
        //..
        $pph22Amount = MyHelper::processTax($amount, $wh_detail['id_pph22'], TransType::$TO_PURCHASE_INVOICE);
        //...
        $data['sub_total_tax']              = $tax_per_row;
        //...
        $data['tax1_amount']                = $tax1_amount;
        array_push($warehouse, $data);
    }

    //create Wh
    $warehouse = Warehouse::create($data_wh);
    if(!$warehouse){
        DB::rollBack();
        return response()->json(false);
    }
    //create Wh Detail
    $create_wh_detail = $warehouse->warehouse_details()->createMany($warehouse_details);
    if(!$warehouse_details_check){
        DB::rollBack();
        return response()->json(false);
    }
    
    //...
}

I want to get the value from tax1_amount and save it into the variable $totalTax1 so I can use it when creating warehouses and warehouse_details. Is there any solution other than moving the create flow? Because I have my own reasons for creating warehouses first

Why this php function has two variable-length parameters?

From the manual Variable-length argument lists, there should only be one variable-length parameter as the last parameter of a function.

But why this opentelemetry-php api function:return $c(...$a, ...($a = [])); has two?

function trace(SpanInterface $span, Closure $closure, iterable $args = [])
{
    $s = $span;
    $c = $closure;
    $a = $args;
    unset($span, $closure, $args);

    $scope = $s->activate();

    try {
        /** @psalm-suppress InvalidArgument */
        return $c(...$a, ...($a = []));
    } catch (Throwable $e) {
        $s->setStatus(StatusCode::STATUS_ERROR, $e->getMessage());
        $s->recordException($e, ['exception.escaped' => true]);

        throw $e;
    } finally {
        $scope->detach();
        $s->end();
    }
}

Which php.ini file is loaded for octane with Roadrunner in Laravel?

I have installed Octane server with Roadrunner and I have a request which have more than 1000 lines of request payload which was even a problem in php-fpm. I could adjust the value in the php.ini file for the key max_input_vars and the problem was solved. Now since I am using the Octance server, I am not sure how to customize the php.ini settings.

DataTables AJAX Performance: Data Takes Too Long to Load

I’m using the DataTables library in the back office of my website to display dynamic tables of data. While everything is working correctly, the data loading time is excessively long. I’m using the AJAX option to retrieve the data, but it takes at least 5 seconds to display.

var table = $('#myTable').DataTable({
  ajax: '../../api/adminConsulter.php'
});

Analyzing the browser console, I found that loading libraries takes about 1.3 seconds, while the actual data loading takes 5.11 seconds. Intriguingly, the script that sends data in JSON format loads in milliseconds when opened directly (without AJAX request) and I don’t have that much to load (around 500 rows which represent 480kb).

I’ve examined the browser console to identify bottlenecks. Loading libraries takes time, but it’s not the sole issue.

I observed that the script sending data in JSON is fast when opened directly, ruling out script-related problems.

Any suggestions on how to improve the data loading time with DataTables using the AJAX option?

symfony, var-folder as symlink does not work on apache due to wrong vendor-includes

I have an empty symfony, installed via composer.json, apache-pack and api-platform included (see file below).

Environment

We need to offer the var-folder as a symlink.

  • App-Folder: /app
  • Var-Folder: /contents/var

The app-folder structure results in:

[...] 
templates 
var -> /contents/var 
vendor

Problem

Symfony creates classes in var/cache, which include vendor-classes like this:

include_once dirname(__DIR__, 4).'/vendor/symfony/kernel/ErrorHandler.php';

The problem is, that __ DIR __ returns the source-path of the symlink, not the target app-path, so the class cannot be found:

Warning: include_once(/contents/vendor/symfony/kernel/ErrorHandler.php): Failed to open stream: No such file or directory

So it says vendor is in
/contents/vendor instead of
/app/vendor

If DIR would return the app-path, everything would be fine:
/app/vendor/symfony/kernel/ErrorHandler.php

Question

Does anybody know how to solve this? It is NOT possible to change the environment due to a gitlab-setup which can’t be changed by us.

composer.json

{
    "type": "project",
    "license": "proprietary",
    "minimum-stability": "stable",
    "prefer-stable": true,
    "require": {
        "php": ">=8.1",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "api-platform/core": "^3.2",
        "doctrine/doctrine-bundle": "^2.10",
        "doctrine/doctrine-migrations-bundle": "^3.2",
        "doctrine/orm": "^2.16",
        "nelmio/cors-bundle": "^2.3",
        "phpdocumentor/reflection-docblock": "^5.3",
        "phpstan/phpdoc-parser": "^1.24",
        "symfony/apache-pack": "^1.0",
        "symfony/asset": "6.3.*",
        "symfony/console": "6.3.*",
        "symfony/dotenv": "6.3.*",
        "symfony/expression-language": "6.3.*",
        "symfony/flex": "^2",
        "symfony/framework-bundle": "6.3.*",
        "symfony/property-access": "6.3.*",
        "symfony/property-info": "6.3.*",
        "symfony/runtime": "6.3.*",
        "symfony/security-bundle": "6.3.*",
        "symfony/serializer": "6.3.*",
        "symfony/twig-bundle": "6.3.*",
        "symfony/validator": "6.3.*",
        "symfony/yaml": "6.3.*"
    },
    "require-dev": {
        "symfony/maker-bundle": "^1.51"
    },
    "config": {
        "allow-plugins": {
            "php-http/discovery": true,
            "symfony/flex": true,
            "symfony/runtime": true
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\Tests\": "tests/"
        }
    },
    "replace": {
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php72": "*",
        "symfony/polyfill-php73": "*",
        "symfony/polyfill-php74": "*",
        "symfony/polyfill-php80": "*",
        "symfony/polyfill-php81": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": "true",
            "require": "6.3.*"
        }
    }
}

CSRF Token Mismatch in Laravel 10 Jquery AJAX

P.S: I have seen the CSRF Token mismatch answers from many in Stackoverflow and I tried them all.
My problem didn’t solved with all the existing answers. So, I had to ask a new question again.

I am using Laravel 10 with PHP 8.x and jQuery AJAX.

in my app.blade.php, I added

<!-- CSRF Token -->
  <meta name="csrf-token" content="{{ csrf_token() }}"> 

in my resourcesjsbootstrap.js

$.ajaxSetup({
    headers: {
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
    } 
});

in my blade

<script>
let data = { '_token': $('meta[name="csrf-token"]').attr('content') }
//Already tried '_token': "{{ csrf_token() }}"
$.ajax({
                    type: "POST",
                    url: url,
                    data: data,
                    headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
                    contentType: "application/json",
                    dataType: "json",
                    success: function(text) {}
})
</script>

In my response,

enter image description here

Can someone help me out fixing this issue.

how to hide resource for particular user in filament?

I’m trying to create a website that have two interface one for admin and other for users. So, for that I want that the resource panel in navigation bar/sidebar was visible to only admin/id==1, Resources like studentresource. Detail like Users login i don’t want to show to all users that who was login.

I’m expecting to hide the resources panel for all users except id==1/admin or create two whole panel the one panel for user and other for admin.

Captcha integration issues to contact form

I want to use captcha in the contact section of my website to get rid of spam messages. When I add the captcha codes I found to the contact form, the message is sent, but the captcha does not work. If I close the action section of the contact form, the captcha works and the mail does not go. If I open the action line of the contact form, this time it conflicts with the action of the captcha code and the captcha does not work.

Contact form codes

<article id="content" style="padding:0px 0px 5px 0px;">
  <header class="module-a" style="padding-left: 10px;">
    <h2>Contact Information</h2>
  </header>
  
</article>
<article id="content" class="cols-b">
  <form  onSubmit="return submitForm();" action="contact-mail-action.php" method="post" class="form-b" name="homefrm1" id="homefrm1">
  <input type="hidden"  name="event" value="start" />
  <fieldset>
  <div class="container">
  <legend>Send us a message</legend>
  <form method="POST" action="">
    <div class="form-group">
      <label for="adsoyad">Name-Surname</label>
      <input type="text" class="form-control" name="adsoyad" id="adsoyad" required>
    </div>
    <div class="form-group">
      <label for="email">E-Mail</label>
      <input type="email" class="form-control" name="email" id="email" required>
    </div>
    <div class="form-group">
      <label for="konu">Subject</label>
      <input type="text" class="form-control" name="konu" id="konu" required>
    </div>
    <div class="form-group">
      <label for="mesaj">Message</label>
      <textarea class="form-control" name="mesaj" id="mesaj" rows="3" required></textarea>
    </div>
    <input type="hidden" name="islem" value="gonder" required>
    <button type="submit" class="btn btn-primary">Send</button>
    </fieldset>
  </form>
  <aside>
    <h3>Location</h3>
    <iframe src="https://www.google.com/maps/embed?pb=!1m17!1m12!1m3!1d658.4309168065989!2d32.00941005065839!3d36.54806161318423!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m2!1m1!2zMzbCsDMyJzUzLjYiTiAzMsKwMDAnMzUuOSJF!5e0!3m2!1str!2str!4v1699341329906!5m2!1str!2str" width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
  </aside>
</article>
     

Captcha codes

<?PHP

$image = @imagecreatetruecolor(120, 30) or die("hata oluştu");

// arkaplan rengi oluşturuyoruz
$background = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
imagefill($image, 0, 0, $background);
$linecolor = imagecolorallocate($image, 0xCC, 0xCC, 0xCC);
$textcolor = imagecolorallocate($image, 0x33, 0x33, 0x33);

// rast gele çizgiler oluşturuyoruz
for ($i = 0; $i < 6; $i++) {
    imagesetthickness($image, rand(1, 3));
    imageline($image, 0, rand(0, 30), 120, rand(0, 30), $linecolor);
}

session_start();

// rastgele sayılar oluşturuyoruz
$sayilar = '';
for ($x = 15; $x <= 95; $x += 20) {
    $sayilar .= ($sayi = rand(0, 9));
    imagechar($image, rand(3, 5), $x, rand(2, 14), $sayi, $textcolor);
}

// sayıları session aktarıyoruz
$_SESSION['
captcha
'] = $sayilar;

// resim gösteriliyor ve sonrasında siliniyor
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
?>

Captcha control codes

<!doctype html>
<html lang="tr">
<head>
    <meta charset="UTF-8">
    <title>CAPTCHA</title>
    <style>
        body {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }
    </style>

</head>
<body>

<br>

<strong>
    Robot olmadığınızı kanıtlamak için görseldeki metni yazın
</strong>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <div style='margin:15px'>
        <img src="captcha.php" id="capt">
        <input type=button onClick=reload(); value='Tekrar Yükle'>
    </div>


    <input type="text" name="deger"/>
    <input type="submit" value="Giriş" name="submit"/>
</form>

<div style='margin-top:5px'>
    <?php

    session_start();
    // Kullanıcı bir captcha verdiyse!
    if (isset($_POST['deger']))

        // Captcha geçerliyse
        if ($_POST['deger'] == $_SESSION['captcha'])
            echo '<span style="color:green">BAŞARILI</span>';
        else
            echo '<span style="color:red">
CAPTCHA 
BAŞARISIZ!!!</span>';
    ?>
</div>


<script type="text/javascript">
    function reload() {
        img = document.getElementById("capt");
        img.src = "captcha.php"
    }
</script>

</body>
</html>

symfony console make:auth keeps creating a custom authenticator

i created a Symfony 6 Application, but Forms Authentication keeps returning “Invalid Credentials”.

First i tried to follow the Documentation to implement a simple Form Login.
But i always get “Invalid Credentials” when i try to authenticate that user.

Then i tried the make:auth command so it might create stuff im probably missing but even if i select Option one for a Login Form Authenticator it keeps creating a Custom Authenticator.
But i dont need anything Custom, just simple Forms Authentication.

So how do i use the Basic Forms Authenticator or create it with the console?