问:
303 error when submitting form from modal in codeigniter4 when csrf is enabled
I have a codeignter4 web application with the following view which has a modal which submits data.

```<code><script>
    function deleteConfirm(url){
        $('#btn-delete').attr('href', url);
        $('#deleteModal').modal();
    }
</script>

<!-- Begin Page Content -->
<div class="container-fluid">

    <!-- Page Heading -->
    <h1 class="h3 mb-4 text-gray-800"><?= esc($title); ?></h1>
    <div class="col-lg-7">

        <?php if(session()->getFlashdata('message')):?>
         <?= session()->getFlashdata('message') ?>

          <?php endif;
             unset($_SESSION['message']);
            ?>
    </div>

    <div class="card col-lg-7 shadow mb-4">
        <div class="card-header py-3">
            <h6 class="m-0 font-weight-bold text-primary"><a href="" data-toggle="modal" data-target="#newRoleModal"><i class="fas fa-plus"></i> Add New</a></h6>
        </div>
            <div class="card-body">
                <div class="table-responsive">
                    <table class="table table-bordered table-hover table-striped" id="dataTable" width="100%" cellspacing="0">
                    <!--<thead class="thead-dark">-->
<thead class="bg-warning">
                                <tr>
                                <th>#</th>
                                <th>Authority</th>
                                <th>Action</th>
                                </tr>
                        </thead>
                    <tbody>
                        <?php $index = 1; ?>
                        <?php foreach($role as $r) : ?>
                            <tr>
                                <td><?= esc($index); ?></td>
                                <td><?= esc($r['role']); ?></td>
                                <td>
                                    <a class="badge badge-primary" style="font-size:14px;" href="<?= site_url('admin/roleaccess/'.$r['id']); ?>">Manage Access</a>
                                    <a class="badge badge-success" style="font-size:14px;" href="<?= site_url('admin/editrole/'.$r['id']); ?>">Update</a>
                                    <a class="badge badge-danger" style="font-size:14px;" href="#!" onclick="deleteConfirm('<?= site_url('admin/deleterole/'.$r['id']); ?>')">Delete</a>
                                </td>
                            </tr>
                        <?php $index++; ?>
                        <?php endforeach; ?>
                    </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
<!-- /.container-fluid -->

</div>
<!-- End of Main Content -->

<!-- Modal add new role-->
<div class="modal fade" id="newRoleModal" tabindex="-1" role="dialog" aria-labelledby="newRoleModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="newRoleModalLabel">Add New Authority</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">×</span>
        </button>
      </div>
      <!-- form -->
      <?php

          $attributes = array('id' => 'myform'); ?>

    <?= form_open('admin/addrole'); ?>
        <div class="modal-body">
            <div class="form-group">
                <input type="text" class="form-control" id="role" name="role" placeholder="Name of Authority">
            </div>
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
            <button type="submit" class="btn btn-success">Add</button>
        </div>
      <? = form_close(); ?>
    </div>
  </div>
</div>

<!-- modal delete -->
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Are you sure?</h5>
        <button class="close" type="button" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">×</span>
        </button>
      </div>
      <div class="modal-body">Deleted data cannot be recovered!!</div>
      <div class="modal-footer">
        <button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
        <a id="btn-delete" class="btn btn-danger" href="#">Remove</a>
      </div>
    </div>
  </div>
</div>

</code>```

The form submit redirects to the view itself when csrf is enabled. When I check the web console Network tab it shows a 303 status on addrole which is the controller method that handles the form submit data. However it works fine when csrf is disabled.How can I get it working

My Filter Class

```<code><?php

namespace Config;

use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Filters\CSRF;
use CodeIgniter\Filters\DebugToolbar;
use CodeIgniter\Filters\Honeypot;
use CodeIgniter\Filters\InvalidChars;
use CodeIgniter\Filters\SecureHeaders;

class Filters extends BaseConfig
{
    /**
     * Configures aliases for Filter classes to
     * make reading things nicer and simpler.
     *
     * @var array
     */
    public $aliases = [
        'csrf'          => CSRF::class,
        'toolbar'       => DebugToolbar::class,
        'honeypot'      => Honeypot::class,
        'invalidchars'  => InvalidChars::class,
        'secureheaders' => SecureHeaders::class,
        'auth'     => \App\Filters\Auth::class,
    ];

    /**
     * List of filter aliases that are always
     * applied before and after every request.
     *
     * @var array
     */
    /*public $globals = [
        'before' => [
            // 'honeypot',
             'csrf',
            // 'invalidchars',
        ],
        'after' => [
            //'toolbar',
            // 'honeypot',
            // 'secureheaders',
        ],
    ];*/
    public $globals = [
'before' => [
 //'honeypot',
 'csrf',
//'isLoggedIn' => ['except' => ['/', 'admin','users', 'dashboard', 'logout','auth','Ticket/getStatusCounts']],
//'isGranted' => ['except' => ['/', 'admin', 'users','dashboard', 'logout','auth', 'blocked', 'home', 'Welcome/*','Registration/*','profile','profile_save','profile_edit','Ticket/getStatusCounts']],
],
'after' => [
'toolbar',
// 'honeypot',
],
];

    /**
     * List of filter aliases that works on a
     * particular HTTP method (GET, POST, etc.).
     *
     * Example:
     * 'post' => ['foo', 'bar']
     *
     * If you use this, you should disable auto-routing because auto-routing
     * permits any HTTP method to access a controller. Accessing the controller
     * with a method you don’t expect could bypass the filter.
     *
     * @var array
     */
    public $methods = [];

    /**
     * List of filter aliases that should run on any
     * before or after URI patterns.
     *
     * Example:
     * 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
     *
     * @var array
     */
    public $filters = [];
}

</code>```

My config/App file

