firebase FCM messages for apple devices not working with php

I created the p8 file in apple developer page. and integrated all the necessary steps for firebase push notifications with flutter.

When i try to send the notification from firebase console. the message shows in the app. but if try with the PHP FCM code the notification not arrives. but the curl request returns success.

I have spend more than 2 days to find the solution. please help me to rectify this issue.

Firebase Console

enter image description here

FCM code in PHP

$serverKey = '150 characters server key';
$url = 'https://fcm.googleapis.com/fcm/send';
$fields = array(
    'registration_ids' => [
        "dwUpMuQLfU1DtoVJtP9MF8:APA91bHLxdctbSvx-7e1YZTPwq6I0_A_lVpyTH5F6jLeIlnsmsdD_D6cqkym6XRoYOhCT6JYhubzaYmytb3P5Wyv6rJCR3FBDjpu0YIH803b0bl7eKEq3egdbXRUkH6PQzHkcelCGaEW",
        "ea2RfrXsT7CA51U0ZCLMqR:APA91bEcnGd69w8crkGx8MAVUsNbZqBScaNkgEmOuck-fKb0vYqtm741z9D3u0pSgVjQLxJG__8GAQzRQvTGYzaY6ve7WoPF7xGZozoOpnxHkTyMpRsLtCcML5XVNVvS-Me3A4MhjiaG"
    ],
    'data' =>  array(
        "message" => "Test Message",
        "title" => "Admin Responded to your Grievance",
        "time" => strtotime($date) * 1000,
        "type" => "notification",
        "message" => "Test Message",
        "time" => strtotime($date) * 1000,
        "sound" => "default",
    )
);
$fields = json_encode($fields);
$headers = array(
    'Authorization: key=' . $serverKey,
    'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
$result = curl_exec($ch);
curl_close($ch);
print_r($result);

How to update other fields but retain the user profile image

I want to update the User first_name or last_name but not the profile image

here is my profile controller:

    /**
     * Update the user's profile information.
     */
    public function update(ProfileUpdateRequest $request): RedirectResponse
    {
        $path = null;
        $request->user()->fill($request->validated());

        if ($request->user()->isDirty('email')) {
            $request->user()->email_verified_at = null;
        }

        if ($request->hasFile('image_path')){
            $path = $request->image_path->store('avatar', 'public');
        }else{

        }

        $request->user()->image_path = $path;
        $request->user()->save();

        return Redirect::route('profile.edit')->with('status', 'profile-updated');
    }

here is my profile update controller:

class ProfileUpdateRequest extends FormRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, IlluminateContractsValidationRule|array|string>
     */
    public function rules(): array
    {
        return [
            'first_name'        => ['string', 'max:255'],
            'last_name'         => ['string', 'max:255'],
            'email'             => ['email', 'max:255', Rule::unique(User::class)->ignore($this->user()->id)],
            'image_path'        => 'required|file|mimes:jpeg,png,jpg|max:2048',
        ];
    }
}

Problems with mass-delete button

By checking the actions of the website https://inguna-preize.000webhostapp.com/index.php in http://165.227.98.170/
errors appeared and I don’t know what needs to be changed so that these do not appear
this picture contains the relevant error

I tried to wait for the “.delete-checkbox” element to become invisible on the page using the waitForInvisible function. I expected the element to become invisible within 4 seconds as specified in the wait time. However, even after waiting for 4 seconds, the element remained visible on the page. This resulted in an error stating that the element was still visible after the specified wait time of 4 seconds.

Comment resoudre cette erreur en sachant que j’utilise la focntion PDO pour me connecter à la base de données

Erreur fatale : Uncaught TypeError : mysqli_real_escape_string() : L’argument #1 ($mysql) doit être de type mysqli, PDO donné dans /opt/lampp/htdocs/Login/verification.php:14 Stack trace : #0 /opt/lampp/ htdocs/Login/verification.php(14): mysqli_real_escape_string(Object(PDO), ‘AugustinM’) #1 {main} jeté dans /opt/lampp/htdocs/Login/verification.php sur la ligne 14

j’ai essaiyé avec la fonction PDO ça n’a pas marché

Target class [AppHttpControllersApiV1AppHttpControllersApiV1CustomerController] does not exist. (using apiResource function -> laravel)

I am getting class [] does not exist error.
enter image description here

i am providing the codes of all the different folders below:

api.php:

<?php

use AppHttpControllersApiV1CustomerController;
use AppHttpControllersApiV1InvoiceController;
use IlluminateHttpRequest;
use IlluminateSupportFacadesRoute;

Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
    return $request->user();
});

