Is there a better performance in every page request than requesting data from cache again?

|
skys215 2020-02-28 15:33:48
Mani 2020-02-28 12:55:51

You mean change db depend on request?

codewithah 2020-02-28 15:58:45
Hi.Do you what is this error.
InvalidArgumentException: Unable to locate factory with name [default] [AppProject].

I want to create a unit test for my “Project ” Model.I want use fake information via “Factory”.The my code works correctly in feature test.But in unit test I have this error. This is super intersting. How this posible that this code works just in feature test.
My code line is:
factory(User::class)->create();
factory(‘AppProject’)->create();

skys215 2020-02-28 16:05:59
Try factory(AppProject::class)
codewithah 2020-02-28 16:08:24
Dos not work
skys215 2020-02-28 16:10:11
Show your project model
codewithah 2020-02-28 16:12:41
skys215 2020-02-28 16:10:11
Show your project model

<?php

namespace App;

use IlluminateDatabaseEloquentModel;

class Project extends Model
{
protected $guarded = [];
public function path(){

}
}

skys215 2020-02-28 16:21:18
Search for User factory and Write a ProjectFactory
codewithah 2020-02-28 16:25:37
skys215 2020-02-28 16:21:18
Search for User factory and Write a ProjectFactory

l did.Even I copied Laravel websites codes to my IDE but dose not work.
https://laravel.com/docs/5.8/http-tests

skys215 2020-02-28 16:26:15
Did you run composer dump-autoload ?
codewithah 2020-02-28 16:26:22
skys215 2020-02-28 16:26:15
Did you run composer dump-autoload ?

yes

codewithah 2020-02-28 16:26:39
Even I created a new fresh project
skys215 2020-02-28 16:27:36
codewithah 2020-02-28 15:58:45
Hi.Do you what is this error.
InvalidArgumentException: Unable to locate factory with name [default] [AppProject].

I want to create a unit test for my “Project ” Model.I want use fake information via “Factory”.The my code works correctly in feature test.But in unit test I have this error. This is super intersting. How this posible that this code works just in feature test.
My code line is:
factory(User::class)->create();
factory(‘AppProject’)->create();

Is feature a branch?

codewithah 2020-02-28 16:28:53
skys215 2020-02-28 16:27:36
Is feature a branch?

What? Sorry English is not my native language. Can you explain more?

codewithah 2020-02-28 16:30:02
I think problem is from Laravel.
Because I have this two lines
C:xampphtdocsbirdboard2vendorlaravelframeworksrcIlluminateDatabaseEloquentFactoryBuilder.php:282

C:xampphtdocsbirdboard2vendorlaravelframeworksrcIlluminateDatabaseEloquentFactoryBuilder.php:259

skys215 2020-02-28 16:32:43
codewithah 2020-02-28 16:28:53
What? Sorry English is not my native language. Can you explain more?

I mean git branch

codewithah 2020-02-28 16:33:47
skys215 2020-02-28 16:32:43
I mean git branch

I am not sure.I installed via Laravel Installer

skys215 2020-02-28 16:33:59
Ok
skys215 2020-02-28 16:34:30
codewithah 2020-02-28 15:58:45
Hi.Do you what is this error.
InvalidArgumentException: Unable to locate factory with name [default] [AppProject].

I want to create a unit test for my “Project ” Model.I want use fake information via “Factory”.The my code works correctly in feature test.But in unit test I have this error. This is super intersting. How this posible that this code works just in feature test.
My code line is:
factory(User::class)->create();
factory(‘AppProject’)->create();

Show code of feature test

codewithah 2020-02-28 16:36:35
skys215 2020-02-28 16:34:30
Show code of feature test

There are a lot of lines.So please see in this link
https://hastebin.com/ofifepiguv.xml

skys215 2020-02-28 16:38:18
And for unit test?
codewithah 2020-02-28 16:40:00
Waite a moment
codewithah 2020-02-28 16:41:43
<?php

namespace TestsUnit;
use AppProject;
use PHPUnitFrameworkTestCase;
use IlluminateFoundationTestingRefreshDatabase;
use IlluminateFoundationTestingWithFaker;

class ProjectTest extends TestCase
{
use RefreshDatabase;

/** @test */
public function is_has_a_path(){
$project = factory(Project::class)->create();
dd($project);
}
}

codewithah 2020-02-28 16:48:54
Please wait about 10 mins. I want to download source from Github and I re run again. but without Laravel Installer
skys215 2020-02-28 17:35:49
codewithah 2020-02-28 16:41:43
<?php

namespace TestsUnit;
use AppProject;
use PHPUnitFrameworkTestCase;
use IlluminateFoundationTestingRefreshDatabase;
use IlluminateFoundationTestingWithFaker;

class ProjectTest extends TestCase
{
use RefreshDatabase;

/** @test */
public function is_has_a_path(){
$project = factory(Project::class)->create();
dd($project);
}
}