```<code><?php

namespace Config;

use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Session\Handlers\FileHandler;

class App extends BaseConfig
{
    /**
     * --------------------------------------------------------------------------
     * Base Site URL
     * --------------------------------------------------------------------------
     *
     * URL to your CodeIgniter root. Typically this will be your base URL,
     * WITH a trailing slash:
     *
     *    http://example.com/
     *
     * If this is not set then CodeIgniter will try guess the protocol, domain
     * and path to your installation. However, you should always configure this
     * explicitly and never rely on auto-guessing, especially in production
     * environments.
     *
     * @var string
     */
    public $baseURL = 'http://localhost/demo/public';

    /**
     * --------------------------------------------------------------------------
     * Index File
     * --------------------------------------------------------------------------
     *
     * Typically this will be your index.php file, unless you've renamed it to
     * something else. If you are using mod_rewrite to remove the page set this
     * variable so that it is blank.
     *
     * @var string
     */
    public $indexPage = 'index.php';

    /**
     * --------------------------------------------------------------------------
     * URI PROTOCOL
     * --------------------------------------------------------------------------
     *
     * This item determines which getServer global should be used to retrieve the
     * URI string.  The default setting of 'REQUEST_URI' works for most servers.
     * If your links do not seem to work, try one of the other delicious flavors:
     *
     * 'REQUEST_URI'    Uses $_SERVER['REQUEST_URI']
     * 'QUERY_STRING'   Uses $_SERVER['QUERY_STRING']
     * 'PATH_INFO'      Uses $_SERVER['PATH_INFO']
     *
     * WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
     *
     * @var string
     */
    public $uriProtocol = 'REQUEST_URI';

    /**
     * --------------------------------------------------------------------------
     * Default Locale
     * --------------------------------------------------------------------------
     *
     * The Locale roughly represents the language and location that your visitor
     * is viewing the site from. It affects the language strings and other
     * strings (like currency markers, numbers, etc), that your program
     * should run under for this request.
     *
     * @var string
     */
    public $defaultLocale = 'en';

    /**
     * --------------------------------------------------------------------------
     * Negotiate Locale
     * --------------------------------------------------------------------------
     *
     * If true, the current Request object will automatically determine the
     * language to use based on the value of the Accept-Language header.
     *
     * If false, no automatic detection will be performed.
     *
     * @var bool
     */
    public $negotiateLocale = false;

    /**
     * --------------------------------------------------------------------------
     * Supported Locales
     * --------------------------------------------------------------------------
     *
     * If $negotiateLocale is true, this array lists the locales supported
     * by the application in descending order of priority. If no match is
     * found, the first locale will be used.
     *
     * @var string[]
     */
    public $supportedLocales = ['en'];

    /**
     * --------------------------------------------------------------------------
     * Application Timezone
     * --------------------------------------------------------------------------
     *
     * The default timezone that will be used in your application to display
     * dates with the date helper, and can be retrieved through app_timezone()
     *
     * @var string
     */
    public $appTimezone = 'Asia/Kolkata';

    /**
     * --------------------------------------------------------------------------
     * Default Character Set
     * --------------------------------------------------------------------------
     *
     * This determines which character set is used by default in various methods
     * that require a character set to be provided.
     *
     * @see http://php.net/htmlspecialchars for a list of supported charsets.
     *
     * @var string
     */
    public $charset = 'UTF-8';

    /**
     * --------------------------------------------------------------------------
     * URI PROTOCOL
     * --------------------------------------------------------------------------
     *
     * If true, this will force every request made to this application to be
     * made via a secure connection (HTTPS). If the incoming request is not
     * secure, the user will be redirected to a secure version of the page
     * and the HTTP Strict Transport Security header will be set.
     *
     * @var bool
     */
    public $forceGlobalSecureRequests = false;

    /**
     * --------------------------------------------------------------------------
     * Session Driver
     * --------------------------------------------------------------------------
     *
     * The session storage driver to use:
     * - `CodeIgniter\Session\Handlers\FileHandler`
     * - `CodeIgniter\Session\Handlers\DatabaseHandler`
     * - `CodeIgniter\Session\Handlers\MemcachedHandler`
     * - `CodeIgniter\Session\Handlers\RedisHandler`
     *
     * @var string
     */
    public $sessionDriver = FileHandler::class;

    /**
     * --------------------------------------------------------------------------
     * Session Cookie Name
     * --------------------------------------------------------------------------
     *
     * The session cookie name, must contain only [0-9a-z_-] characters
     *
     * @var string
     */
    public $sessionCookieName = 'ci_session';

    /**
     * --------------------------------------------------------------------------
     * Session Expiration
     * --------------------------------------------------------------------------
     *
     * The number of SECONDS you want the session to last.
     * Setting to 0 (zero) means expire when the browser is closed.
     *
     * @var int
     */
    public $sessionExpiration = 7200;

    /**
     * --------------------------------------------------------------------------
     * Session Save Path
     * --------------------------------------------------------------------------
     *
     * The location to save sessions to and is driver dependent.
     *
     * For the 'files' driver, it's a path to a writable directory.
     * WARNING: Only absolute paths are supported!
     *
     * For the 'database' driver, it's a table name.
     * Please read up the manual for the format with other session drivers.
     *
     * IMPORTANT: You are REQUIRED to set a valid save path!
     *
     * @var string
     */
    public $sessionSavePath = WRITEPATH . 'session';

    /**
     * --------------------------------------------------------------------------
     * Session Match IP
     * --------------------------------------------------------------------------
     *
     * Whether to match the user's IP address when reading the session data.
     *
     * WARNING: If you're using the database driver, don't forget to update
     *          your session table's PRIMARY KEY when changing this setting.
     *
     * @var bool
     */
    public $sessionMatchIP = false;

    /**
     * --------------------------------------------------------------------------
     * Session Time to Update
     * --------------------------------------------------------------------------
     *
     * How many seconds between CI regenerating the session ID.
     *
     * @var int
     */
    public $sessionTimeToUpdate = 300;

    /**
     * --------------------------------------------------------------------------
     * Session Regenerate Destroy
     * --------------------------------------------------------------------------
     *
     * Whether to destroy session data associated with the old session ID
     * when auto-regenerating the session ID. When set to FALSE, the data
     * will be later deleted by the garbage collector.
     *
     * @var bool
     */
    public $sessionRegenerateDestroy = false;

    /**
     * --------------------------------------------------------------------------
     * Cookie Prefix
     * --------------------------------------------------------------------------
     *
     * Set a cookie name prefix if you need to avoid collisions.
     *
     * @var string
     *
     * @deprecated use Config\Cookie::$prefix property instead.
     */
    public $cookiePrefix = '';

    /**
     * --------------------------------------------------------------------------
     * Cookie Domain
     * --------------------------------------------------------------------------
     *
     * Set to `.your-domain.com` for site-wide cookies.
     *
     * @var string
     *
     * @deprecated use Config\Cookie::$domain property instead.
     */
    public $cookieDomain = '';

    /**
     * --------------------------------------------------------------------------
     * Cookie Path
     * --------------------------------------------------------------------------
     *
     * Typically will be a forward slash.
     *
     * @var string
     *
     * @deprecated use Config\Cookie::$path property instead.
     */
    public $cookiePath = '/';

    /**
     * --------------------------------------------------------------------------
     * Cookie Secure
     * --------------------------------------------------------------------------
     *
     * Cookie will only be set if a secure HTTPS connection exists.
     *
     * @var bool
     *
     * @deprecated use Config\Cookie::$secure property instead.
     */
    public $cookieSecure = false;

    /**
     * --------------------------------------------------------------------------
     * Cookie HttpOnly
     * --------------------------------------------------------------------------
     *
     * Cookie will only be accessible via HTTP(S) (no JavaScript).
     *
     * @var bool
     *
     * @deprecated use Config\Cookie::$httponly property instead.
     */
    public $cookieHTTPOnly = true;

    /**
     * --------------------------------------------------------------------------
     * Cookie SameSite
     * --------------------------------------------------------------------------
     *
     * Configure cookie SameSite setting. Allowed values are:
     * - None
     * - Lax
     * - Strict
     * - ''
     *
     * Alternatively, you can use the constant names:
     * - `Cookie::SAMESITE_NONE`
     * - `Cookie::SAMESITE_LAX`
     * - `Cookie::SAMESITE_STRICT`
     *
     * Defaults to `Lax` for compatibility with modern browsers. Setting `''`
     * (empty string) means default SameSite attribute set by browsers (`Lax`)
     * will be set on cookies. If set to `None`, `$cookieSecure` must also be set.
     *
     * @var string|null
     *
     * @deprecated use Config\Cookie::$samesite property instead.
     */
    public $cookieSameSite = 'Lax';

    /**
     * --------------------------------------------------------------------------
     * Reverse Proxy IPs
     * --------------------------------------------------------------------------
     *
     * If your server is behind a reverse proxy, you must whitelist the proxy
     * IP addresses from which CodeIgniter should trust headers such as
     * HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify
     * the visitor's IP address.
     *
     * You can use both an array or a comma-separated list of proxy addresses,
     * as well as specifying whole subnets. Here are a few examples:
     *
     * Comma-separated: '10.0.1.200,192.168.5.0/24'
     * Array: ['10.0.1.200', '192.168.5.0/24']
     *
     * @var string|string[]
     */
    public $proxyIPs = '';

    /**
     * --------------------------------------------------------------------------
     * CSRF Token Name
     * --------------------------------------------------------------------------
     *
     * The token name.
     *
     * @deprecated Use `Config\Security` $tokenName property instead of using this property.
     *
     * @var string
     */
    public $CSRFTokenName = 'csrf_test_name';

    /**
     * --------------------------------------------------------------------------
     * CSRF Header Name
     * --------------------------------------------------------------------------
     *
     * The header name.
     *
     * @deprecated Use `Config\Security` $headerName property instead of using this property.
     *
     * @var string
     */
    public $CSRFHeaderName = 'X-CSRF-TOKEN';

    /**
     * --------------------------------------------------------------------------
     * CSRF Cookie Name
     * --------------------------------------------------------------------------
     *
     * The cookie name.
     *
     * @deprecated Use `Config\Security` $cookieName property instead of using this property.
     *
     * @var string
     */
    public $CSRFCookieName = 'csrf_cookie_name';

    /**
     * --------------------------------------------------------------------------
     * CSRF Expire
     * --------------------------------------------------------------------------
     *
     * The number in seconds the token should expire.
     *
     * @deprecated Use `Config\Security` $expire property instead of using this property.
     *
     * @var int
     */
    public $CSRFExpire = 7200;

    /**
     * --------------------------------------------------------------------------
     * CSRF Regenerate
     * --------------------------------------------------------------------------
     *
     * Regenerate token on every submission?
     *
     * @deprecated Use `Config\Security` $regenerate property instead of using this property.
     *
     * @var bool
     */
    public $CSRFRegenerate = false;

    /**
     * --------------------------------------------------------------------------
     * CSRF Redirect
     * --------------------------------------------------------------------------
     *
     * Redirect to previous page with error on failure?
     *
     * @deprecated Use `Config\Security` $redirect property instead of using this property.
     *
     * @var bool
     */
    public $CSRFRedirect = false;

    /**
     * --------------------------------------------------------------------------
     * CSRF SameSite
     * --------------------------------------------------------------------------
     *
     * Setting for CSRF SameSite cookie token. Allowed values are:
     * - None
     * - Lax
     * - Strict
     * - ''
     *
     * Defaults to `Lax` as recommended in this link:
     *
     * @see https://portswigger.net/web-security/csrf/samesite-cookies
     * @deprecated `Config\Cookie` $samesite property is used.
     *
     * @var string
     */
    public $CSRFSameSite = 'Lax';

    /**
     * --------------------------------------------------------------------------
     * Content Security Policy
     * --------------------------------------------------------------------------
     *
     * Enables the Response's Content Secure Policy to restrict the sources that
     * can be used for images, scripts, CSS files, audio, video, etc. If enabled,
     * the Response object will populate default values for the policy from the
     * `ContentSecurityPolicy.php` file. Controllers can always add to those
     * restrictions at run time.
     *
     * For a better understanding of CSP, see these documents:
     *
     * @see http://www.html5rocks.com/en/tutorials/security/content-security-policy/
     * @see http://www.w3.org/TR/CSP/
     *
     * @var bool
     */
    public $CSPEnabled = false;

}

</code>```