Route::group(['prefix' => 'v1', 'namespace' => 'AppHttpControllersApiV1'], function(){
    Route::apiResource('customers', CustomerController::class);
    Route::apiResource('invoices', InvoiceController::class);
});


CustomerController.php

<?php
namespace AppHttpControllersApiV1;
use AppModelsCustomer;
use AppHttpRequestsStoreCustomerRequest;
use AppHttpRequestsUpdateCustomerRequest;
use AppHttpControllersController;
class CustomerController extends Controller
{
    public function index()
    {
        return Customer::all();
    }
}

Help me to figure out this error I am a beginner in laravel and did tried different solutions to solve the problem but couldn’t resolve the issue. Please do let me know if any other files are required for validation.

Learning Path for Full-Stack Web Development with React.js, PHP (Laravel), and Laravel Framework Integration [closed]

I’m a student in a web development bootcamp, seeking guidance on the best learning path for full-stack web development. In our capstone project, we are required to use Laravel as the backend framework. However, I’m keen on incorporating React.js into the frontend alongside Laravel, and I need help understanding how to effectively combine these technologies.

As a newbie, I have a basic understanding of HTML, CSS, and JavaScript. Currently, I have set up a React app using Vite and connected it to a MySQL database via XAMPP. Moreover, I am utilizing Laravel for server-side operations.

To start with a strong foundation, I prefer the conventional approach to learning the basics of Laravel. However, I also want to explore alternative approaches, such as my current setup, as I progress.

I would greatly appreciate recommendations for a learning path that combines React.js, PHP (Laravel), and the Laravel framework. Specifically, I’m interested in areas such as API development, database integration, and user authentication. Additionally, I’m curious about the real-life benefits and employment opportunities associated with this tech stack after completing the bootcamp.

Thank you in advance for your valuable insights!

How to push the array inside the $args[‘date_query’] in WordPress

I’m getting the $years as input from the user. It will have one year value or multiple based on that I’ve to add to $args query how to add that below is my code. Which returns only 1st element years post.

if ( !empty($years) ) {
    foreach($years as $year):
        $args['date_query'] = array(
            'relation' => 'OR',
            array( 'year' => $year),
        );
    endforeach;
}

$years will have the values like

$years = array(2022,2023); 

Expected output should be

$args['date_query'] = array( 
    'relation' => 'OR', 
     array( 'year' => 2022), 
     array( 'year' => 2023), 
);

PHP: Match URL and Fetch HTML of All Pages of an External Domain

I am using the following PHP code to fetch HTML from a website using file_get_contents URL, but only the front page. Now I want to map all the URLs and fetch all the requested pages without saving them in a database. It’s like coloning the whole www.theidioms.com domain with www.theidioms.in and replacing the permalinks using str_replace(). The purpose of the script is to create multiple language domains.

<?php
$url = file_get_contents('https://www.theidioms.com/');

 echo  str_replace(array(
     'The Idioms Dictionary explains common English idioms that are popular worldwide, especially in the United States, Canada, the United Kingdom, Australia, Singapore, and New Zealand.',
     'International',
     'Global Site',
     'Our locations',
     'globally',
     'worldwide',
     '<ul><li>United States</li><li>Canada</li><li>United Kingdom</li><li>Australia</li><li>New Zealand</li><li>Singapore</li></ul>',
     ' lang="en"',
     '<link rel="canonical" href="https://www.theidioms.com/" />',
     'fulfill',
     ),
     array(
     'Theidioms.in Dictionary explains common English idioms that are popular in India and the Indian subcontinent.',
     '(India)',
     'India',
     'Location',
     'in India',
     'in India',
     '<h4>We love India.</h4>',
     ' lang="en-in"',
     '<link rel="canonical" href="https://theidioms.in/" />',
     'fulfil',
     ),
     
     $url);
?>

How to create custom setting page for WordPress plugin?

How I can print the value for Input form in PHP?

I’m trying to create a setting page for my WordPress plugin, and I have this code to add Input field in this setting page

function wprw_settings_init() {

    // Setup settings section
    add_settings_section(
        'wprw_settings_section',
        'wprw Settings Page',
        '',
        'wprw-settings-page'
    );

    // Registe input field
    register_setting(
        'wprw-settings-page',
        'wprw_settings_input_field',
        array(
            'type' => 'string',
            'sanitize_callback' => 'sanitize_text_field',
            'default' => ''
        )
    );

    // Add text fields
    add_settings_field(
        'wprw_settings_input_field',
        __( 'Input Field', 'wprw' ),
        'wprw_settings_input_field_callback',
        'wprw-settings-page',
        'wprw_settings_section'
    );
}
add_action( 'admin_init', 'wprw_settings_init' );


/**
 * txt tempalte
 */
