Upload multiple files when placing a WooCommerce order

I am using a code that adds a file upload field on the checkout page. How to add file upload to WooCommerce checkout? Many thanks to @LoicTheAztec for this code.

I have created the files checkout_uploads.php, checkout_upload.js and added the code to functions.php a child theme.

add_action( 'woocommerce_after_order_notes', 'add_custom_checkout_field' );
function add_custom_checkout_field($checkout) {

    echo '<div class="woocommerce-additional-fields__field-wrapper">';

    woocommerce_form_field('certificate', array(
        'type'      => 'file',
        'class'     => array('form-row-wide'),
        'label'     => __('File', 'woocommerce'),
        'required'  => false,
        'max_size'  => '2048',
        'accept'    => '.pdf,.doc,.docx,.rtf,.txt',
    ), '');

    echo '</div>';
}

// Save the uploaded file URL and name
add_action( 'woocommerce_checkout_create_order', 'save_checkout_uploaded_file', 10, 2 );
function save_checkout_uploaded_file( $order, $data ){
    if( $checkout_upload = WC()->session->get('checkout_upload') ) {
        $order->update_meta_data( '_checkout_upload', $checkout_upload ); 
    }
    WC()->session->__unset('checkout_upload');
}

// Display the uploaded file in admin orders
add_action('woocommerce_admin_order_data_after_billing_address', 'display_uploaded_file_in_admin_orders');
function display_uploaded_file_in_admin_orders( $order ){
    if( $checkout_upload = $order->get_meta( '_checkout_upload' ) ) {
        printf( '<p>%s <br><a href="%s">%s</a></p>', 
            __("File Uploaded:", 'woocommerce'), 
            $checkout_upload['file_url'], 
            $checkout_upload['file_name'] 
        );
    }
}

// Display the uploaded file in thankyou page
add_action('woocommerce_order_details_after_order_table', 'display_uploaded_file_in_thankyou');
function display_uploaded_file_in_thankyou ( $order ){
    if( $checkout_upload = $order->get_meta( '_checkout_upload' ) ) {
        printf( '<p>%s <br><a href="%s">%s</a></p>', 
            __("File Uploaded:", 'woocommerce'), 
            $checkout_upload['file_url'], 
            $checkout_upload['file_name'] 
        );
    }
}

// Display the uploaded file in emails
add_action('woocommerce_email_customer_details', 'display_uploaded_file_in_email');
function display_uploaded_file_in_email ( $order ){
    if( $checkout_upload = $order->get_meta( '_checkout_upload' ) ) {
        printf( '<p>%s <a href="%s">%s</a></p>', 
            __("File Uploaded:", 'woocommerce'), 
            $checkout_upload['file_url'], 
            $checkout_upload['file_name'] 
        );
    }
}

Only one file can be uploaded at the moment. How can I upload multiple files at the same time? I will be glad of your help!

Getting my Filtrable class to work as it should [closed]

I writing a reusable Filtrable trait for laravel projects. I have it working but not perfectly. One part work perfectly why another part not giving expected results

I writing a reusable Filtrable trait for laravel projects. I have it working but not perfectly.
This is my Fliterable trait code

namespace ObrainwaveLaravelQueryFilters;

use IlluminateDatabaseEloquentBuilder;
use IlluminateHttpRequest;

trait Filterable
{
    public function scopeFilter(Builder $query, Request | array | null $filters =     null) : QueryFilter
    {
        $filterClass = $this->getFilterClass();

        if (! class_exists($filterClass)) {
            return $query;
        }

        $filter = (new $filterClass($filters))
            ->setBuilder($query)
            ->apply(); // automatically apply request/array filters

        return $filter; // Now you can chain ->status(...)->role(...)->get()
    }

    protected function getFilterClass(): string
    {
        return str_replace('Models', 'Filters', static::class) . 'Filter';
    }
}

and this is my QueryFilter class code

namespace ObrainwaveLaravelQueryFilters;

use IlluminateDatabaseEloquentBuilder;
use IlluminateHttpRequest;