My Security class

```<code><?php

namespace Config;

use CodeIgniter\Config\BaseConfig;

class Security extends BaseConfig
{
    /**
     * --------------------------------------------------------------------------
     * CSRF Protection Method
     * --------------------------------------------------------------------------
     *
     * Protection Method for Cross Site Request Forgery protection.
     *
     * @var string 'cookie' or 'session'
     */
    public $csrfProtection = 'cookie';

    /**
     * --------------------------------------------------------------------------
     * CSRF Token Randomization
     * --------------------------------------------------------------------------
     *
     * Randomize the CSRF Token for added security.
     *
     * @var bool
     */
    public $tokenRandomize = true;

    /**
     * --------------------------------------------------------------------------
     * CSRF Token Name
     * --------------------------------------------------------------------------
     *
     * Token name for Cross Site Request Forgery protection.
     *
     * @var string
     */
    public $tokenName = 'csrf_test_name';

    /**
     * --------------------------------------------------------------------------
     * CSRF Header Name
     * --------------------------------------------------------------------------
     *
     * Header name for Cross Site Request Forgery protection.
     *
     * @var string
     */
    public $headerName = 'X-CSRF-TOKEN';

    /**
     * --------------------------------------------------------------------------
     * CSRF Cookie Name
     * --------------------------------------------------------------------------
     *
     * Cookie name for Cross Site Request Forgery protection.
     *
     * @var string
     */
    public $cookieName = 'csrf_cookie_name';

    /**
     * --------------------------------------------------------------------------
     * CSRF Expires
     * --------------------------------------------------------------------------
     *
     * Expiration time for Cross Site Request Forgery protection cookie.
     *
     * Defaults to two hours (in seconds).
     *
     * @var int
     */
    public $expires = 7200;

    /**
     * --------------------------------------------------------------------------
     * CSRF Regenerate
     * --------------------------------------------------------------------------
     *
     * Regenerate CSRF Token on every submission.
     *
     * @var bool
     */
    public $regenerate = false;

    /**
     * --------------------------------------------------------------------------
     * CSRF Redirect
     * --------------------------------------------------------------------------
     *
     * Redirect to previous page with error on failure.
     *
     * @var bool
     */
    public $redirect = true;

    /**
     * --------------------------------------------------------------------------
     * CSRF SameSite
     * --------------------------------------------------------------------------
     *
     * Setting for CSRF SameSite cookie token.
     *
     * Allowed values are: None - Lax - Strict - ''.
     *
     * Defaults to `Lax` as recommended in this link:
     *
     * @see https://portswigger.net/web-security/csrf/samesite-cookies
     *
     * @var string
     *
     * @deprecated `Config\Cookie` $samesite property is used.
     */
    public $samesite = 'Lax';
}

</code>```

Please help me to get the form submission working when csrf is enabled.

MY Codeigniter4 application with a view having a modal which submits form data. This sends a 303 http status when csrf is enalbed; however the form submits data correctly when csrf is disabled.
Where should I correct to get it working with csrf enabled.

Body:
I have a codeignter4 web application with the following view which has a modal which submits data.

<?= esc($title); ?>

        <?php if(session()->getFlashdata('message')):?>
         <?= session()->getFlashdata('message') ?>

          <?php endif;
             unset($_SESSION['message']);
            ?>

 Add New

                                #
                                Authority
                                Action

                        <?php $index = 1; ?>
                        <?php foreach($role as $r) : ?>

                                <?= esc($index); ?>
                                <?= esc($r['role']); ?>

                                    <a class="badge badge-primary" style="font-size:14px;" href="<?= site_url('admin/roleaccess/'.$r['id']); ?>">Manage Access
                                    <a class="badge badge-success" style="font-size:14px;" href="<?= site_url('admin/editrole/'.$r['id']); ?>">Update
                                    <a class="badge badge-danger" style="font-size:14px;" href="#!" onclick="deleteConfirm('<?= site_url('admin/deleterole/'.$r['id']); ?>')">Delete

                        <?php $index++; ?>
                        <?php endforeach; ?>

Add New Authority

        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          ×
        </button>

      <?php

          $attributes = array('id' => 'myform'); ?>

    <?= form_open('admin/addrole'); ?>

                <input type="text" class="form-control" id="role" name="role" placeholder="Name of Authority">

            <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
            <button type="submit" class="btn btn-success">Add</button>

      <? = form_close(); ?>

Are you sure?

        <button class="close" type="button" data-dismiss="modal" aria-label="Close">
          ×
        </button>

Deleted data cannot be recovered!!

        <button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
        Remove

The form submit redirects to the view itself when csrf is enabled. When I check the web console Network tab it shows a 303 status on addrole which is the controller method that handles the form submit data. However it works fine when csrf is disabled.How can I get it working

My Filter Class

<?php

namespace Config;

use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Filters\CSRF;
use CodeIgniter\Filters\DebugToolbar;
use CodeIgniter\Filters\Honeypot;
use CodeIgniter\Filters\InvalidChars;
use CodeIgniter\Filters\SecureHeaders;

class Filters extends BaseConfig
{
    /**
     * Configures aliases for Filter classes to
     * make reading things nicer and simpler.
     *
     * @var array
     */
    public $aliases = [
        'csrf'          => CSRF::class,
        'toolbar'       => DebugToolbar::class,
        'honeypot'      => Honeypot::class,
        'invalidchars'  => InvalidChars::class,
        'secureheaders' => SecureHeaders::class,
        'auth'     => \App\Filters\Auth::class,
    ];

