Is it possible to use the “/” route for a controller in Laravel with Inertia?

What I want to set up in .routesweb.php is something like

Route::resource('/main', CallController::class);

So, if user goes to www.sitename.com/, the index of CallController should be executed and displayed. However, if I try to compile that with npx vite build, I am invariably met with an error of such type:

Expected identifier but found ":"
216 |   * @route '/{}'
217 |   */
218 |  export const show = (args: { : string | number } | [param: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
    |                               ^
219 |      url: show.url(args, options),
220 |      method: 'get',

The error only seems to go away, if some other path other that / is being assigned to as the path for the CallController‘s index.

The only workaround that I have found is to set the resource route as /calls and redirect from it from `/’:

Route::get('/', function () {
        return redirect('/main');
    })->name('home');

But I wonder, whether it is the intended behaviour and if it is possible to use / as a route for a resource/controller?

Why are my Laravel validation errors not showing in the Blade view? [closed]

I made a form in Laravel and added validation rules in the store() method.
The validation works because when I submit invalid data, the page refreshes and the form doesn’t submit — but I don’t see any error messages on the page.

Here’s part of my form in Blade:

<form action="{{ route('register') }}" method="POST">
    @csrf
    <input type="text" name="name" placeholder="Name">
    <button type="submit">Register</button>
</form>

And the validation inside my request file:

public function rules()
{
    return [
        'name' => 'required|min:3',
    ];
}

I tried using @error('name') inside my form, but it still doesn’t display anything.
I expected to see the validation message like “The name field is required.” but the form just reloads.
How can I properly show Laravel validation errors in a Blade view?

How can I display dynamic menu items like the 7 Brew Menu using JavaScript?

I’m trying to build a dynamic coffee shop menu for a project, kind of like the 7 Brew Menu, where each category (like drinks, flavors, add-ons, etc.) updates based on user selection.

I’m using HTML, CSS, and vanilla JavaScript, but I’m not sure how to structure the data so it’s easy to update and display.

For example:

When a user clicks on “Iced Drinks,” it should show only iced drink items.

Each item should have a name, price, and maybe an image.

What’s the best way to store and render this kind of data — should I use an array of objects or fetch it from a JSON file?

Any advice or code examples would be super helpful!

What I tried:
I tried creating an array of menu items in JavaScript and displaying them using a simple forEach loop. It works, but all items show at once instead of updating when I select a category (like “Iced Drinks” or “Blended Drinks”).

What I expected:
I expected only the selected category items to display — similar to how the 7 Brew Menu updates depending on drink type.

What actually happened:
All the menu items appeared together on the page, and the filter buttons didn’t change the displayed results.

Why doesn’t my v-model show the initial value in Vue 3?

I’m building a simple component in Vue 3 that uses v-model to bind an input field.
When I set the variable value inside mounted(), it updates correctly in the paragraph but the input itself stays empty.
Here’s my component:

<template>
  <div>
    <input type="text" v-model="name">
    <p>{{ name }}</p>
  </div>
</template>

<script>
export default {
  data() {
    return { name: '' }
  },
  mounted() {
    this.name = 'John'
  }
}
</script>

I tried setting the initial value directly in the data() function and it worked, but I need to assign it dynamically later.
I also checked the browser console and saw no errors.
I expected the input to show “John” automatically when the component loads, but it only updates when I type something manually.
Why doesn’t the input reflect the data value on mount?

How do I change the Google PlaceAutocompleteElement width?

Unlike the past, Google’s new PlaceAutocompleteElement imposes its own styling on the input and it clashes with my site.

In particular, the width is not full-width / fill. I see Google allows a small handful of overrides. However, is there any way to ensure the autocomplete to fills its container?

In one example, the autocomplete is appended to the body and it does fill the width. In another example, the autocomplete appears to be constrained. But neither examples explain how the width is controlled.

I did try the following and it does not work:

const autocompleteElement = new window.google.maps.places.PlaceAutocompleteElement()
autocompleteElement.style.colorScheme = "light"
autocompleteElement.style.width="100%"
autocompleteElement.width = "100%"
myElement.appendChild(autocompleteElement)

Difference in date between Js code in React project and Browser

Currently creating a simple React project which displays the date and shows future / past dates based on the user inputting the number of days difference. The date I’ve inputted as the date to measure from doesn’t come up as the same when on the Browser. I have no idea why this has happened but I’m assuming its something with Vite because this doesn’t happen when not using it.
Code for displaying time
Browser Output

Initially tried showing the current date with ‘new Date()’ but even with a specific date (e.g. new Date(‘october 04 2025’), a completely different date is logged by the console.

PayStackAPIError: Bearer Authorization header may not have been set | Unauthorized (401)

This is my first time of integrating payment gateway to my website using official paystack-node sdk package in my node.js application, but after following through the documentation i’m facing this error: PayStackAPIError: Bearer Authorization header may not have been set | Unauthorized (401).

This is my code sequence on the server side:

    const Paystack = require('paystack-node');
    const {PaystackPaymentSetupValidator,throwValidationError} = require('../utils/schemas');
    const router = require('express').Router();
    const ExpressError = require('../utils/express_error');
    const paystack = new Paystack(process.env.PAYSTACK_SECRET_KEY, process.env.NODE_ENV);
    const _isDevt = (process.env.NODE_ENV !== 'production');
    const callback_url = process.env.PAYSTACK_CALLBACK_URL;

// Middleware to validate Paystack requests
    const _validateRequest = async (req, resp, next) => {
        try{
            const {req_typ} = req.body;
            const {error} = await req_typ=='paystack-payment-setup-req'? PaystackPaymentSetupValidator.validate(req.body,{abortEarly:false}) : throwValidationError(req.body);
            if (error) {
                let msg = error? error.details.map(el => el.message).join('n# ') : 'Invalid Session Data!';
                if(_isDevt){
                    console.log('validation err:',error,msg);
                    msg = `n# ${msg}.`;
                } else {
                    msg = '';
                } // end if
                req.app.locals.appfx.log(new ExpressError('Validation Error',msg,0,req.body));
                return resp.send({error: {text: msg||'Invalid Request format.'}});
            } // end if
            return next();
        } catch(err) {
            if(_isDevt){
                console.log('catch err:',error);
            } // end if
            req.app.locals.appfx.log(error);
            return resp.send({error: {text:`Request Error!${_isDevt?`n${error}`:''}`}});
        } // end catch    
    } // end fx

    // Middleware to initialize Paystack
    const _initiatePayment = async (req, resp) => {
        try {
            const {email, amount, metadata} = req.body;
            const response = await paystack.initializeTransaction({
                email: email,
                amount: amount * 100, // Amount in kobo
                metadata: metadata || {},
                callback_url: callback_url
            });
            console.log('resp:',response);
            if(response.status) {
                return resp.send({success: {text: 'Paystack initialized successfully.', data: response.data}});
            } else {
                return resp.status(400).send({error: {text: 'Failed to initialize Paystack transaction.'}});
            } // end if
        } catch (error) {
            if(_isDevt){
                console.log('catch err:',error);
            } // end if
            req.app.locals.appfx.log(error);
            return resp.status(500).send({error: {text:`Request Error!${_isDevt?`n${error}`:''}`}});        
        } // end catch
    } // end fx

    // Middleware to verify Paystack transaction
    const _verifyPayment = async (req, resp, next) => {
        const {reference} = req.body||req.query;
        if(!reference) {
            return resp.status(400).send({error: {text: 'Transaction reference is required.'}});
        } // end if
        try {
            const response = await paystack.verifyTransaction({reference});
            // Handle successful verification (e.g., update order status)
            if(response.data.status && response.data.data.status === 'success') {
                req.transaction = response.data.data;
                return next();
            } else {
                return resp.status(400).send({error: {text: 'Transaction verification failed.'}});
            } // end if
        } catch (error) {
            if(_isDevt){
                console.log('catch err:',error);
            } // end if
            req.app.locals.appfx.log(error);
            return resp.status(500).send({error: {text: 'An error occurred while verifying the transaction.'}});
        } // end catch
    } // end fx

    // Define routes
    router.get('/', (req, resp) => {
        return resp.render('paystack', { title: 'Paystack Payment Gateway Handler', user: req.user, _csrf: req.app.locals._csrf, payment_setup_url:'payment_setup/initiate' });
    });
    router.route('/initiate').post(_validateRequest, _initiatePayment);
    router.route('/verify').post(_validateRequest, _verifyPayment, (req, resp) => {
        return resp.send({success: {text: 'Transaction verified successfully.', data: req.transaction}});
    });

    module.exports = router;