abstract class QueryFilter
{
    protected Builder|null $builder = null;
    protected array $filters = [];

/**
 * Accept request or array of filters
 */
    public function __construct(Request|array|null $filters = null)
   {
        if ($filters instanceof Request) {
            $this->filters = $filters->all();
        } elseif (is_array($filters)) {
            $this->filters = $filters;
        }
    }

/**
 * Set the query builder instance
 */
    public function setBuilder(Builder $builder): static
    {
        $this->builder = $builder;
        return $this;
    }

/**
 * Apply the filters to the builder
 */
    public function apply(): static
    {
        if (! $this->builder) {
           throw new Exception("Query builder is not set. Call setBuilder() first.");
        }

        foreach ($this->filters as $key => $value) {
            if ($value !== null && method_exists($this, $key)) {
                $this->$key($value);
            }
        }

        return $this;
    }

/**
 * Return the underlying builder for final query
 */
    public function get()
    {
        return $this->builder->get();
    }

    public function first()
    {
        return $this->builder->first();
    }

    public function toSql()
   {
        return $this->builder->toSql();
    }
}

So my problem is that it works when I passed the chaining methods

$users2 = User::filter(['status' => 'inactive', 'role' => 'admin'])
        ->status('inactive')
        ->role('admin')
        ->get();

But it returns all rows when I do this
$users1 = User::filter(request())->get();
which means it doesn’t apply the default filtering

I hope anyone can help me spotting my mistakes.

WordPress – Counter button – Get value from db – display counter value – increment – and update DB [closed]

In a WordPress projet, let say I want my users to click on a button when they aggree with a sentence such as :
If you like pancakes click here <button> YES I DO </button>

Let say I want to display the number of clicks such as :
<nb_click> have allready say yes

Question 1 :
Is there a plugin that does this ?

Question 2 :
I tried to do it with a code snippet (php/javascript ; Elementor short code widget): But I am facing a probleme with the execution evironnement.

PROBLEM : The php code is executed as soon as the web page loads. It looks like the execution environnement had removed the javascript code to execute only php tags. And when the user click on the button, the javascript code is executed (as if it had reappeared). The function counter_increment_and_update_db() is well triggered, but the php code is not executed.

at the end, the incremented value of the counter is always inserted into the database, no matter the button was clicked or not

<?php
    $current_counter_value = get_counter_value_from_db();    
?>

<button onclick="counter_increment_and_update_db()"> OUI </button>
<span id="counting"></span> 

<script>
    html_display_curent_counter_value(<?php echo $current_counter_value; ?>)
    function counter_increment_and_update_db() {
        <?php
            $incremented_value = increment_by_one($current_counter_value);
        ?>
        html_display_curent_counter_value(<?php echo $incremented_value; ?>)
        <?php
            update_db_counter_value($incremented_value);
        ?>
    }
    // -----------------            javascript UTIL FUNCTIONS        ----------------
    function html_display_curent_counter_value(text_to_be_displayed){
        document.getElementById("counting").innerText = text_to_be_displayed;
    }
</script>

<?php
    // --------------------------------------------------------------------
    // -----------------            php UTIL FUNCTIONS        ----------------
    // --------------------------------------------------------------------
    function increment_by_one($value){
        $out=$value+1;
        return $out;
    }
    function get_counter_value_from_db(){
        global $wpdb;
        $wpdb->show_errors();
        $query = "SELECT * FROM click_counter WHERE counter_name = 'sondage1'";
        $resultArray = $wpdb->get_results($query);
        $current_counter_value = get_last_value($resultArray);
        return $current_counter_value;
    }
    function get_last_value($array_of_values){
        $out=0;
        foreach ($array_of_values as $page) {
                $out = $page->counter_value;
        }
        return $out;
    }
    function update_db_counter_value($new_value) {
        global $wpdb;
        $wpdb->show_errors(); 
        $wpdb->update(
            'click_counter',
            array(
                'counter_value' => $new_value   
            ),
            array(
                'counter_name' => 'sondage1'
            ), 
            array( 
                '%d' 
            )
        );
    }
