How to change Filamentphp Heroicon version?

Filamentphp is using Heroicon v1 as it says in the documentation.

But I wanted to change the version to v2. It wasn’t successful.

I installed the blade-ui-kit/blade-heroicons package and required it. Then I updated the composer.

"require": {
   "blade-ui-kit/blade-heroicons": "^1.2|^2.10",
}

The reason why I put ^1.2|^2.10 instead of ^2.10 for the version is that it gave me an error:

Problem 1
    - filament/forms[v2.16.0, ..., 2.x-dev] require blade-ui-kit/blade-heroicons ^1.2 -> found blade-ui-kit/blade-heroicons[1.2.0, 1.2.1, 1.3.0, 1.3.1] but it conflicts with your root 

But it still isn’t working.

PHP – Inserting multiple questions in the database, but only the first question is inserted

I’m working on prepared statements in PHP for the questions to fetch them in the front-end (I’m working with Reactjs). The issue is I put all 13 questions, together with their types in an array, prepared for insertion with foreach loop, only to see that the first question made it to the database, but this is not what I’m achieving, as the goal is to push all questions to the database and their types. The code and the result can be found down below.

$questions = array(
"How big is the company?" => "multiple-choice",
"Would you like to make a short description about the company/you?" =>  "input_field",
"Which is your target goal for the website solution?" =>  "multiple-choice", 
"How much is your annual budget?" => "input_field", 
"Do you have a website?" =>  "yes/no",
"What kind of website would you like/is your current website?" =>  "multiple-choice",
"How many pages do you need for the website?" => "multiple-choice",
"What works well on the website, and what not and would like to get fixed?" =>  
"input_field", 
"Would you like to help you with integrating your web solution in the market? (e.g. 
SEO)" =>  "yes/no", 
"Would you like to help you with integrating your web solution with other software?" =>  
 "yes/no",
"Is your website responsive? If not, we'll help you with offering a responsive design to 
the website" =>  "yes/no",
"What kind of additional services would you like to have implemented to the website?" =>  
"multiple-choice",
"Would you like to have the website available in english as well?" =>  "yes/no"
);



 try {

    foreach ($questions as $text => $type) {

        $db = _db();

        $q = $db->prepare("INSERT INTO questions(question_id, text, question_type) VALUES(:question_id, :text, :question_type)");
        $q->bindValue(":question_id", null);
        $q->bindValue(":text", $text);
        $q->bindValue(":question_type", $type);
        $q->execute();

        $id = $db->lastInsertId();
        $row = $q->fetchAll();

        if($row > 0) {
            header("Content-type: application/json");
            http_response_code(200);
            echo "Success";
            exit();
            
        } else {
            header("Content-type: application/json");
            http_response_code(200);
            echo "Failed to insert";
            exit();
        }

    }

The result each time I was trying to insert all the values

I’m working with PHP PDO, and the only solution might be the for loop, but I’m getting the “expected type ‘iterable|object’. Found ‘string’.” error. Thanks in advance.

Laravel Trait or extended class in regards of performance?

I wonder what is better to use in my specific case? I have built an extensive voting system that has to consider many cases. The function in which I find out the case (findCase()) is very long (>100 lines). In my service class I have other functions that refer to the output of the above function. Since my service class has now become very long, I would like to outsource the findCase() function. I am thinking of putting this function in an extra class or implementing a trait in the service class. I read in a definition of a trait that you only include traits in code that you use in different classes. In my case, however, this is not the case. I only need the function in the service class.

What would be the right approach? Trait, extended class, leave it as it is? In particular, I also have to consider the performance here.

Thanks for your time and help!

Doctrine tries to insert a null object Symfony 5.4

when i submit my form, I have two values ​​to choose from:
WorkPlanningDay and workPlanningHour.

if workplanninghour is specified, we insert a row in the workplanninghour table and vice versa

When I submit a workPlanningHour, I want to prevent doctrine from inserting a workPlanningDay object with null data. I tried to use a $form->remove but without success.

here is my request datas :

{"statuses":[6],"work_planning":1,"work_planning_hour":{"count_jrtt":1,"end_at":"31-12","jrtt":true,"lower_hour_jrtt":35,"nbr_jrtt":24,"start_at":"01-01","upper_hour_jrtt":39},"work_planning_period":0,"working_time_aspect":{"days":["MON","TUE","WED","THU","FRI"],"time":0,"weekly_hours":35}}

here is my form with my EventListener :

class WorkingTimeParametersRESTType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('work_planning', FieldChoiceType::class, array(
                'property_path'     => 'workPlanning',
                'required'          => true,
                'choices'           => WorkingTimeParameters::getAllowedWorkPlannings(),
            ))
            ->add('work_planning_period', FieldChoiceType::class, array(
                'property_path'     => 'workPlanningPeriod',
                'required'          => false,
                'choices'           => WorkingTimeParameters::getAllowedWorkPlanningPeriods(),
            ))
            ->add('working_time_aspect', WorkingTimeAspectType::class, array(
                'property_path' => 'workingTimeAspect',
                'required'      => true,
                'constraints'   => array(new Valid())
            ))
            ->add('work_planning_hour', WorkPlanningHourType::class, array(
                'property_path' => 'workPlanningHour',
                'required'      => true,
                'constraints'   => array(new Valid())
            ))
            ->add('work_planning_day', WorkPlanningDayType::class, array(
                'property_path' => 'workPlanningDay',
                'required'      => true,
                'constraints'   => array(new Valid())
            ))
            ->add('statuses', FieldCollectionType::class, array(
                'entry_type'    => CategoryIntegerType::class,
                'entry_options' => array(
                    'category_type' => Category::TYPE_STATUS,
                ),
                'allow_add'         => true,
                'allow_delete'      => true,
                'required'          => true,
                'error_bubbling'    => false,
            ))
            ->addEventListener(FormEvents::PRE_SET_DATA, array($this, 'onPreSetData'))
            ->addEventListener(FormEvents::SUBMIT, function (FormEvent $event) {
                /** @var WorkingTimeParameters $contract */
                $parameters = $event->getData();
                $form = $event->getForm();
//                dd($form->has('work_planning_day'));
                // Remove useless work planning
                
                if ($parameters->getWorkPlanning() == Contract::WORK_PLANNING_HOUR) {
                    $parameters->setWorkPlanningDay(null);
                    $form->remove('work_planning_day');
                   
                }
                else if ($parameters->getWorkPlanning() == Contract::WORK_PLANNING_DAY) {
                    $parameters->setWorkPlanningHour(null);
                    $form->remove('work_planning_hour');
                }
                else {
                    dd('rerer');
                    $form->remove('work_planning_day');
                    $form->remove('work_planning_hour');
                    $parameters->setWorkPlanningDay(null);
                    $parameters->setWorkPlanningHour(null);
                    $parameters->setWorkPlanningPeriod(null);
                }
            })

        ;
    }

    /**
     * @param FormEvent $event
     */
    public function onPreSetData(FormEvent $event)
    {
        $rttParameters = $event->getData();
        $form = $event->getForm();

        // The company can be set only on creation
        if (!$rttParameters || !$rttParameters->getId()) {
            $form->add('company', CompanyIntegerType::class, array(
                'required'  => true,
            ));
        }
    }