    /**
     * List of filter aliases that are always
     * applied before and after every request.
     *
     * @var array
     */
    /*public $globals = [
        'before' => [
            // 'honeypot',
             'csrf',
            // 'invalidchars',
        ],
        'after' => [
            //'toolbar',
            // 'honeypot',
            // 'secureheaders',
        ],
    ];*/
    public $globals = [
'before' => [
 //'honeypot',
 'csrf',
//'isLoggedIn' => ['except' => ['/', 'admin','users', 'dashboard', 'logout','auth','Ticket/getStatusCounts']],
//'isGranted' => ['except' => ['/', 'admin', 'users','dashboard', 'logout','auth', 'blocked', 'home', 'Welcome/*','Registration/*','profile','profile_save','profile_edit','Ticket/getStatusCounts']],
],
'after' => [
'toolbar',
// 'honeypot',
],
];

    /**
     * List of filter aliases that works on a
     * particular HTTP method (GET, POST, etc.).
     *
     * Example:
     * 'post' => ['foo', 'bar']
     *
     * If you use this, you should disable auto-routing because auto-routing
     * permits any HTTP method to access a controller. Accessing the controller
     * with a method you don’t expect could bypass the filter.
     *
     * @var array
     */
    public $methods = [];

    /**
     * List of filter aliases that should run on any
     * before or after URI patterns.
     *
     * Example:
     * 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
     *
     * @var array
     */
    public $filters = [];
}

My config/App file

<?php

namespace Config;

use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Session\Handlers\FileHandler;

class App extends BaseConfig
{
    /**
     * --------------------------------------------------------------------------
     * Base Site URL
     * --------------------------------------------------------------------------
     *
     * URL to your CodeIgniter root. Typically this will be your base URL,
     * WITH a trailing slash:
     *
     *    http://example.com/
     *
     * If this is not set then CodeIgniter will try guess the protocol, domain
     * and path to your installation. However, you should always configure this
     * explicitly and never rely on auto-guessing, especially in production
     * environments.
     *
     * @var string
     */
    public $baseURL = 'http://localhost/demo/public';

    /**
     * --------------------------------------------------------------------------
     * Index File
     * --------------------------------------------------------------------------
     *
     * Typically this will be your index.php file, unless you've renamed it to
     * something else. If you are using mod_rewrite to remove the page set this
     * variable so that it is blank.
     *
     * @var string
     */
    public $indexPage = 'index.php';

    /**
     * --------------------------------------------------------------------------
     * URI PROTOCOL
     * --------------------------------------------------------------------------
     *
     * This item determines which getServer global should be used to retrieve the
     * URI string.  The default setting of 'REQUEST_URI' works for most servers.
     * If your links do not seem to work, try one of the other delicious flavors:
     *
     * 'REQUEST_URI'    Uses $_SERVER['REQUEST_URI']
     * 'QUERY_STRING'   Uses $_SERVER['QUERY_STRING']
     * 'PATH_INFO'      Uses $_SERVER['PATH_INFO']
     *
     * WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
     *
     * @var string
     */
    public $uriProtocol = 'REQUEST_URI';

    /**
     * --------------------------------------------------------------------------
     * Default Locale
     * --------------------------------------------------------------------------
     *
     * The Locale roughly represents the language and location that your visitor
     * is viewing the site from. It affects the language strings and other
     * strings (like currency markers, numbers, etc), that your program
     * should run under for this request.
     *
     * @var string
     */
    public $defaultLocale = 'en';

    /**
     * --------------------------------------------------------------------------
     * Negotiate Locale
     * --------------------------------------------------------------------------
     *
     * If true, the current Request object will automatically determine the
     * language to use based on the value of the Accept-Language header.
     *
     * If false, no automatic detection will be performed.
     *
     * @var bool
     */
    public $negotiateLocale = false;

    /**
     * --------------------------------------------------------------------------
     * Supported Locales
     * --------------------------------------------------------------------------
     *
     * If $negotiateLocale is true, this array lists the locales supported
     * by the application in descending order of priority. If no match is
     * found, the first locale will be used.
     *
     * @var string[]
     */
    public $supportedLocales = ['en'];

    /**
     * --------------------------------------------------------------------------
     * Application Timezone
     * --------------------------------------------------------------------------
     *
     * The default timezone that will be used in your application to display
     * dates with the date helper, and can be retrieved through app_timezone()
     *
     * @var string
     */
    public $appTimezone = 'Asia/Kolkata';

    /**
     * --------------------------------------------------------------------------
     * Default Character Set
     * --------------------------------------------------------------------------
     *
     * This determines which character set is used by default in various methods
     * that require a character set to be provided.
     *
     * @see http://php.net/htmlspecialchars for a list of supported charsets.
     *
     * @var string
     */
    public $charset = 'UTF-8';

    /**
     * --------------------------------------------------------------------------
     * URI PROTOCOL
     * --------------------------------------------------------------------------
     *
     * If true, this will force every request made to this application to be
     * made via a secure connection (HTTPS). If the incoming request is not
     * secure, the user will be redirected to a secure version of the page
     * and the HTTP Strict Transport Security header will be set.
     *
     * @var bool
     */
    public $forceGlobalSecureRequests = false;

    /**
     * --------------------------------------------------------------------------
     * Session Driver
     * --------------------------------------------------------------------------
     *
     * The session storage driver to use:
     * - `CodeIgniter\Session\Handlers\FileHandler`
     * - `CodeIgniter\Session\Handlers\DatabaseHandler`
     * - `CodeIgniter\Session\Handlers\MemcachedHandler`
     * - `CodeIgniter\Session\Handlers\RedisHandler`
     *
     * @var string
     */
    public $sessionDriver = FileHandler::class;

    /**
     * --------------------------------------------------------------------------
     * Session Cookie Name
     * --------------------------------------------------------------------------
     *
     * The session cookie name, must contain only [0-9a-z_-] characters
     *
     * @var string
     */
    public $sessionCookieName = 'ci_session';

    /**
     * --------------------------------------------------------------------------
     * Session Expiration
     * --------------------------------------------------------------------------
     *
     * The number of SECONDS you want the session to last.
     * Setting to 0 (zero) means expire when the browser is closed.
     *
     * @var int
     */
    public $sessionExpiration = 7200;

    /**
     * --------------------------------------------------------------------------
     * Session Save Path
     * --------------------------------------------------------------------------
     *
     * The location to save sessions to and is driver dependent.
     *
     * For the 'files' driver, it's a path to a writable directory.
     * WARNING: Only absolute paths are supported!
     *
     * For the 'database' driver, it's a table name.
     * Please read up the manual for the format with other session drivers.
     *
     * IMPORTANT: You are REQUIRED to set a valid save path!
     *
     * @var string
     */
    public $sessionSavePath = WRITEPATH . 'session';

    /**
     * --------------------------------------------------------------------------
     * Session Match IP
     * --------------------------------------------------------------------------
     *
     * Whether to match the user's IP address when reading the session data.
     *
     * WARNING: If you're using the database driver, don't forget to update
     *          your session table's PRIMARY KEY when changing this setting.
     *
     * @var bool
     */
    public $sessionMatchIP = false;

    /**
     * --------------------------------------------------------------------------
     * Session Time to Update
     * --------------------------------------------------------------------------
     *
     * How many seconds between CI regenerating the session ID.
     *
     * @var int
     */
    public $sessionTimeToUpdate = 300;

    /**
     * --------------------------------------------------------------------------
     * Session Regenerate Destroy
     * --------------------------------------------------------------------------
     *
     * Whether to destroy session data associated with the old session ID
     * when auto-regenerating the session ID. When set to FALSE, the data
     * will be later deleted by the garbage collector.
     *
     * @var bool
     */
    public $sessionRegenerateDestroy = false;

    /**
     * --------------------------------------------------------------------------
     * Cookie Prefix
     * --------------------------------------------------------------------------
     *
     * Set a cookie name prefix if you need to avoid collisions.
     *
     * @var string
     *
     * @deprecated use Config\Cookie::$prefix property instead.
     */
    public $cookiePrefix = '';