?>

Shuffle a list and keep the repeated values distant [closed]

I have a list of competitors and their respective horses, with each competitor identified by a unique ID, and competitors may be associated with different horses. I need to shuffle the list in such a way that the same competitor does not appear consecutively, ideally maintaining a minimum distance of 5 competitors between repetitions.

Do I need to apply this logic directly in the select query or through PHP.

I considered separating the items into groups and shuffling them, but there is a possibility that an item could be the last of one group and the first of another, causing them to be close together. However, the client requested that the order be shuffled, but items with the same ID cannot be close to each other, ideally with a distance of at least 5 competitors between them.

Why can’t I create a category as an administrator?

Laravel API Redirects to Login Route Despite Valid Bearer Token
I’ve created a REST API with Laravel 12 and I’m using Sanctum for authentication. My routes are defined in the api.php file.

When I try to access an authenticated route from an administrator account using Postman, the request is unexpectedly redirected to the named login route, and I receive the following error:

Missing required parameter for [Route: login] [URI: api/login/{type}] [Missing parameter: type]
*
I am sending a POST request to the following endpoint: /api/administrateur/categories.

I have confirmed that I am including a valid Bearer Token from a successful administrator login in my request headers. The token is valid and should grant me access to the authenticated routes. I believe the issue lies within the Sanctum authentication middleware, as the application seems to be failing to recognize my token and instead redirects me to the login route.

Here is my api.php file for reference:

<?php

use IlluminateHttpRequest;
use IlluminateSupportFacadesRoute;
use AppHttpControllersAuthentificationController;
use AppHttpControllersClientController;
use AppHttpControllersEntrepriseController;
use AppHttpControllersAdministrateurController;
use AppHttpControllersProduitController;
use AppHttpControllersDevisController;
use AppHttpControllersCommentaireController;
use AppHttpControllersCategorieController;


Route::post('/register', [AuthentificationController::class, 'register']);
Route::post('/login/{type}', [AuthentificationController::class, 'login'])->name('login');

Route::get('/categories', [CategorieController::class, 'index']);
Route::get('/categories/{id}', [CategorieController::class, 'show']);
Route::get('/produits', [ProduitController::class, 'index']);
Route::get('/produits/{id}', [ProduitController::class, 'show']);
Route::get('/entreprises', [EntrepriseController::class, 'index']);
Route::get('/entreprises/{id}', [EntrepriseController::class, 'show']);


Route::middleware('auth:sanctum')->group(function () {
    Route::post('/logout', [AuthentificationController::class, 'logout']);

    Route::prefix('client')->middleware('authentification.type:client')->group(function () {
        Route::get('/profile', [ClientController::class, 'showProfile']);
        Route::put('/profile', [ClientController::class, 'updateProfile']);
        
        Route::get('/commentaires', [CommentaireController::class, 'index']);
        Route::post('/commentaires', [CommentaireController::class, 'store']);
        Route::get('/commentaires/{commentaire}', [CommentaireController::class, 'show']);
        Route::put('/commentaires/{commentaire}', [CommentaireController::class, 'update']);
        Route::delete('/commentaires/{commentaire}', [CommentaireController::class, 'destroy']);
        
        Route::get('/devis', [DevisController::class, 'index']);
        Route::post('/devis', [DevisController::class, 'store']);
        Route::get('/devis/{devi}', [DevisController::class, 'show']);
        Route::put('/devis/{devi}', [DevisCont

type here

roller::class, 'update']);
        Route::delete('/devis/{devi}', [DevisController::class, 'destroy']);
    });

    Route::prefix('entreprise')->middleware('authentification.type:entreprise')->group(function () {
        Route::get('/profile', [EntrepriseController::class, 'showProfile']);
        Route::put('/profile', [EntrepriseController::class, 'updateProfile']);
        
        Route::post('/produits', [ProduitController::class, 'store']);
        Route::put('/produits/{produit}', [ProduitController::class, 'update']);
        Route::delete('/produits/{produit}', [ProduitController::class, 'destroy']);
        
        Route::put('/devis/{id}/statut', [DevisController::class, 'updateStatus']);
    });

    Route::prefix('administrateur')->middleware('authentification.type:administrateur')->group(function () {
        Route::get('/dashboard', [AdministrateurController::class, 'dashboardStats']);
        
        Route::post('/entreprises/{id}/valider', [AdministrateurController::class, 'validerEntreprise']);
        Route::post('/entreprises/{id}/refuser', [AdministrateurController::class, 'refuserEntreprise']);
        
        Route::post('/entreprises', [AdministrateurController::class, 'store']);
        Route::get('/entreprises', [AdministrateurController::class, 'indexEntreprises']);
        Route::put('/entreprises/{entreprise}', [AdministrateurController::class, 'update']);
        Route::delete('/entreprises/{entreprise}', [AdministrateurController::class, 'destroy']);
        Route::get('/entreprises/{id}', [AdministrateurController::class, 'show']);

        Route::post('/categories', [CategorieController::class, 'store'])->name('categories.store');
        Route::put('/categories/{categorie}', [CategorieController::class, 'update'])->name('categories.update');
        Route::delete('/categories/{categorie}', [CategorieController::class, 'destroy'])->name('categories.destroy');
    });
});