and here are the requests that doctrine is trying to launch :

INSERT INTO w2d_tm_work_planning_hour (startAt, endAt, jrtt, countJrtt, lowerHourJrtt, upperHourJrtt, nbrJrtt) VALUES ('1970-01-01 00:00:00', '1970-12-31 00:00:00', 1, 1, 35, 39, 24);


UPDATE w2d_tm_work_planning_day SET startAt = NULL, endAt = NULL, nbrDays = NULL, nbrJrtt = NULL WHERE id = 1;

how to do so that doctrine does not launch the second request with the null values ?

Livewire model binding while clicking other element

I have a very simple problem. Whenever I click on div I want the data binding to be applied to the file input.

<div>click me</div>
<input type="file" wire:model="photo"> <!-- while clicking on div, it should do the data binding to this file input  -->

I have been searching for it in the documentation but couldn’t find any clue. Is it possible to do that?

My accents are not interpreted in my WHERE clause and the UNISTR() function does not work

My query does not return anything when my query contains accents on the WHERE clause

The accents are the cause of the problem and I don’t know how to fix it.

I think that the encoding in UTF8 is not done, and the ORACLE UNISTR(”) method does not work.

The 2 queries return a result in ORACLE SQL DEVELOPER

This query works :

$database->Parse("SELECT
            ID_WORKSPACE_USERS,
            LOGIN_WORKSPACE_USERS,
            FONCTION_WORKSPACE_USERS
            FROM WORKSPACE_USERS 
            WHERE FONCTION_WORKSPACE_USERS = UNISTR('Job 1')"
        );

This query does not work (I don’t have any extra space in my database) :

$database->Parse("SELECT
            ID_WORKSPACE_USERS,
            LOGIN_WORKSPACE_USERS,
            FONCTION_WORKSPACE_USERS
            FROM WORKSPACE_USERS 
            WHERE FONCTION_WORKSPACE_USERS = UNISTR('Job é')"
        );

403 error while posting a particular string

Today, I am facing a weird problem.
I am getting 403 forbidden error while posting ajax data to a PHP file.
An error occurs for a specific string while posting via ajax call.

Error params and string

temp_name: Reminder (WITH OPTION TO confirm)