    /**
     * --------------------------------------------------------------------------
     * Cookie Domain
     * --------------------------------------------------------------------------
     *
     * Set to `.your-domain.com` for site-wide cookies.
     *
     * @var string
     *
     * @deprecated use Config\Cookie::$domain property instead.
     */
    public $cookieDomain = '';

    /**
     * --------------------------------------------------------------------------
     * Cookie Path
     * --------------------------------------------------------------------------
     *
     * Typically will be a forward slash.
     *
     * @var string
     *
     * @deprecated use Config\Cookie::$path property instead.
     */
    public $cookiePath = '/';

    /**
     * --------------------------------------------------------------------------
     * Cookie Secure
     * --------------------------------------------------------------------------
     *
     * Cookie will only be set if a secure HTTPS connection exists.
     *
     * @var bool
     *
     * @deprecated use Config\Cookie::$secure property instead.
     */
    public $cookieSecure = false;

    /**
     * --------------------------------------------------------------------------
     * Cookie HttpOnly
     * --------------------------------------------------------------------------
     *
     * Cookie will only be accessible via HTTP(S) (no JavaScript).
     *
     * @var bool
     *
     * @deprecated use Config\Cookie::$httponly property instead.
     */
    public $cookieHTTPOnly = true;

    /**
     * --------------------------------------------------------------------------
     * Cookie SameSite
     * --------------------------------------------------------------------------
     *
     * Configure cookie SameSite setting. Allowed values are:
     * - None
     * - Lax
     * - Strict
     * - ''
     *
     * Alternatively, you can use the constant names:
     * - `Cookie::SAMESITE_NONE`
     * - `Cookie::SAMESITE_LAX`
     * - `Cookie::SAMESITE_STRICT`
     *
     * Defaults to `Lax` for compatibility with modern browsers. Setting `''`
     * (empty string) means default SameSite attribute set by browsers (`Lax`)
     * will be set on cookies. If set to `None`, `$cookieSecure` must also be set.
     *
     * @var string|null
     *
     * @deprecated use Config\Cookie::$samesite property instead.
     */
    public $cookieSameSite = 'Lax';

    /**
     * --------------------------------------------------------------------------
     * Reverse Proxy IPs
     * --------------------------------------------------------------------------
     *
     * If your server is behind a reverse proxy, you must whitelist the proxy
     * IP addresses from which CodeIgniter should trust headers such as
     * HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify
     * the visitor's IP address.
     *
     * You can use both an array or a comma-separated list of proxy addresses,
     * as well as specifying whole subnets. Here are a few examples:
     *
     * Comma-separated: '10.0.1.200,192.168.5.0/24'
     * Array: ['10.0.1.200', '192.168.5.0/24']
     *
     * @var string|string[]
     */
    public $proxyIPs = '';

    /**
     * --------------------------------------------------------------------------
     * CSRF Token Name
     * --------------------------------------------------------------------------
     *
     * The token name.
     *
     * @deprecated Use `Config\Security` $tokenName property instead of using this property.
     *
     * @var string
     */
    public $CSRFTokenName = 'csrf_test_name';

    /**
     * --------------------------------------------------------------------------
     * CSRF Header Name
     * --------------------------------------------------------------------------
     *
     * The header name.
     *
     * @deprecated Use `Config\Security` $headerName property instead of using this property.
     *
     * @var string
     */
    public $CSRFHeaderName = 'X-CSRF-TOKEN';

    /**
     * --------------------------------------------------------------------------
     * CSRF Cookie Name
     * --------------------------------------------------------------------------
     *
     * The cookie name.
     *
     * @deprecated Use `Config\Security` $cookieName property instead of using this property.
     *
     * @var string
     */
    public $CSRFCookieName = 'csrf_cookie_name';

    /**
     * --------------------------------------------------------------------------
     * CSRF Expire
     * --------------------------------------------------------------------------
     *
     * The number in seconds the token should expire.
     *
     * @deprecated Use `Config\Security` $expire property instead of using this property.
     *
     * @var int
     */
    public $CSRFExpire = 7200;

    /**
     * --------------------------------------------------------------------------
     * CSRF Regenerate
     * --------------------------------------------------------------------------
     *
     * Regenerate token on every submission?
     *
     * @deprecated Use `Config\Security` $regenerate property instead of using this property.
     *
     * @var bool
     */
    public $CSRFRegenerate = false;

    /**
     * --------------------------------------------------------------------------
     * CSRF Redirect
     * --------------------------------------------------------------------------
     *
     * Redirect to previous page with error on failure?
     *
     * @deprecated Use `Config\Security` $redirect property instead of using this property.
     *
     * @var bool
     */
    public $CSRFRedirect = false;

    /**
     * --------------------------------------------------------------------------
     * CSRF SameSite
     * --------------------------------------------------------------------------
     *
     * Setting for CSRF SameSite cookie token. Allowed values are:
     * - None
     * - Lax
     * - Strict
     * - ''
     *
     * Defaults to `Lax` as recommended in this link:
     *
     * @see https://portswigger.net/web-security/csrf/samesite-cookies
     * @deprecated `Config\Cookie` $samesite property is used.
     *
     * @var string
     */
    public $CSRFSameSite = 'Lax';

    /**
     * --------------------------------------------------------------------------
     * Content Security Policy
     * --------------------------------------------------------------------------
     *
     * Enables the Response's Content Secure Policy to restrict the sources that
     * can be used for images, scripts, CSS files, audio, video, etc. If enabled,
     * the Response object will populate default values for the policy from the
     * `ContentSecurityPolicy.php` file. Controllers can always add to those
     * restrictions at run time.
     *
     * For a better understanding of CSP, see these documents:
     *
     * @see http://www.html5rocks.com/en/tutorials/security/content-security-policy/
     * @see http://www.w3.org/TR/CSP/
     *
     * @var bool
     */
    public $CSPEnabled = false;

}

My Security class

<?php

namespace Config;

use CodeIgniter\Config\BaseConfig;

class Security extends BaseConfig
{
    /**
     * --------------------------------------------------------------------------
     * CSRF Protection Method
     * --------------------------------------------------------------------------
     *
     * Protection Method for Cross Site Request Forgery protection.
     *
     * @var string 'cookie' or 'session'
     */
    public $csrfProtection = 'cookie';

    /**
     * --------------------------------------------------------------------------
     * CSRF Token Randomization
     * --------------------------------------------------------------------------
     *
     * Randomize the CSRF Token for added security.
     *
     * @var bool
     */
    public $tokenRandomize = true;

    /**
     * --------------------------------------------------------------------------
     * CSRF Token Name
     * --------------------------------------------------------------------------
     *
     * Token name for Cross Site Request Forgery protection.
     *
     * @var string
     */
    public $tokenName = 'csrf_test_name';

    /**
     * --------------------------------------------------------------------------
     * CSRF Header Name
     * --------------------------------------------------------------------------
     *
     * Header name for Cross Site Request Forgery protection.
     *
     * @var string
     */
    public $headerName = 'X-CSRF-TOKEN';

    /**
     * --------------------------------------------------------------------------
     * CSRF Cookie Name
     * --------------------------------------------------------------------------
     *
     * Cookie name for Cross Site Request Forgery protection.
     *
     * @var string
     */
    public $cookieName = 'csrf_cookie_name';

    /**
     * --------------------------------------------------------------------------
     * CSRF Expires
     * --------------------------------------------------------------------------
     *
     * Expiration time for Cross Site Request Forgery protection cookie.
     *
     * Defaults to two hours (in seconds).
     *
     * @var int
     */
    public $expires = 7200;

    /**
     * --------------------------------------------------------------------------
     * CSRF Regenerate
     * --------------------------------------------------------------------------
     *
     * Regenerate CSRF Token on every submission.
     *
     * @var bool
     */
    public $regenerate = false;