try add
use WithFaker;

codewithah 2020-02-28 17:53:25
skys215 2020-02-28 17:35:49
try add
use WithFaker;

How?

skys215 2020-02-28 17:56:26
codewithah 2020-02-28 17:53:25
How?

you have used it in feature test, copy from there

codewithah 2020-02-28 18:07:03
skys215 2020-02-28 17:56:26
you have used it in feature test, copy from there

Ok thank you.❤️❤️❤️❤️❤️❤️❤️❤️❤️. Thank you from all of your responses

skys215 2020-02-28 18:08:44
Did it work?
demianrey 2020-02-28 18:17:36
Hi, how are they, I don’t know anything about Laravel but now I’m using an application for vpn connections which was in Chinese and I already translated it into Spanish and English, my query is the following; It has a payment method called alipay but I need it to be Paypal, any idea how to change it or integrate it?
demianrey 2020-02-28 18:17:57
GitHub – srmklive/laravel-paypal: Laravel plugin for processing payments through PayPal. Can be used separately.
https://github.com/srmklive/laravel-paypal

GitHub – srmklive/laravel-paypal: Laravel plugin for processing payments through PayPal. Can be used separately.GitHub
Laravel plugin for processing payments through PayPal. Can be used separately. – GitHub – srmklive/laravel-paypal: Laravel plugin for processing payments through PayPal. Can be used separately.
demianrey 2020-02-28 18:19:03
demianrey 2020-02-28 18:17:57
GitHub – srmklive/laravel-paypal: Laravel plugin for processing payments through PayPal. Can be used separately.
https://github.com/srmklive/laravel-paypal

I found this, is what I need?

skys215 2020-02-28 18:49:18
maybe yes
2020-02-28 18:56:31
Hello everyone.

I am using Laravel 6, php 7.2 and MySql DB.

I have a table called settings where I use (50 rows) of data (almost) on all pages of my website.

I keep this data on redis cache.

I define the settings table with config () in AppServiceProvider. I can call and use it seamlessly in the controller and blade template.

There is a topic I am curious about. Is there a better performance in every page request than requesting data from cache again?

skys215 2020-02-28 18:57:56
try swoole/laravoole
MasouddAmirii 2020-02-28 19:15:26
Hi everyone

anyone know how to performe inverse hasmanythrough relationships ?

skys215 2020-02-28 19:16:52
MasouddAmirii 2020-02-28 19:15:26
Hi everyone

anyone know how to performe inverse hasmanythrough relationships ?

I think inverse is the same

MasouddAmirii 2020-02-28 19:19:09
Seller
id
.
.

Product
id
seller_id
.
.

ProductLog
id
product_id

kuzmich321 2020-02-28 19:19:15
2020-02-28 18:56:31
Hello everyone.

I am using Laravel 6, php 7.2 and MySql DB.

I have a table called settings where I use (50 rows) of data (almost) on all pages of my website.

I keep this data on redis cache.

I define the settings table with config () in AppServiceProvider. I can call and use it seamlessly in the controller and blade template.

There is a topic I am curious about. Is there a better performance in every page request than requesting data from cache again?

depends on the way you use it on a page

MasouddAmirii 2020-02-28 19:21:17
MasouddAmirii 2020-02-28 19:19:09
Seller
id
.
.

Product
id
seller_id
.
.

ProductLog
id
product_id

in laravel document says…
$seller->product_log

but what I want is: how to perform
$product_log->product->seller

MasouddAmirii 2020-02-28 19:21:49
It’s a bit confusing for me
kuzmich321 2020-02-28 19:22:05
dump it all the way up
kuzmich321 2020-02-28 19:22:13
u’ll get the truth lol
kuzmich321 2020-02-28 19:22:23
https://stackoverflow.com/questions/39159285/laravel-5-hasmanythrough-inverse-querying

Laravel 5 Hasmanythrough inverse queryingStack Overflow
I have 3 models : Vehicle, Dealer and Province

Eloquent Relationships are as follows:
Vehicle belongsTo Dealer

Dealer hasMany Vehicles

Province hasMany Dealers

Dealer belongs to

kuzmich321 2020-02-28 19:23:00
hope it’s gonna help u
2020-02-28 19:24:59
kuzmich321 2020-02-28 19:19:15
depends on the way you use it on a page

I do not fully understand. I use for pagination count, title and description on pages

kuzmich321 2020-02-28 19:25:19
alright
kuzmich321 2020-02-28 19:25:23
you’re in the context
kuzmich321 2020-02-28 19:25:26
i need more info
kuzmich321 2020-02-28 19:25:35
of what is going on
MasouddAmirii 2020-02-28 19:26:46
kuzmich321 2020-02-28 19:22:23
https://stackoverflow.com/questions/39159285/laravel-5-hasmanythrough-inverse-querying

I got it

|