str_starts_with

Supported Versions: PHP 8
Checks if a string starts with a given substring
str_starts_with(string $haystackstring $needle): bool
    {

        
$key $this->app['config']['app.key'];



        if (
str_starts_with($key'base64:')) {

            
$key base64_decode(substr($key7));

        }
    public function validAuthenticationResponse($request$result)

    {

        if (
str_starts_with($request->channel_name'private')) {

            
$signature $this->generateAblySignature(

                
$request->channel_name$request->socket_id

            
);
    public function normalizeChannelName($channel)

    {

        if (
$this->isGuardedChannel($channel)) {

            return 
str_starts_with($channel'private-')

                        ? 
Str::replaceFirst('private-'''$channel)

                        : 
Str::replaceFirst('presence-'''$channel);

        }
            $channel = (string) $channel;



            if (
Str::startsWith($channel, ['private-''presence-'])) {

                return 
str_starts_with($channel'private-')

                    ? 
Str::replaceFirst('private-''private:'$channel)

                    : 
Str::replaceFirst('presence-''presence:'$channel);

            }
    public function validAuthenticationResponse($request$result)

    {

        if (
str_starts_with($request->channel_name'private')) {

            return 
$this->decodePusherResponse(

                
$request,

                
method_exists($this->pusher'authorizeChannel')
            return ProcessUtils::escapeArgument($value);

        });



        if (
str_starts_with($key'--')) {

            
$value $value->map(function ($value) use ($key) {

                return 
"{$key}={$value}";

            });
            $value $value->map(function ($value) use ($key) {

                return 
"{$key}={$value}";

            });

        } elseif (
str_starts_with($key'-')) {

            
$value $value->map(function ($value) use ($key) {

                return 
"{$key} {$value}";

            });
    public static function validate($cookieName$cookieValue$key)

    {

        
$hasValidPrefix str_starts_with($cookieValue, static::create($cookieName$key));



        return 
$hasValidPrefix ? static::remove($cookieValue) : null;

    }
            ->map(fn ($segment) =>  $this->wrapJsonPathSegment($segment))

            ->
join('.');



        return 
"'$".(str_starts_with($jsonPath'[') ? '' '.').$jsonPath."'";

    }
    protected function isNestedUnder($relation$name)

    {

        return 
str_contains($name'.') && str_starts_with($name$relation.'.');

    }
        return empty($this->getFillable()) &&

            ! 
str_contains($key'.') &&

            ! 
str_starts_with($key'_');

    }
    protected function isCustomDateTimeCast($cast)

    {

        return 
str_starts_with($cast'date:') ||

                
str_starts_with($cast'datetime:');

    }
    protected function isCustomDateTimeCast($cast)

    {

        return 
str_starts_with($cast'date:') ||

                
str_starts_with($cast'datetime:');

    }
    protected function isDecimalCast($cast)

    {

        return 
str_starts_with($cast'decimal:');

    }
    {

        return 
collect($wheres)->map(function ($where) use ($from$to) {

            return 
collect($where)->map(function ($value) use ($from$to) {

                return 
is_string($value) && str_starts_with($value$from.'.')

                    ? 
$to.'.'.Str::afterLast($value'.')

                    : 
$value;

            });