    /**
     * --------------------------------------------------------------------------
     * CSRF Redirect
     * --------------------------------------------------------------------------
     *
     * Redirect to previous page with error on failure.
     *
     * @var bool
     */
    public $redirect = true;

    /**
     * --------------------------------------------------------------------------
     * CSRF SameSite
     * --------------------------------------------------------------------------
     *
     * Setting for CSRF SameSite cookie token.
     *
     * Allowed values are: None - Lax - Strict - ''.
     *
     * Defaults to `Lax` as recommended in this link:
     *
     * @see https://portswigger.net/web-security/csrf/samesite-cookies
     *
     * @var string
     *
     * @deprecated `Config\Cookie` $samesite property is used.
     */
    public $samesite = 'Lax';
}

Please help me to get the form submission working when csrf is enabled.

MY Codeigniter4 application with a view having a modal which submits form data. This sends a 303 http status when csrf is enalbed; however the form submits data correctly when csrf is disabled.
Where should I correct to get it working with csrf enabled.


来源: stackexchange

问:
Can anyone please tell me how to debug the platform code in iOS folder in Xcode in a Flutter app?
I have tried debugging in Android Studio and opened Xcode and put breakpoints but it's not working.</p>

ContentLicense: CC BY-SA 4.0


问:
How to JSONify a subdocument in a MongoDB aggregation pipeline
I have a collection containing documents with JSON subdocuments

{
    "field1": {"some_keys_a":42},
    "field2": {"some_keys_b":42},
    "field3": {"some_keys_c":42},
    "fieldN": "..."
}
```
<p>In a aggregation pipeline I need to serialize some of the fields in a string; at first I believed that there ought to be a <code>$json</code> operator I could call like:</p>
<pre class="lang-json prettyprint-override"><code>{
    "$set": {
        "serialied_subdocument": {
            "$toJson": {
                "field1": "$field1",
                "field2": "$field2",
                "field3": "$field3",
            }
        }
    }
}
</code>```

My problem is that it does not look like such an operator exists. Is there another way to convert a subdocument or an array to a JSON string inside a pipeline?

I am using MongoDB 4.4 on Atlas.

For context I was previously using a pipeline with $group with does not require this stringification:

[
    // Omitted $match and other stuff
    {
        "$project": {
            "field1": true,
            "field2": true,
            "field3": true
        }
    },
    {
        "$group": {
            "_id": {
                "field1": "$field1",
                "field2": "$field2",
                "field3": "$field3"
            }
        }
    },
    {
        "$replaceRoot": {
            "newRoot": "$_id"
        }
    }
]
```
<p>but lately the collection has significantly grown in size so I would like to use <code>$merge</code></p>
<pre class="lang-json prettyprint-override"><code>[
    // Omitted $match and other stuff
    {
        "$project": {
            "field1": true,
            "field2": true,
            "field3": true
        }
    },
    {
        "$set": {
            "_id": {
                "field1": "$field1",
                "field2": "$field2",
                "field3": "$field3"
            },
            "lookup_keys_for_later":"random_string_created_by_the_app_to_fetch_the_results"
        }
    },
    {
        "$merge": {
            "into": "unique_field1_field2_field3",
            "on": "_id",
            "whenMatched": "keepExisting",
            "whenNotMatched": "insert"
        }
    }
]
</code>```

after which I would simply fetch the result by the "lookup_keys_for_later" key. The issue is that for $merge the _id needs to be a primitive.

Body:
I have a collection containing documents with JSON subdocuments

{
    "field1": {"some_keys_a":42},
    "field2": {"some_keys_b":42},
    "field3": {"some_keys_c":42},
    "fieldN": "..."
}

In a aggregation pipeline I need to serialize some of the fields in a string; at first I believed that there ought to be a $json operator I could call like:

{
    "$set": {
        "serialied_subdocument": {
            "$toJson": {
                "field1": "$field1",
                "field2": "$field2",
                "field3": "$field3",
            }
        }
    }
}

My problem is that it does not look like such an operator exists. Is there another way to convert a subdocument or an array to a JSON string inside a pipeline?

I am using MongoDB 4.4 on Atlas.

For context I was previously using a pipeline with $group with does not require this stringification:

[
    // Omitted $match and other stuff
    {
        "$project": {
            "field1": true,
            "field2": true,
            "field3": true
        }
    },
    {
        "$group": {
            "_id": {
                "field1": "$field1",
                "field2": "$field2",
                "field3": "$field3"
            }
        }
    },
    {
        "$replaceRoot": {
            "newRoot": "$_id"
        }
    }
]

but lately the collection has significantly grown in size so I would like to use $merge

[
    // Omitted $match and other stuff
    {
        "$project": {
            "field1": true,
            "field2": true,
            "field3": true
        }
    },
    {
        "$set": {
            "_id": {
                "field1": "$field1",
                "field2": "$field2",
                "field3": "$field3"
            },
            "lookup_keys_for_later":"random_string_created_by_the_app_to_fetch_the_results"
        }
    },
    {
        "$merge": {
            "into": "unique_field1_field2_field3",
            "on": "_id",
            "whenMatched": "keepExisting",
            "whenNotMatched": "insert"
        }
    }
]

after which I would simply fetch the result by the "lookup_keys_for_later" key. The issue is that for $merge the _id needs to be a primitive.


问:
AWS Athena: varchar maximum value not matched with query
I created Athena with this query\

```<code>CREATE EXTERNAL TABLE IF NOT EXISTS report (
    `token` varchar(40),
)
PARTITIONED BY ( `created_hour` string)
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
WITH SERDEPROPERTIES (
    'serialization.format' = '1'
) LOCATION 's3://demo-kinesis-athena/'
TBLPROPERTIES (
    'has_encrypted_data'='false',
    'projection.created_hour.format' = 'yyyy/MM/dd/HH',
    'projection.created_hour.interval' = '1',
    'projection.created_hour.interval.unit' = 'HOURS',
    'projection.created_hour.range' = '2018/01/01/00,NOW',
    'projection.created_hour.type' = 'date',
    'projection.enabled' = 'true',
    'storage.location.template' = 's3://demo-kinesis-athena/${created_hour}'
);
</code>```

The query run successfully and the table is created, but if I generate table DDL it gives me the column type to be

```<code>`token` varchar(65535)`
</code>```

instead.

Body:
I created Athena with this query\

CREATE EXTERNAL TABLE IF NOT EXISTS report (
    `token` varchar(40),
)
PARTITIONED BY ( `created_hour` string)
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
WITH SERDEPROPERTIES (
    'serialization.format' = '1'
) LOCATION 's3://demo-kinesis-athena/'
TBLPROPERTIES (
    'has_encrypted_data'='false',
    'projection.created_hour.format' = 'yyyy/MM/dd/HH',
    'projection.created_hour.interval' = '1',
    'projection.created_hour.interval.unit' = 'HOURS',
    'projection.created_hour.range' = '2018/01/01/00,NOW',
    'projection.created_hour.type' = 'date',
    'projection.enabled' = 'true',
    'storage.location.template' = 's3://demo-kinesis-athena/${created_hour}'
);

The query run successfully and the table is created, but if I generate table DDL it gives me the column type to be

`token` varchar(65535)`

instead.


问:
How to resolve "null is not an object" issue with Reducer on React-Native?
I'm working on a React-Native project using expo and I'm facing an issue.

Here is my code.

This is the navSlicer
navSlice.js

```<code>import { createSlice } from "@reduxjs/toolkit";

const initialState = {
    origin: null,
    destination: null,
    travelTimeInformation: null,
}

export const navSlice = createSlice ({
    name: 'nav',
    initialState,
    reducers: {
        setOrigin: (state, action) => {
            state.origin = action.payload;
        },
        setDestination: (state, action) => {
            state.destination = action.payload;
        },
        setTravelTimeInformation: (state, action) => {
            state.travelTimeInformation= action.payload;
        },
    },
});

export const { setOrigin, setDestination, setTravelTimeInformation} = navSlice.actions;

//Selectors

export const selectOrigin = (state) => state.nav.origin;
export const selectDestination = (state) => state.nav.destination;
export const selectTravelTimeInformation = (state) => state.nav.travelTimeInformation;

export default navSlice.reducer;

</code>```

