mercredi 1 décembre 2021

Laravel 5.x error install "Class ExpectedQPair.php doesn't comply with psr-4 autoloading standard "

I took a project that is in laravel 5.6, and did the usual... clone, composer-update, and I got this error message.

image error enter image description here

Class Egulias\EmailValidator\Exception\ExpectedQPair located in C:/laragon/www/spa-blog/vendor/egulias/email-validator/EmailValidator\Exception\ExpectingQPair.php does not comply with psr-4 autoloading standard. Skipping.
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover


  [ErrorException]
  Undefined index: name


Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1

I created the .env and generated the key, but it didn't allow me to run composer install or update either. I did the typical clean cache and dump-autoload, but I still can't move forward with the project.

What can be happening, what do you recommend me to do to solve this error?

Thank you in advance



via Chebli Mohamed

csrf-token mismatch error in laravel on server

I'm using this code to submit data through ajax in laravel

$('#submit').submit(function (e) {
    e.preventDefault();

    let formData = new FormData(this);

    $.ajaxSetup({
        headers: {
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });
    $.ajax({
        xhr: function() {
          var xhr = new window.XMLHttpRequest();
      
          xhr.upload.addEventListener("progress", function(evt) {
            if (evt.lengthComputable) {
              var percentComplete = evt.loaded / evt.total;
              percentComplete = parseInt(percentComplete * 100);
             
      
              if (percentComplete === 100) {
               
              }
      
            }
          }, false);
      
          return xhr;
        },
        url: $(this).attr('action'),
        type: "POST",
        data:  formData,
        dataType:'JSON',
        contentType:false,
        cache: false,
        processData: false,

but getting csrf token mismatch when i upload my code on live server.

enter image description here

enter image description here

Any solution is highly appreciated Thanks



via Chebli Mohamed

Can anybody tell the if file doesn't exists it redirect to webinstaller

Can anybody tell the if file doesn't exists it redirect to webinstall. How to go the redirection to webinstaller url in laravel when i deleting the .env file is 500 error



via Chebli Mohamed

convert a sql query to php laravel query

convert a sql query to php laravel query .

DB::select("SELECT distinct q_id,theme, ownerID, p_id, q_type, screen, leadin,
        scenario, option_text, o_media, correct, display_method,
        score_method, q_media, q_media_width, q_media_height, marks_correct,
        marks_incorrect, display_pos, STATUS, correct_fback, feedback_right,last_edited,
        locked, settings FROM (papers, questions) LEFT JOIN options ON questions.q_id = options.o_id WHERE paper=$id AND papers.question=questions.q_id GROUP BY(q_id)  ORDER BY screen ASC");


via Chebli Mohamed

Need values from XML as per option

enter image description here

I have this dropdown option, after choosing an option I have to fetch the values from the XML file. Suppose if I choose "Products > Product > LongDescription" then fetch all the values of "LongDescription" from the XML file like following

array (
   0=>'Don't forget me this weekend!',
   1=>null,
   2=>null,
   3=>'Test description'
)

XML File

<?xml version="1.0" encoding="UTF-8"?>
<Products>
  <Product>
    <SKU>RR02</SKU>
    <Name>Samsung Cable for QLED TVs, 15m</Name>
    <ShortDescription></ShortDescription>
    <LongDescription>Don't forget me this weekend!</LongDescription>
    <Quantity>10</Quantity>
    <BuyPrice>8</BuyPrice>
    <Price>10</Price>
    <SalePrice>9</SalePrice>
  </Product>
  <Product>
    <SKU>ITEM-000249</SKU>
    <Name>71T6550</Name>
    <ShortDescription></ShortDescription>
    <LongDescription></LongDescription>
    <Quantity>0</Quantity>
    <BuyPrice>0</BuyPrice>
    <Price>0</Price>
    <SalePrice>0</SalePrice>
  </Product>
  <Product>
    <SKU>ITEM-1</SKU>
    <Name></Name>
    <ShortDescription></ShortDescription>
    <LongDescription></LongDescription>
    <Quantity>0</Quantity>
    <BuyPrice>0</BuyPrice>
    <Price>0</Price>
    <SalePrice>0</SalePrice>
  </Product>
  <Product>
    <SKU>ITEM-2</SKU>
    <Name></Name>
    <ShortDescription></ShortDescription>
    <LongDescription></LongDescription>
    <Quantity>3</Quantity>
    <BuyPrice>15</BuyPrice>
    <Price>20</Price>
    <SalePrice>18</SalePrice>
  </Product>
</Products>


via Chebli Mohamed

Need values from XML depending on choosed option

<select class="xml-data-select"><option value="">Choose XML Heading</option><option value="Products > Product > SKU">Products &gt; Product &gt; SKU</option><option value="Products > Product > Name">Products &gt; Product &gt; Name</option><option value="Products > Product > LongDescription">Products &gt; Product &gt; LongDescription</option><option value="Products > Product > Quantity">Products &gt; Product &gt; Quantity</option><option value="Products > Product > BuyPrice">Products &gt; Product &gt; BuyPrice</option><option value="Products > Product > Price">Products &gt; Product &gt; Price</option><option value="Products > Product > SalePrice">Products &gt; Product &gt; SalePrice</option></select>

I have this dropdown option, after choosing an option I have to fetch the values from the XML file. Suppose if I choose "Products > Product > LongDescription" then fetch all the values of "LongDescription" from the XML file like following

array (
   0=>'Don't forget me this weekend!',
   1=>null,
   2=>null,
   3=>'Test description'
)

XML File

<?xml version="1.0" encoding="UTF-8"?>
<Products>
  <Product>
    <SKU>RR02</SKU>
    <Name>Samsung Cable for QLED TVs, 15m</Name>
    <ShortDescription></ShortDescription>
    <LongDescription>Don't forget me this weekend!</LongDescription>
    <Quantity>10</Quantity>
    <BuyPrice>8</BuyPrice>
    <Price>10</Price>
    <SalePrice>9</SalePrice>
  </Product>
  <Product>
    <SKU>ITEM-000249</SKU>
    <Name>71T6550</Name>
    <ShortDescription></ShortDescription>
    <LongDescription></LongDescription>
    <Quantity>0</Quantity>
    <BuyPrice>0</BuyPrice>
    <Price>0</Price>
    <SalePrice>0</SalePrice>
  </Product>
  <Product>
    <SKU>ITEM-1</SKU>
    <Name></Name>
    <ShortDescription></ShortDescription>
    <LongDescription></LongDescription>
    <Quantity>0</Quantity>
    <BuyPrice>0</BuyPrice>
    <Price>0</Price>
    <SalePrice>0</SalePrice>
  </Product>
  <Product>
    <SKU>ITEM-2</SKU>
    <Name></Name>
    <ShortDescription></ShortDescription>
    <LongDescription></LongDescription>
    <Quantity>3</Quantity>
    <BuyPrice>15</BuyPrice>
    <Price>20</Price>
    <SalePrice>18</SalePrice>
  </Product>
</Products>


via Chebli Mohamed

How can I get values from XML array [closed]

enter image description here

I have this dropdown option, after choosing an option I have to fetch the values from the XML file. Suppose if I choose "Products > Product > LongDescription" then fetch all the values of "LongDescription" from the XML file like following

array (
   0=>'Don't forget me this weekend!',
   1=>null,
   2=>null,
   3=>'Test description'
)

XML File

<?xml version="1.0" encoding="UTF-8"?>
<Products>
  <Product>
    <SKU>RR02</SKU>
    <Name>Samsung Cable for QLED TVs, 15m</Name>
    <ShortDescription></ShortDescription>
    <LongDescription>Don't forget me this weekend!</LongDescription>
    <Quantity>10</Quantity>
    <BuyPrice>8</BuyPrice>
    <Price>10</Price>
    <SalePrice>9</SalePrice>
  </Product>
  <Product>
    <SKU>ITEM-000249</SKU>
    <Name>71T6550</Name>
    <ShortDescription></ShortDescription>
    <LongDescription></LongDescription>
    <Quantity>0</Quantity>
    <BuyPrice>0</BuyPrice>
    <Price>0</Price>
    <SalePrice>0</SalePrice>
  </Product>
  <Product>
    <SKU>ITEM-1</SKU>
    <Name></Name>
    <ShortDescription></ShortDescription>
    <LongDescription></LongDescription>
    <Quantity>0</Quantity>
    <BuyPrice>0</BuyPrice>
    <Price>0</Price>
    <SalePrice>0</SalePrice>
  </Product>
  <Product>
    <SKU>ITEM-2</SKU>
    <Name></Name>
    <ShortDescription></ShortDescription>
    <LongDescription></LongDescription>
    <Quantity>3</Quantity>
    <BuyPrice>15</BuyPrice>
    <Price>20</Price>
    <SalePrice>18</SalePrice>
  </Product>
</Products>


via Chebli Mohamed