What could be causing this redirect to the login page, even with a valid token? How can I fix this

Test,body

Laravel Reverb Curl Exception on Laravel Herd

I keep getting this error below

GuzzleHttpExceptionRequestException: cURL error 1: Received HTTP/0.9 when not allowed (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://127.0.0.1:8080/apps/local/events?auth_key=local-key&auth_timestamp=1756475569&auth_version=1.0&body_md5=baf98ab9765fdd4ce6328183d1646a5a&auth_signature=2828b9b5b9db7af8f931e42c37b138a9456babfa1ae0df72cb5d395e03a05b40 in /Users/chris/Herd/utility.com/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:278

Below are my .env variables

REVERB_APP_ID=local
REVERB_APP_KEY=local-key
REVERB_APP_SECRET=local-secret
REVERB_PORT=443
REVERB_HOST=utility.com.test
REVERB_SCHEME=https

Why do I have missing p tags from acf wysiwyg field?

I’m using ACF in wordpress.

I created a field group named my_group that contains a WYSIWYG field called my_content. Then I created another field that clones my_group.

Inside a flexible content field, one of the layouts is a clone of my_group. When I output the WYSIWYG field (my_content) from the clone, the <p> tags are missing.

Actual:

This is some text
Another line of text

Expected:

<p>This is some text</p>
<p>Another line of text</p>

I can work around this by adding the the_content filter:

echo apply_filters('the_content', $my_content);

I understand that get_field() normally formats wysiwyg content, but here I’m pulling the field data from a flexible content field array:

$flexible_content = get_field('flexible_content');

foreach ($flexible_content as $row) {
    switch ($row['acf_fc_layout']) {
        case 'my_group':
            $my_group = $row['my_group'];
            $my_content = $row['my_content'];
            echo apply_filters('the_content', $my_content);
            // echo $my_content;
            break;
    }
}

Sometimes I do not see this behavior and it works fine when I use this method, but other times I get this unexpected behavior.

Why does the wysiwyg field inside a cloned group sometimes output without <p> tags? Is there a better way to handle it than using the_content filter?

datatables.net alerts Invalid Json Response. I can’t find anything wrong with the json [closed]

I am using Datatables.net to display results of an oracle query. Query works fine and I appear to be getting the right JSON output, but DataTables complains that my JSON is invalid. I have this javascript:

ajax: {
  url: "php/requests.php",
  type: "POST",
  dataSrc: ""
},
paging: false,
scrollY: '60vh',
scrollCollapse: true,
// note:  DataTables.render.number(thousandsSeparater,decimalSeparator,precision,[prefix ie '$'],[suffix])
columns: [
    { data: "Request_Id" },
    { data: "Description" },
    { data: "Requestor" },
    { data: "Request_Date" },
    { data: "Processed", className: "dt-right", render: DataTable.render.number(',', '.', 0) },
    { data: "Processed_Rate", className: "dt-right", render: DataTable.render.number(',', '.', 1) },
    { data: "Pending", className: "dt-right", render: DataTable.render.number(',', '.', 0) },
    { data: "Succeeded", className: "dt-right", render: DataTable.render.number(',', '.', 0) },
    { data: "Success_Rate", className: "dt-right", render: DataTable.render.number(',', '.', 1) }
    { data: "Failed", className: "dt-right", render: DataTable.render.number(',', '.', 0) },
],
order: [0, 'asc']

requests.php gets called as expected when the page loads and this json string is output:

[
    {
        "Request_Id": "10082",
        "Description": "test",
        "Requestor": "[email protected]",
        "Request_Date": "27-AUG-25",
        "Processed": 354,
        "Processed_Rate": 69.00584795321637,
        "Pending": 159,
        "Succeeded": 354,
        "Success_Rate": 100,
        "Failed": 0
    }
]

(as copied from Edge/developer tools/network/response )

this is the message that pops up:
enter image description here
What am I missing?

How to override PHP syntax coloring in VSCode Language

I tried both including source.php after my match rule and injection into the PHP language syntax.

Including the source shows PHP syntax coloring without my override, whereas injection shows my override without PHP coloring.

Attempt PHP Syntax My Syntax Override
With Injection
Include PHP Source (source.php)

I would like to see both work at the same time where my syntax overrides the PHP syntax.

Any ideas what is happening or how to achieve this please?

My code setup:

# Language
"languages": [
    {
        "id": "phpf",
        "aliases": ["PHPF", "phpf"],
        "extensions": [".phpf"],
        "configuration": "./language-configuration.json",
        "icon": {
        "light": "file-icons/phpf.png",
        "dark": "file-icons/phpf.png"
        }
    }
]

# Grammar
"grammars": [
    {
        "language": "phpf",
        "scopeName": "source.phpf",
        "path": "./syntaxes/phpf.json",
        "injectTo": ["source.php"]
    }
]

# Syntax
{
    "scopeName": "source.phpf",
    "fileTypes": ["phpf"],
    "name": "PHPF",
    "injectionSelector": "L:source.php",
    "patterns": [
    {
        "name": "phpf.a",
        "match": "___[A-Z]+___"
    },
    {
        "include": "source.php"
    }
    ]
}

# Coloring
"configurationDefaults": {
    "editor.tokenColorCustomizations": {
        "textMateRules": [
        {
            "scope": "phpf.a",
            "settings": {
            "fontStyle": "bold",
            "foreground": "#e24d33"
            }
        }
        ]
    }
}

XML with attributes to array in PHP

I am trying to convert an XML string into multi-dimensioned PHP array. The difficulties are that XML comes with attributes and has nested values. My code works at parent level data but I am not sure how to deal with sub-levels recursively.

A sample XML is as follows:

<root>
    <item id="1" name="ItemOne">Item Value 1</item>
    <item id="2" name="ItemTwo">
        <subb>Sub Value 1</subb>
        <subb>Sub Value 2</subb>
    </item>
    <item id="3" name="ItemThree">Value 3</item>
    <something>something value</something>
</root>

This is my current function to achieve this:

$xmlString = '<root><item id="1" name="ItemOne">Item Value 1</item><item id="2" name="ItemTwo"><subb>Sub Value 1</subb><subb>Sub Value 2</subb></item><item id="3" name="ItemThree">Value 3</item><something>something value</something></root>';

function xmlToArray($xmlObject) {
    $array = [];
    foreach ($xmlObject as $item) {
        // Convert attributes to an array
        $attributes = (array)$item->attributes();
        // Add the text value to the attributes array if it exists
        $attributes['@value'] = trim((string)$item);
        $key = (string)$item->getName();
        if (isset($make_sub_array) && in_array($key, $make_sub_array)) {
            $array[$key][] = $attributes;
        }
        elseif (isset($array[$key])) {
            $make_sub_array[] = $key;
            $tmp = $array[$key];
            unset($array[$key]);
            $array[$key][] = $tmp; //existing data
            $array[$key][] = $attributes; //this data
        }
        else $array[$key] = $attributes;
    }
    return $array;
}
// Load the XML string into a SimpleXMLElement object
$xmlObject = simplexml_load_string($xmlString);
$array = xmlToArray($xmlObject);
exit('<pre>'.print_r($array,1).'</pre>');

The resulting array structure is below, and I require your help about how I can process the array under second item. I would like it to be processed the same way as the parent one: if the item name is repeated then it will be included as [] so I get number as its parent, otherwise [itemname].
Thank you

Array
(
    [item] => Array
        (
            [0] => Array
                (
                    [@attributes] => Array
                        (
                            [id] => 1
                            [name] => ItemOne
                        )
                    [@value] => Item Value 1
                )
            [1] => Array
                (
                    [@attributes] => Array
                        (
                            [id] => 2
                            [name] => ItemTwo
                        )
                    [@value] => 
                )
            [2] => Array
                (
                    [@attributes] => Array
                        (
                            [id] => 3
                            [name] => ItemThree
                        )

                    [@value] => Value 3
                )
        )
    [something] => Array
        (
            [@value] => something value
        )
)

PHP XAMPP Curl Request Slow on Windows 10 for JSON payloads [closed]

I’m sending JSON data to an external API using PHP cURL on Windows 10 with XAMPP (PHP 8.3).

  • Small JSON payloads (1–2 KB) return a response normally within ~2 seconds.
  • As soon as the payload gets a few extra characters or items, the request takes a very long time and sometimes errors out.
  • The same request works instantly in Postman.

Here is a simplified version of my code:

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => 'https://api.example.com/validate',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => json_encode($data),
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'Authorization: Bearer ...'
    ],
]);