HomeScreen.js

```<code>import { StyleSheet, Text, View, TextInput, KeyboardAvoidingView, Alert, DeviceEventEmitter } from 'react-native'
import React, { useEffect, useRef, useState } from 'react'
import Map from "../../components/Map"
import CustomInput from './CustomInput'
import CustomButton from './CustomButton'

const HomeScreen = () => {

  const [showStart, setShowStart] = useState(false);

  const showOrigin = () => {
    if(showStart) {
      return (
        <View>
          <CustomInput text="Pornire:" placeholder="Initial location"></CustomInput>
        </View>
      )
    }
  }

  return (
    <View style={styles.container}>
      {/* <View style={styles.navbar}>
          <Ionicons name='md-arrow-back-outline' onPress={handleBackButton} style={styles.arrow} size={32} ></Ionicons>
          <Ionicons name='notifications-outline' style={styles.icons} size={32} ></Ionicons>
          <Ionicons name='settings-outline' size={32} ></Ionicons>
      </View> */}
      <View style={{padding: 15, flex: 0}}>
        {showOrigin()}
        <CustomInput text="Destinatie" placeholder="Destination"></CustomInput>
        <CustomButton text="Cauta" onPress={() => setShowStart(true)}></CustomButton>
      </View>
      <Map styles={styles.map} />
    </View>
  )

}
</code>```

This is my Custom Input file for Homescreen that also contains my GooglePlacesAutocomplete component which comunicates with reducer
CustomInput.js

```<code>import { StyleSheet, Text, View, TextInput } from 'react-native'
import React, { useState } from 'react'
import { GooglePlacesAutocomplete } from 'react-native-google-places-autocomplete';
import { GOOGLE_API_KEY } from '@env'
import { useDispatch } from 'react-redux';
import { setDestination, setOrigin } from '../../components/navSlice';

const CustomInput = ({text, placeholder}) => {

  const dispatch = useDispatch();

  return (
    <View>
        <Text style={styles.text}>{text}</Text>
          <GooglePlacesAutocomplete
            styles={{textInput: styles.inputGoogle, container: {flex: 0}}}
            placeholder={placeholder}
            fetchDetails={true}
            enablePoweredByContainer={false}
            minLength={2}
            onPress={(data, details = null) => {
              console.log(data)
              console.log(details)
              dispatch(setOrigin({
                location: details.geometry.location,
                description: data.description,
              }));

              dispatch(setDestination(null));
            }}
            query={{
              key: GOOGLE_API_KEY,
              language: 'en',
            }}
            nearbyPlacesAPI="GooglePlacesSearch"
            debounce={400}
          />
    </View>
  )
}

export default CustomInput
</code>```

The problem looks like it is coming from Map.js where is my MapView created

```<code>import { Dimensions, StyleSheet, Text, View } from 'react-native'
import React from 'react'
import MapView, { Marker, PROVIDER_GOOGLE } from 'react-native-maps'
import { useSelector } from 'react-redux'
import { selectOrigin } from './navSlice'

const Map = () => {

  const origin = useSelector(selectOrigin);

  return (
    <MapView
      style={styles.map}
      provider={PROVIDER_GOOGLE}
      initialRegion={{
        latitude: origin.location.lat,
        longitude: origin.location.lng,
        latitudeDelta: 0.005,
        longitudeDelta: 0.005,
    }}
  />
  )
}
</code>```

The error is the following:

ERROR  TypeError: null is not an object (evaluating 'origin.location')

This error is located at:
    in Map (created by HomeScreen)
    in RCTView (created by View)
    in View (created by HomeScreen)
    in HomeScreen (created by SceneView)
    in StaticContainer
    in EnsureSingleNavigator (created by SceneView)```

Body:
I'm working on a React-Native project using expo and I'm facing an issue.

Here is my code.

This is the navSlicer
navSlice.js

import { createSlice } from "@reduxjs/toolkit";

const initialState = {
    origin: null,
    destination: null,
    travelTimeInformation: null,
}

export const navSlice = createSlice ({
    name: 'nav',
    initialState,
    reducers: {
        setOrigin: (state, action) => {
            state.origin = action.payload;
        },
        setDestination: (state, action) => {
            state.destination = action.payload;
        },
        setTravelTimeInformation: (state, action) => {
            state.travelTimeInformation= action.payload;
        },
    },
});

export const { setOrigin, setDestination, setTravelTimeInformation} = navSlice.actions;

//Selectors

export const selectOrigin = (state) => state.nav.origin;
export const selectDestination = (state) => state.nav.destination;
export const selectTravelTimeInformation = (state) => state.nav.travelTimeInformation;

export default navSlice.reducer;

HomeScreen.js

import { StyleSheet, Text, View, TextInput, KeyboardAvoidingView, Alert, DeviceEventEmitter } from 'react-native'
import React, { useEffect, useRef, useState } from 'react'
import Map from "../../components/Map"
import CustomInput from './CustomInput'
import CustomButton from './CustomButton'

const HomeScreen = () => {

  const [showStart, setShowStart] = useState(false);

  const showOrigin = () => {
    if(showStart) {
      return (
        <View>
          <CustomInput text="Pornire:" placeholder="Initial location"></CustomInput>
        </View>
      )
    }
  }

  return (
    <View style={styles.container}>
      {/* <View style={styles.navbar}>
          <Ionicons name='md-arrow-back-outline' onPress={handleBackButton} style={styles.arrow} size={32} ></Ionicons>
          <Ionicons name='notifications-outline' style={styles.icons} size={32} ></Ionicons>
          <Ionicons name='settings-outline' size={32} ></Ionicons>
      </View> */}
      <View style={{padding: 15, flex: 0}}>
        {showOrigin()}
        <CustomInput text="Destinatie" placeholder="Destination"></CustomInput>
        <CustomButton text="Cauta" onPress={() => setShowStart(true)}></CustomButton>
      </View>
      <Map styles={styles.map} />
    </View>
  )

}

This is my Custom Input file for Homescreen that also contains my GooglePlacesAutocomplete component which comunicates with reducer
CustomInput.js

import { StyleSheet, Text, View, TextInput } from 'react-native'
import React, { useState } from 'react'
import { GooglePlacesAutocomplete } from 'react-native-google-places-autocomplete';
import { GOOGLE_API_KEY } from '@env'
import { useDispatch } from 'react-redux';
import { setDestination, setOrigin } from '../../components/navSlice';

const CustomInput = ({text, placeholder}) => {

  const dispatch = useDispatch();

  return (
    <View>
        <Text style={styles.text}>{text}</Text>
          <GooglePlacesAutocomplete
            styles={{textInput: styles.inputGoogle, container: {flex: 0}}}
            placeholder={placeholder}
            fetchDetails={true}
            enablePoweredByContainer={false}
            minLength={2}
            onPress={(data, details = null) => {
              console.log(data)
              console.log(details)
              dispatch(setOrigin({
                location: details.geometry.location,
                description: data.description,
              }));

              dispatch(setDestination(null));
            }}
            query={{
              key: GOOGLE_API_KEY,
              language: 'en',
            }}
            nearbyPlacesAPI="GooglePlacesSearch"
            debounce={400}
          />
    </View>
  )
}

export default CustomInput

The problem looks like it is coming from Map.js where is my MapView created

import { Dimensions, StyleSheet, Text, View } from 'react-native'
import React from 'react'
import MapView, { Marker, PROVIDER_GOOGLE } from 'react-native-maps'
import { useSelector } from 'react-redux'
import { selectOrigin } from './navSlice'

const Map = () => {

  const origin = useSelector(selectOrigin);

  return (
    <MapView
      style={styles.map}
      provider={PROVIDER_GOOGLE}
      initialRegion={{
        latitude: origin.location.lat,
        longitude: origin.location.lng,
        latitudeDelta: 0.005,
        longitudeDelta: 0.005,
    }}
  />
  )
}

The error is the following:

ERROR  TypeError: null is not an object (evaluating 'origin.location')

This error is located at:
    in Map (created by HomeScreen)
    in RCTView (created by View)
    in View (created by HomeScreen)
    in HomeScreen (created by SceneView)
    in StaticContainer
    in EnsureSingleNavigator (created by SceneView)


问:
How to show image in Excel file download by Maatwebsite package in Laravel 8 project?
I want to show images from the database in an Excel file downloaded using the Laravel Maatwebsite package.

Controller

```<code>$data['company_names'] = Company::where('id', Auth::user()->com_id)
    ->first(['company_name']);