//
function wprw_settings_input_field_callback(){
    
    // validate and update clink_countdown_duration value
    
    $wprw_input_field = get_option('wprw_settings_input_field');
    if( !is_numeric( $wprw_input_field ) ){
        update_option( 'wprw_settings_input_field', $value = 10 );  
        $wprw_input_field = get_option('wprw_settings_input_field');
    }
    
    ?>
        <input type="number" name="duration-time" id="wprw_settings_input_field" value="<?php echo $wprw_input_field; ?>" />

        <p class="description clink-description"><?php _e('Enter the redirect countdown duration in seconds (example : 20). In default it set to 10 (seconds).','wprw'); ?></p>
    <?php
}

When I add a number in this field I want to print this number in another page (Just the number). I tried this code <?php echo wprw_settings_input_field_callback($wprw_input_field); ?> but it’s print all form design. How I can print the input value only?

If a PDF download contains ‘set’ in file name change shortcode – WooCommerce downloadable product

If a downloadable PDF has ‘set’ in its filename I would like to replace a shortcode with ‘set(s)’ and if it doesn’t I would like to replace it with ‘print(s)’.

I have managed to get the code below working when there is just one downloadable PDF in a variation but when there are multiple PDFs downloaded the first file is used to determine the outcome of every PDF downloaded. I would like the rule to be applied to every individual PDF downloaded. So if one of the downloads has ‘set’ in the file name and the other doesn’t then the one with ‘set’ would have the shortcoded section display “set(s)” and the one that doesn’t would have “print(s)”. Here is my code so far below:

function fetch_woo_product_data_for_shortcode( $input, $order_id, $product_id ) {
 
    $product = wc_get_product( $product_id );
    
    $set_identifier = "Set";
    $set = "set(s)";
    $print = "print(s)";

    if ( $product->is_downloadable() ) {
        foreach( $product->get_downloads() as $key_download_id => $download ) {

            $downloads = $product->get_downloads();
            $download_link = $download->get_file(); // Variation Download Name
        }   
            if (strpos($download_name, $set_identifier) !== false) {
                $input = preg_replace( '/[PRINTCOPIES]/', $set, $input );
            return $input;
                
            } else { $input = preg_replace( '/[PRINTCOPIES]/', $print, $input );
                return $input;} 
    }
}
add_filter( 'wwpdf_filter_overlay', 'fetch_woo_product_data_for_shortcode', 10, 3 ); // for filtering the overlay watermark
add_filter( 'wwpdf_filter_footer', 'fetch_woo_product_data_for_shortcode', 10, 3 ); // for filtering the footer watermark

Thanks in advance!

XAMPP virtual host always redirecting me to different place

I want to create a virtual host but whenever I try to access it, it redirects me the xampps/dashboard page.

Here is my httpd-vhosts.conf:

<VirtualHost *:80>
ServerName something.loc
DocumentRoot "C:/xampp/htdocs/master/public"
    <Directory "C:/xampp/htdocs/master/public">
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory> 
</VirtualHost>

and my etc/hosts file:

127.0.0.1 something.loc

What am I missing?

“Getting ‘Undefined variable: items’ error in Laravel project” [duplicate]

I’m facing some issues with a project built with Laravel
I want the items in the dropdown menu to be able to display the value I select in the dropdown menu please help me. I’ve tried many solutions but it’s not working.

This is my code inside index.blade.php

 @extends('layouts.app')
@section('content')
<div class="container">
    <form id="update-name-form" method="POST" action="{{ route('items.update') }}">
        @csrf
        <div class="form-group">
            <label for="item">Select Item:</label>
            <select id="item" name="item" class="form-control">
                @foreach ($items as $item)
                    <option value="{{ $item->id }}">{{ $item->name }}</option>
                @endforeach
            </select>
        </div>
        <div class="form-group">
            <label for="new_name">New Name:</label>
            <input type="text" id="new_name" name="new_name" class="form-control">
        </div>
        <button type="submit" class="btn btn-primary">Update</button>
    </form>
</div>
@endsection

This is my code inside ItemController.php

public function index()
{
    $items = Item::get();
    return view('index', compact('items'));
}

curl_setopt() command using multipart/form-data with 2 boundary

i have to create a POST request using CURL with this parameters:

  1. The header must be: Content-Type:multipart/form-data
  2. 2 Boundary
  3. first: Content-Disposition: form-data; name="fileName" Content-Type: application/json {"fileName":[filename],"codFornitore":205900}
  4. Second: Content-Disposition: form-data; name="file"; filename="[filename]" Content-Type: [based on type of file] [byte array of file content]

How can i create a string that define this type of post body and its curl call?