$response = curl_exec($curl);

curl_close($curl);

Things I’ve tried:

  • Increasing post_max_size, memory_limit, max_execution_time in php.ini.
  • Disabling JSON_PRETTY_PRINT.
  • Testing with JSON payloads of different sizes.
  • Running the script via CLI (faster than through browser).

Environment:

  • Windows 10
  • XAMPP (Apache + PHP 8.3)
  • cURL enabled
  • JSON payloads range from 1 KB to 100+ KB

Symptoms:

PHP cURL is much slower than Postman for slightly larger payloads.

With few more JSON values request may fail or hang even with less few items request complete in under 2 seconds

Questions:

  1. Why does PHP cURL become slow or fail with slightly larger JSON payloads in this environment?
  2. How can I reliably send larger JSON payloads via cURL on XAMPP without long delays or errors?
  3. Are there any Windows/XAMPP/PHP specific settings I need to adjust (DNS, SSL, buffer sizes, timeouts, etc.)?

Migrations & Seeders & Command for production data [duplicate]

Recently after some research I came up with a question: how to handle default / initial data population in a Laravel project which goes live: should it go into seeders or migrations? I’ve seen two very different schools of thought.

  • Nuno Maduro says:

    Seeders should only be used for environment-specific data (local or test), and not for default system values. Database seeders become outdated over time and may no longer reflect the true state of your production data. This can introduce inconsistencies if you need to re-run migrations to deploy your app elsewhere. In contrast, migrations are inherently reliable because they define the exact structure and transformations that shaped your production data, guaranteeing consistency across environments.

    YouTube video in which Nuno talks about seeders

  • Another developer explained why they always use migrations for default values:

    • They support dependencies between tables.

    • Easier to revert a release by using down() to remove the inserted data.

    • Avoids the risk of someone forgetting to run the seeders, or accidentally running test seeders in production.

  • On the other hand, many developers say:

    Migrations should migrate schema, not seed data.

    But they often don’t address the fact that default values are actually part of the schema of the application.