After running this, I get this error:
PayStackAPIError: Bearer Authorization header may not have been set | Unauthorized (401).

I was hoping for smooth running, please can anyone help me through this…

There is a syntax error somewhere within this code [closed]

There is a syntax error on the result line

I have watched so many videos but i need a good ttorial or help please

image is here – https://1drv.ms/i/c/36fc60b41c9287f8/EW6nARgyeilNgyVWKVhUDcMBiyytOFryjcX13FzUaMLdtg?e=t3XG7l

code–

<?php 
if(isset($_POST['create'])){
    $firstname = $_POST['firstname']; 
    $lastname = $_POST['lastname'];
    $email = $_POST['email'];
    $phonenumber = $_POST['phonenumber'];
    $password = $_POST['password'];
    
    $sql = "INSERT INTO useraccounts (firstname, lastname, email, phonenumber, password) VALUES (?,?,?,?,?)";
    $stmtinsert = $db->prepare($sql);
    $result = $stmtinsert->execute([$firstname, $lastname, $email, $phonenumber, $password]);
    
    if($result){
        echo 'successfully saved';  
    }else{
        echo ('errors found, contact the admins');  
    }
}
?>

Asset not loading – Laravel | FilamentPHP v4 | SimpleLightBox

When I go to the info list, the lightbox does not load. I click on the photo and it opens in a new tab. I click back and click on the image again, and then the photo opens in the lightbox.

GitHub package:
https://github.com/solutionforest/Filament-SimpleLightBox

Package Version
1.0.0

PHP Version
8.4

