dimanche 7 mai 2023

Query builder all data loading

I want to show only the people the user is messaging, but all users are showing. How can i fix this?

SQL PHOTO: https://i.stack.imgur.com/6pOPa.png

 public static function otherUserData($user_id)

  {

    $value = DB::table('users')

    ->select(['*', DB::raw('MAX(conver_date) AS lastConver')])

    ->leftJoin('conversation', function ($join) use ($user_id) {

        $join->on('conversation.conver_seller_id', '=', 'users.id')

            ->on('conversation.conver_user_id', '=', DB::raw($user_id))

            ->orOn('conversation.conver_seller_id', '=', DB::raw($user_id))

            ->on('conversation.conver_user_id', '=', 'users.id'); 

    })

    ->where('user_type', '!=', 'admin')

    ->where('id', '!=', $user_id)

    ->where('drop_status', '=', 'no')

    ->orderBy('lastConver', 'desc')

    ->groupBy('id')

    ->get(); 



return $value;

  }

I would be very grateful if you could help.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/F67L4SU
via IFTTT

samedi 6 mai 2023

Query Builder Spefic Query

i want to show only the contacts that the user is messaging, I don't want the people that the user has not messaged to appear. How can i fix this?

DATABASE: DATABASE PHOTO

Query Command:

 public static function otherUserData($user_id)

  {

    $value = DB::table('users')

    ->select(['*', DB::raw('MAX(conver_date) AS lastConver')])

    ->leftJoin('conversation', function ($join) use ($user_id) {

        $join->on('conversation.conver_seller_id', '=', 'users.id')

            ->on('conversation.conver_user_id', '=', DB::raw($user_id))

            ->orOn('conversation.conver_seller_id', '=', DB::raw($user_id))

            ->on('conversation.conver_user_id', '=', 'users.id'); 

    })

    ->where('user_type', '!=', 'admin')

    ->where('id', '!=', $user_id)

    ->where('drop_status', '=', 'no')

    ->orderBy('lastConver', 'desc')

    ->groupBy('id')

    ->get(); 



return $value;

  }

I will be glad if you help me thank you.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/BJPcgfT
via IFTTT

vendredi 5 mai 2023

when my laravel proj keep in wampp C:\wamp64\www than why this is use xampp version and ^7.1.3 your php version (8.1.6) not satisfy with requirement

enter image description here

Problem 29 - phpunit/php-file-iterator is locked to version 2.0.2 and an update of this package was not requested. - phpunit/php-file-iterator 2.0.2 requires php ^7.1 -> your php version (8.1.6) does not satisfy that requirement. Problem 30 - phpunit/php-timer is locked to version 2.0.0 and an update of this package was not requested. - phpunit/php-timer 2.0.0 requires php ^7.1 -> your php version (8.1.6) does not satisfy that requirement. Problem 31 - phpunit/php-token-stream is locked to version 3.0.0 and an update of this package was not requested. - phpunit/php-token-stream 3.0.0 requires php ^7.1 -> your php version (8.1.6) does not satisfy that requirement. Problem 32 - phpunit/phpunit is locked to version 7.3.5 and an update of this package was not requested. - phpunit/phpunit 7.3.5 requires php ^7.1 -> your php version (8.1.6) does not satisfy that requirement. Problem 33 - sebastian/code-unit-reverse-lookup is locked to version 1.0.1 and an update of this package was not requested. - sebastian/code-unit-reverse-lookup 1.0.1 requires php ^5.6 || ^7.0 -> your php version (8.1.6) does not satisfy that requirement. Problem 34 - sebastian/comparator is locked to version 3.0.2 and an update of this package was not requested. - sebastian/comparator 3.0.2 requires php ^7.1 -> your php version (8.1.6) does not satisfy that requirement. Problem 35 - sebastian/diff is locked to version 3.0.1 and an update of this package was not requested. - sebastian/diff 3.0.1 requires php ^7.1 -> your php version (8.1.6) does not satisfy that requirement. Problem 36 - sebastian/environment is locked to version 3.1.0 and an update of this package was not requested. - sebastian/environment 3.1.0 requires php ^7.0 -> your php version (8.1.6) does not satisfy that requirement. Problem 37 - sebastian/exporter is locked to version 3.1.0 and an update of this package was not requested. - sebastian/exporter 3.1.0 requires php ^7.0 -> your php version (8.1.6) does not satisfy that requirement. Problem 38 - sebastian/global-state is locked to version 2.0.0 and an update of this package was not requested. - sebastian/global-state 2.0.0 requires php ^7.0 -> your php version (8.1.6) does not satisfy that requirement. Problem 39 - sebastian/object-enumerator is locked to version 3.0.3 and an update of this package was not requested. - sebastian/object-enumerator 3.0.3 requires php ^7.0 -> your php version (8.1.6) does not satisfy that requirement. Problem 40 - sebastian/object-reflector is locked to version 1.1.1 and an update of this package was not requested. - sebastian/object-reflector 1.1.1 requires php ^7.0 -> your php version (8.1.6) does not satisfy that requirement. Problem 41 - sebastian/recursion-context is locked to version 3.0.0 and an update of this package was not requested. - sebastian/recursion-context 3.0.0 requires php ^7.0 -> your php version (8.1.6) does not satisfy that requirement.fy that requirement. Problem 42 - theseer/tokenizer is locked to version 1.1.0 and an update of this package was not requested. quirement. - theseer/tokenizer 1.1.0 requires php ^7.0 -> your php version (8.1.6) does not satisfy that requirement. Problem 43 y that requirement. - webmozart/assert is locked to version 1.3.0 and an update of this package was not requested. - webmozart/assert 1.3.0 requires php ^5.3.3 || ^7.0 -> your php version (8.1.6) does not satisfy that requirement.y that requirement. ny/http-foundation[v4.1.4]. Problem 44 sted. - symfony/http-foundation v4.1.4 requires php ^7.1.3 -> your php version (8.1.6) does not satisfy that requirement. - barryvdh/laravel-cors v0.11.2 requires symfony/http-foundation ^3.1|^4 -> satisfiable by symfony/http-foundation[v4.1.4]. - barryvdh/laravel-cors is locked to version v0.11.2 and an update of this package was not requested.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/8tNcHoE
via IFTTT