In my project I have two different types of default data:

  1. Roles (user, admin): These is a critical system data, so I’m leaning toward adding them in a migration.

  2. DishCategories & DishSubcategories: Here it gets tricky. I have a large predefined array of categories and subcategories (kind of like a starter set). To avoid bloating the migration file, I moved that array into a separate PHP file and include it when inserting the data.

Is this an acceptable approach?

On the one hand, these are not “test” values, they are part of the actual application logic (used in search). On the other hand, they can evolve later by being managed in the admin panel.

Laravel Daily also mentioned a possible issue when putting data population inside migrations:

  • During automated tests, when migrations are re-run, the default data might get inserted multiple times unless you use insertOrIgnore or similar safeguards.

  • This could lead to duplicate rows in test environments.

YouTube video in which Laravel Daily talks about those 2 approaches

Also there is 3 way of seeding data using custom artisan command, but I didn’t make such feature as it is similar to seeders and I’ll need to run this command right after running migrations

A code example of these 2 approaches (Seeder / Migration)

Seeder

class RolesSeeder extends Seeder
{
    public function run(): void
    {
        Role::create(['name' => 'user']);
        Role::create(['name' => 'admin']);
    }
}

Migration

    public function up(): void
    {
        Schema::create('roles', function (Blueprint $table) {
            $table->id();
            $table->string('name')->unique();
            $table->timestamps();
        });

        $roles = [
            'user',
            'admin'
        ];

        foreach ($roles as $role){
            DB::table('roles')->insert([
                'name' => $role,
                'created_at' => now(),
                'updated_at' => now(),
            ]);
        }
    }