$data['companies'] = $companies;
$data['users'] = $users;
$data['regions'] = $regions;
$data['roles'] = $roles;
$exl = Excel::download(new EmployeeReportExport($data),
    'Employee-Report.xlsx');
ob_end_clean();

return $exl;
</code>```

Export Code

```<code>namespace App\Exports;

use Maatwebsite\Excel\Concerns\FromCollection;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView;

class EmployeeReportExport implements FromView
{
    public function __construct($data)
    {
        $this->data = $data;
    }

    public function view(): View
    {
        return view('back-end.premium.hr-reports.employee-report.employee-bulk-report-excel', [
            'data' => $this->data
        ]);
    }
}
</code>```

Blade

```<code><td>{{ $i++ }}</td>
<td>{{ $usersData->company_assigned_id ?? '' }}</td>
<td>{{ $usersData->first_name . ' ' . $usersData->last_name }}</td>
<td><img src="{{ asset($usersData->profile_photo) ?? '' }}" alt=""></td>
<td>{{ $usersData->email ?? null }}</td>
<td>{{ $usersData->phone }}</td>
</code>```

But it's not showing in the Excel file; it returns the following error.

file_get_contents(http://127.0.0.1:8000/uploads/profile_photos/1667727818.jpg):
failed to open stream: HTTP request failed!

Body:
I want to show images from the database in an Excel file downloaded using the Laravel Maatwebsite package.

Controller

$data['company_names'] = Company::where('id', Auth::user()->com_id)
    ->first(['company_name']);
$data['companies'] = $companies;
$data['users'] = $users;
$data['regions'] = $regions;
$data['roles'] = $roles;
$exl = Excel::download(new EmployeeReportExport($data),
    'Employee-Report.xlsx');
ob_end_clean();

return $exl;

Export Code

namespace App\Exports;

use Maatwebsite\Excel\Concerns\FromCollection;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView;

class EmployeeReportExport implements FromView
{
    public function __construct($data)
    {
        $this->data = $data;
    }

    public function view(): View
    {
        return view('back-end.premium.hr-reports.employee-report.employee-bulk-report-excel', [
            'data' => $this->data
        ]);
    }
}

Blade

{{ $i++ }}
{{ $usersData->company_assigned_id ?? '' }}
{{ $usersData->first_name . ' ' . $usersData->last_name }}
profile_photo) ?? '' }}" alt="">
{{ $usersData->email ?? null }}
{{ $usersData->phone }}

But it's not showing in the Excel file; it returns the following error.

file_get_contents(http://127.0.0.1:8000/uploads/profile_photos/1667727818.jpg):
failed to open stream: HTTP request failed!


问:
I'm using the mssql database and I have an API so I can get the data from it. But I can't access database using react native
I'm using the mssql database and I have an API so I can get the data from it. But I can't access database using react native. The data I can pull is only the field defined in the body part in Postman. How can I access all the data in the database. Thanks.`

```<code>var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

</code>```

const obj = JSON.parse(raw);
const obj2=JSON.parse(obj.LisansTerminal);

```<code>

var raw = JSON.stringify({
  "KullaniciKodu": "001",
  "KullaniciSifresi": "001",
  "LisansTerminal": "{\"Id\":1060,\"SubeId\":5,\"Durum\":0,\"Adi\":\"NEXUS\",\"SeriNumarasi\":\"L2NDU19823001982\",\"EvrenselNumara\":\"fbc72efc7920b71f\",\"Marka\":\"\",\"Model\":\"\",\"Uretici\":\"\",\"OlusturmaTarihi\":\"2019-10-20T20:45:28.22\"}"
});

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("http://localhost/Login.svc/example", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
</code>```
```<code>
 const myFunc = () => {
    if (isLoading) {
      return <ActivityIndicator size="small" color={"red"}/>;
    }
    if (userName===obj.KullaniciKodu && number === obj.KullaniciSifresi) {
   return navigation.navigate("UserLogin", {firma:"CODES-EBRU",kullanici:obj.KullaniciKodu,donem:"2022", sube:"MERKEZ", kasa:'ANA KASA' })}
   else {
      return Alert.alert("Hatalı Giriş", "Tekrar Deneyiniz")
   }
  };

</code>```

`

Access database datas and using them login page.

Body:
I'm using the mssql database and I have an API so I can get the data from it. But I can't access database using react native. The data I can pull is only the field defined in the body part in Postman. How can I access all the data in the database. Thanks.`

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

const obj = JSON.parse(raw);
const obj2=JSON.parse(obj.LisansTerminal);

var raw = JSON.stringify({
  "KullaniciKodu": "001",
  "KullaniciSifresi": "001",
  "LisansTerminal": "{\"Id\":1060,\"SubeId\":5,\"Durum\":0,\"Adi\":\"NEXUS\",\"SeriNumarasi\":\"L2NDU19823001982\",\"EvrenselNumara\":\"fbc72efc7920b71f\",\"Marka\":\"\",\"Model\":\"\",\"Uretici\":\"\",\"OlusturmaTarihi\":\"2019-10-20T20:45:28.22\"}"
});

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("http://localhost/Login.svc/example", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

 const myFunc = () => {
    if (isLoading) {
      return <ActivityIndicator size="small" color={"red"}/>;
    }
    if (userName===obj.KullaniciKodu && number === obj.KullaniciSifresi) {
   return navigation.navigate("UserLogin", {firma:"CODES-EBRU",kullanici:obj.KullaniciKodu,donem:"2022", sube:"MERKEZ", kasa:'ANA KASA' })}
   else {
      return Alert.alert("Hatalı Giriş", "Tekrar Deneyiniz")
   }
  };

`

Access database datas and using them login page.


问:
Unity build issue over 16+ hours
So has anyone had this issue, ever since I've updated my graphics card (doubt that is the cause)

Building the unity project, takes an insane amount of time, its not stuck the shader variants are slowly compiling.

The issue is that this has never happened before, the build times usually range between 10 minutes and 3-4 hours on clean builds.

Any ideas, has anyone had issue before?

If I go out and build each individual scene on their own, it takes about 5-10 minutes.

If I build multiple scenes, still about 10-20 minutes.

If build all them.. the building process seems to slow to a halt.

I've changed things in the player settings, made sure optimize mesh has been checked off in player settings.

I've even purchased the asset shader control, which has haha... done nothing.

EDIT:.... So... it built... after 2 hours now. I don't know what I did differently, other than building every scene individually ... and setting every shader compiler process to high... unity man.

Title: Unity build issue over 16+ hours


问:
Github doesn't reckognize repository initialized in non empty folder
I've initialized a repository in my folder that already contained the repo files but was missing git folder using:

```<code>git init
git remote add origin myrepolink.git
</code>```

after adding local repository in github desktop it correctly reckognises the repository name and starts refreshing and when finished it says "Can't find "CorrectRepoName" it was last seen at "location of repo"

Body:
I've initialized a repository in my folder that already contained the repo files but was missing git folder using:

git init
git remote add origin myrepolink.git

after adding local repository in github desktop it correctly reckognises the repository name and starts refreshing and when finished it says "Can't find "CorrectRepoName" it was last seen at "location of repo"