jeudi 4 mai 2023

Laravel file storage issues

I have an issue with Laravel

Case:

  1. Create a file test.csv with data "abcdefg"
  2. Delete the file test.csv
  3. Recreate the file test.csv with data "zmamamama"

My code

$data = "asdsdsds";

 if(file_exists(storage_path('app/public/test/test.csv'))){
   unlink(storage_path('app/public/test/test.csv' ));
 }

Excel::store(new SomeTest($data), '/public/test/test.csv');

The issue is that test.csv still shows the old data ("abcdefg") even though the file o nthe local server show the new data accessed the file from the URL test.com/storage/test/test.csv

I'm using CentOS on the machine running my Laravel server.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/njTOlyz
via IFTTT

mercredi 3 mai 2023

Laravel MySQL Full text search InnoDB Relevancy Calculation for multiple rows with same number of occurences in total

using mysql from xaamp v8.1.10 along with laravel v5.5.3.

Full text Search Index enabled in table 'ex1' for column 'des' and 'ft_min_word_len = 1'.

laravel query:

$string='pink item product';

$result = ex::active()->selectRaw("*,match(des) against('$string' in boolean mode)  as relevance")->whereRaw("match(des) against('$string' in boolean mode)")->orderBy('relevance', 'desc')->get();

I am getting the result as

( results are truncated )

id Relevance des
64 1.3543391227722 amazing pink petite lace item is item.
182 1.3543391227722 this pink tall polyester item is item.
598 1.3543391227722 which pink large polyester item is item.
653 1.3543391227722 amazing pink plus size linen item is item.
808 1.3543391227722 what pink tall cashmere item is item.
19 1.344024181366 different pink large silk product is item.
134 1.344024181366 that pink large wool product is item.
140 1.344024181366 this pink tall lace item is product.
233 1.344024181366 new pink extra-small lace item is product.
273 1.344024181366 this pink tall cashmere item is product.
625 1.344024181366 amazing pink medium lace product is item.
893 1.344024181366 pink extra-small leather item is product.
908 1.344024181366 which pink tall lace product is item.
992 1.344024181366 this pink large cotton product is item.
21 1.3337094783783 pink extra-small cashmere product is product.

My question is :

id Relevance des
64 1.3543391227722 amazing pink petite lace item is item.
21 1.3337094783783 that pink extra-small cashmere product is product.

though having the same number of occurences:

column 64 has : item-2 times, pink-1 time and column 21 has : product-2 times pink-1 time.

Initial Thoughts

I thought the calculation is like this:

(refrence from MySQL FUll Text Search Doc, which says:)

${rank} = ${TF} * ${IDF} * ${IDF} + ${TF} * ${IDF} * ${IDF}

SELECT (1*log10(8/6)*log10(8/6)) + (2*log10(8/2)*log10(8/2));

which is :