There is already Laravel : Migrations & Seeding for production data on this topic, but because the question was asked a long time ago, I decided to raise this topic again

Shopware 6 – missing Paypal configuration admin panel page [closed]

I’ve installed Shopware 6.7.2 (latest) in Docker. After install and enable plugin Paypal and Stripe, there is no configuration admin panel. I see new payment methods from Stripe and Paypal in channel config, but no way access to configuration page plugin.

In Settings -> Extensions is listed here Paypal and stripe as active, but after click on … should be settings options but – Missing.

In my plugins lists, after click … should be available also settings link, but is only available option “unistall”

I know this is Paypal settings page, …/admin#/swag/paypal/settings/index/general when I try hardcoded access from browser on this page then i see blank page – no logs, no errors in console. I try rebuild administrator panel, cache remove, warmup etc, composer update. I spent 11 hrs today – still not work on docker.

Where to call manual authorisation in Laravel 12?

I am starting a new project, which is updating an old website, there is a requirement to move the old user accounts and user data over to the new system, when a user logs into the new site for the first time.

Therefore while I want to use the default Authentication in a Laravel 12 Starter Kit, it needs to be a manual authentication so that if the default system fails to find a match, I can look the user up on the old database in realtime, and start a worker to move the users data over and create a new account. That is all fine, but I am struggling to understand how to call the new authenticate function.

I have followed the authentication page (Laravel Docs) for manually authenticating users, thats fine, but I am struggling to understand how to correctly call it from the rest of the starter package.

Within AppHttpControllersAuthAuthenticatedSessionController.php there is this function

    public function store(LoginRequest $request): RedirectResponse
    {
        $request->authenticate();

        $request->session()->regenerate();

        return redirect()->intended(route('dashboard', absolute: false));
    }

Which is called when the Log In button on the login screen is clicked, but I think I need to replace the $request->authenticate(); line with the pointer to my bespoke function to attempt to authenticate the user.

However, if do something like

    #$request->authenticate();
    $bespokeAuth = new LogInController();
    $request = $bespokeAuth->authenticate($request);

while my code is executed, the results are not being returned back to the store function, hence error messages are not returned, and the system no longer moves to the next page on a successful login.

Can anyone tell me what I am missing, or doing wrong please?