No error for the below string [same string without space before ( ]

temp_name: Reminder(WITH OPTION TO confirm)

If we remove the space before the open bracket, it’s working fine. Otherwise, it throws 403 forbidden as Ajax response.

403 Forbidden

In PHP, I am just getting the post value as

$temp_name=!empty($_POST['temp_name'])?$_POST['temp_name']:'';

Unable to find the cause of the error. Please suggest any idea to fix it.

WordPress Custom Sharebutton for LinkedIn

I developed a custom plugin for wordpress, to post different types of posts. At the end of each post I want to add a sharebutton programaticaly for LinkedIn. The og:propertys are not working for me. So I want to make a custom sharebutton.

I want to specify the image, title and description individually. How can I create such a sharebutton??

Thanks in advance

Website architecture : Vue.js + Firebase, does it need PHP? [closed]

I need to create a simple website : signup/login, products list, product detail with photo, back-office.

I want use Firebase with Authentification and Firestore Database. I maybe would like to be able to replace this Firebase layer with my own back-end if I want to in the future.

My questions are : Do I really need to use PHP? For a site using Firebase as a back-end, everything seems to me to be done on the front side in JS. Is it a good idea? So I’m thinking of using a js framework, like vue.js maybe. looks good? Or do I have to use a PHP framework and retrieve my Firebase data in PHP?

How to get an error about an unsent message

I have a form that submits using AJAX and wp_mail(). I insert the form on the page using a shortcode. Now the problem is that even if the message is not sent, it still shows a message about successful sending. I wanted to bind to the response, but there I receive data in the form:
Response data in console

How do I process my response so that the form about successful submission is not shown if there is an error during validation?

add_shortcode('contact-form', 'display_contact_form');

function display_contact_form()
{

    $validation_messages = [];

    if (isset($_POST['contact_form'])) {

        //Sanitize the data
        $full_name = isset($_POST['full_name']) ? sanitize_text_field($_POST['full_name']) : '';
        $email     = isset($_POST['email']) ? sanitize_text_field($_POST['email']) : '';
        $message   = isset($_POST['message']) ? sanitize_textarea_field($_POST['message']) : '';

        //Validate the data
        if (strlen($full_name) === 0) {
            $validation_messages[] = esc_html__('Please enter a valid name.');
        }

        if (
            strlen($email) === 0 or
            !is_email($email)
        ) {
            $validation_messages[] = esc_html__('Please enter a valid email address.');
        }

        if (strlen($message) === 0) {
            $validation_messages[] = esc_html__('Please enter a valid message.');
        }

        //Send an email to the WordPress administrator if there are no validation errors
        if (empty($validation_messages)) {

            $mail    = get_option('admin_email');
            $subject = 'New message from ' . $full_name;
            $message = $message . ' - The email address of the customer is: ' . $mail;

            wp_mail($mail, $subject, $message);
        }
    }

    //Display the validation errors
    if (!empty($validation_messages)) {
        foreach ($validation_messages as $validation_message) {
            echo '<div class="validation-message">' . esc_html($validation_message) . '</div>';
        }
    }
?>

    <!-- Echo a container used that will be used for the JavaScript validation -->
    <div id="validation-messages-container"></div>

    <form id="contact-form" action="<?php echo esc_url(get_permalink()); ?>" method="post">
        <input type="hidden" name="contact_form">
        <div class="input-wrapp">
            <input type="text" id="full-name" name="full_name" placeholder="Name">
        </div>
        <div class="input-wrapp">
            <input type="text" id="email" name="email" placeholder="Email">
        </div>
        <div class="input-wrapp">
            <textarea id="message" name="message" placeholder="Write something..."></textarea>
        </div>
        <button type="submit" id="contact-form-submit">
            <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path fill-rule="evenodd" clip-rule="evenodd" d="M1.81818 4.85279L9.39603 11.5887C9.74047 11.8948 10.2595 11.8948 10.604 11.5887L18.1818 4.85279V15.4547C18.1818 15.9567 17.7748 16.3637 17.2727 16.3637H2.72727C2.22519 16.3637 1.81818 15.9567 1.81818 15.4547V4.85279ZM3.1865 3.63647H16.8134L9.99995 9.69288L3.1865 3.63647Z" fill="white" />
            </svg>
            Submit Message
        </button>
    </form>

    <div id="success-messages-container"></div>
<?php

}

add_action('wp_ajax_display_contact_form', 'display_contact_form');
add_action('wp_ajax_nopriv_display_contact_form', 'display_contact_form');
$("#submit").click(function (event) {
    event.preventDefault();
    var userName = $("#full-name").val();
    var userEmail = $("#email").val();
    var userMessage = $("#message").val();
    var formData = $("#contact-form").val();
    $.ajax({
      type: "POST",
      dataType: "html",
      url: "/wp-admin/admin-ajax.php",
      data: {
        action: "display_contact_form",
        contact_form: formData,
        full_name: userName,
        email: userEmail,
        message: userMessage,
      },
      success: function (response) {
        console.log(response);
        $("#success-messages-container").append(
          "<p>Your message has been successfully delivered</p>"
        );
      },
    });
  });

DOM is no longer supported because it suddenly stopped working?

I made my page year ago and i retrieve the code from another website

Can anyone tell me why it suddenly stopped working, I haven’t made any changes to the site for a year?

Here is my code

<?php
require ('php/simple_html_dom.php');

$html = file_get_html ("https://www.aviationweather.gov/metar/data?ids=epkk");

echo $html->find("code",0)->innertext;

?>