Laravel Version
12

FilamentPHP Version 4.1.1

Which operating systems does with happen with?
macOS

INFOLIST:

Section::make('Galeria zdjęć')
                ->schema([
                    ImageEntry::make('gallery')
                        ->label('Galeria zdjęć')
                        ->view('filament.components.lightbox-gallery')
                        ->simpleLightbox(fn($record) => $record->getFirstMediaUrl('gallery')),
                ]),

VIEW:

@php
    $mediaItems = $getRecord()->getMedia('gallery');
@endphp

@if ($mediaItems->count())
    <div class="flex flex-wrap gap-2">
        @foreach ($mediaItems as $media)
            <a
                href="{{ $media->getUrl('fullhd') }}"
                data-fslightbox="gallery"
            >
                <img
                    src="{{ $media->getUrl('thumb') }}"
                    class="h-24 rounded shadow"
                    alt="media"
                />
            </a>
        @endforeach
    </div>
@endif

Scraping booking.com with PHP Curl

I’m trying to setup a simple php script (below) to check when a certain property becomes available on booking.com.
The site seems to work with some pretty simple query parameters – you can just go directly to eg https://www.booking.com/searchresults.en-gb.html?ss=New+York&checkin=2026-03-01&checkout=2026-03-05&group_adults=2 and it will process the search correctly, no need to be logged in, or click through from the previous search page etc.
But the following script just returns empty search results, with no search parameters filled in:

<?php
   
$ch = curl_init();
$timeout = 180;       
$url="https://www.booking.com/searchresults.en-gb.html?ss=New+York&checkin=2026-03-01&checkout=2026-03-05&group_adults=2";
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION , 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);   
$output = curl_exec($ch);
curl_close($ch);  
echo $output;
 
?>

Not sure if it’s down to booking.com implementing some kind of anti-bot protection behind the scenes which is actively blocking it, or if there’s just some simple thing I’m missing?

Get previous and next data from glob based on timestamp

I have the following code to sort the items based on a timestamp.

$arr = [];
foreach(glob('*.json') AS $item) {
    $data = json_decode(file_get_contents($item), true);
    $arr[] = [
        'taken' => $data['taken'],
        'file-name' => $data['file-name'],
        'account' => (empty($data['account']) ? null : $data['account'])
    ];
}

usort($arr, function($x, $y) { return $x['taken'] - $y['taken']; });

Here is the content of 4 of these JSON files I have in my folder:

{"hash":"1b668ef9398fe5fc9f68a3ad87d04a77","account":null,"file-name":"DSC00045","place":null,"taken":1663759434,"uploaded":1759397192},{"hash":"bccfb4221adc1e00b4fa34eef309d025","account":null,"file-name":"DSC00170","place":null,"taken":1663760473,"uploaded":1759397201},{"hash":"5aa05170b8e6c21b947db1a20b5a93ac","account":null,"file-name":"DSC00230","place":null,"taken":1663773888,"uploaded":1759397227},{"hash":"8de553beeda575d16377e62e77183507","account":null,"file-name":"DSC00318","place":null,"taken":1547596822,"uploaded":1759397265}

I want to get the previous and next item based on taken (which is the timestamp).

Currently I have made a mess and used the following to get the current item:

foreach($arr_test AS $test) {
    if($test['file-name'] == $get_image) {
        $current = $test;
    }
}

var_dump($current);

$get_item is the variable for (isset($_GET['img']) ? safetag($_GET['img']) : null) which contains the file name.

But now I am stuck. I have no clue what so ever how to get the previous and next item based on the timestamp.

My goal is to sort all items from the first foreach based on taken, and then get current, previous, and next file name based on when the photos were taken no matter how they are sorted in the folder. It’s for a photo gallery.

Variables not populating from PHP Script to mail message [duplicate]

The script does run, and I get the email. None of the information in the variables appears in the message, though. I get the plain text (“Query from” in the subject and “From” in the body). I have pasted the PHP script and the HTML form below. I would love to use PHPMail, but I don’t know if it is in the hosting environment I use, and I cannot install it myself. Until I can find out, I am using the native mail() function. Thanks in advance.

PHP Code 
<?php $to = "[email protected]"; 
$subject = "Query from" . htmlspecialchars($_POST['customer']); 
$msgBody = htmlspecialchars($_POST['msgBody']) . " From: "; 
$from = htmlspecialchars($_POST['subAdd']); $message = $from . " " . $msgBody;

if (mail($to, $subject, $message)){
    header("Location: https://bkjdesignspa.com");
}
else{
     echo "<script>window.alert('There was a problem sending the message.')</script>";
}

?>

HTML form

<form id="contactInfo" method="post" action="contactForm.php">                 
    <label>Name</label><br>                 
    <input type="text" placeholder="Name" required><br>                 
    <label>Email</label><br>                 
    <input type="email" id="subAdd" placeholder="Email Address" required><br>                 
    <label>Details</label><br>                 
    <textarea id="msgBody" placeholder="Details of request" style="width: 10em; height: 5em;" required></textarea><br>                                <input type="submit" value="Submit">             
</form><br>