(number of occurences of word 1* log10(total records in table/total matching records where the word is found) + (number of occurences of word 2* log10(total records in table/total matching records where the word is found) + ... + (number of occurences of word n * log10(total records in table/total matching records where the word n is found)

my question is how is the relevance calulated ?

also, even though column 64 and column 182 has same set of occureneces, both has pink-1 time and item-2 times, the relevance for column 64 is higher. why ?

initially i though this was based on row number in database, the order in which it was created. But in that case, my first question should be invalid as column 21 should come before column 64. I cant understand how it is calculated.

i did calculation this far with MySQL doc on full text search and i cant find a documnetation covering this kind of scenario.

Thanks in Advance.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/XOySMDP
via IFTTT

lundi 1 mai 2023

How to fix this issue "PHP Fatal error: Uncaught Error: Call to private PHPUnit\Framework\TestSuite::__construct() from scope"

I am facing below mentioned issue when executing the command "phpunit" in Lumen:

PHP Fatal error:  Uncaught Error: Call to private PHPUnit\Framework\TestSuite::__construct() from scope PHPUnit\TextUI\TestSuiteMapper in /usr/share/php/PHPUnit/TextUI/TestSuiteMapper.php:38
Stack trace:
#0 /usr/share/php/PHPUnit/TextUI/Command.php(390): PHPUnit\TextUI\TestSuiteMapper->map()
#1 /usr/share/php/PHPUnit/TextUI/Command.php(111): PHPUnit\TextUI\Command->handleArguments()
#2 /usr/share/php/PHPUnit/TextUI/Command.php(96): PHPUnit\TextUI\Command->run()
#3 /usr/bin/phpunit(73): PHPUnit\TextUI\Command::main()
#4 {main}
Next PHPUnit\TextUI\RuntimeException: Call to private PHPUnit\Framework\TestSuite::__construct() from scope PHPUnit\TextUI\TestSuiteMapper in /usr/share/php/PHPUnit/TextUI/Command.php:98
Stack trace:
#0 /usr/bin/phpunit(73): PHPUnit\TextUI\Command::main()
#1 {main}
  thrown in /usr/share/php/PHPUnit/TextUI/Command.php on line 98


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/DEvFSHV
via IFTTT

Solving dependecy confilct for upgraing laravel backpack

I'm attempting to upgrade laravel backpack to v3.4.0 guiding by this document.

currently this laravel version is 5.7.x.(yeah it is really outdated project).

in 9th step says run php artisan backpack:base:install, when in run this command this error will be occur :


The command "composer require laracasts/generators:dev-master --dev" failed.           
                                                                                         
  Exit Code: 2(Misuse of shell builtins)                                                 
                                                                                         
  Working directory: /home/user/php/laravel/                             
                                                                                         
  Output:                                                                                
  ================                                                                       
                                                                                         
                                                                                         
  Error Output:                                                                          
  ================                                                                       
  ./composer.json has been updated                                                       
  Running composer update laracasts/generators                                           
  Loading composer repositories with package information                                 
  Updating dependencies                                                                  
  Your requirements could not be resolved to an installable set of packages.             
                                                                                         
    Problem 1                                                                            
      - Root composer.json requires laracasts/generators dev-master -> satisfiable by l  
  aracasts/generators[dev-master].                                                       
      - laracasts/generators dev-master requires illuminate/support ~6.0|~7.0|~8.0|~9.0  
  |^10.0 -> found illuminate/support[v6.0.0, ..., v6.20.44, v7.0.0, ..., v7.30.6, v8.0.  
  0, ..., v8.83.27, v9.0.0, ..., v9.52.7, v10.0.0, ..., v10.9.0] but these were not loa  
  ded, likely because it conflicts with another require.                                 
                                                                                         
  Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removal  
  s for packages currently locked to specific versions.                                  
                                                                                         
  Installation failed, reverting ./composer.json and ./composer.lock to their original   
  content.

In summary laracasts/generators depends on illuminate/support v6.0.0 - v10.9.0 which is not loaded.

how should i solve this conflict?

as error says : i have tried run this command with -W option which is : composer require laracasts/generators:dev-master --dev -W and same error has occured :

- Root composer.json requires laracasts/generators dev-master -> satisfiable by laracasts/generators[dev-master].
    - laracasts/generators dev-master requires illuminate/support ~6.0|~7.0|~8.0|~9.0|^10.0 -> found illuminate/support[v6.0.0, ..., v6.20.44, v7.0.0, ..., v7.30.6, v8.0.0, ..., v8.83.27, v9.0.0, ..., v9.52.7, v10.0.0, ..., v10.9.0] but these were not loaded, likely because it conflicts with another require.
`



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/qJCKiNT
via IFTTT