What is difference between functionality of laravel throttle and captcha?

|
ErgashevXurshid 2019-02-02 18:52:59
Leetump 2019-02-02 18:33:42
But How I integrate

https://laravelvoyager.com/

Indohoki77: Daftar Situs Judi Slot Online Terpercaya & Terlengkap Di IndonesiaINDOHOKI77
Indohoki77 situs judi slot online hadir memiliki semua provider slot terlengkap dan terpercaya tahun ini. Daftar sekarang juga!
berlin5556666 2019-02-02 19:46:00
Ahmed Magdi 2019-02-02 18:40:51
Yes … but following id is means users or posts?

πŸ˜’
do you usen’t social media ever ?

following id means people that i follow
follower id means people that follow me

berlin5556666 2019-02-02 19:46:18
i found solution for solve this proplem
oxbir 2019-02-02 19:48:05
berlin5556666 2019-02-02 19:46:18
i found solution for solve this proplem

Are you live in Iran

berlin5556666 2019-02-02 19:48:21
first i get array of users id that follow me

$follower_id = array();
foreach ($followers as $follower) {
$follower_id[] = $follower->id;

}

then i used a single line to get paginated posts

$posts =Post::whereIn(‘user_id’, $follower_id)->paginate(10);

berlin5556666 2019-02-02 19:48:26
oxbir 2019-02-02 19:48:05
Are you live in Iran

yes

oxbir 2019-02-02 19:48:38
Too
DivByZero 2019-02-02 19:48:55
berlin5556666 2019-02-02 19:46:00
πŸ˜’
do you usen’t social media ever ?

following id means people that i follow
follower id means people that follow me

do you usen’t ?! is this a brand new language ?

2019-02-02 19:48:59
oxbir 2019-02-02 19:48:05
Are you live in Iran

vividly :)))))))

oxbir 2019-02-02 19:49:30
2019-02-02 19:48:59
vividly :)))))))

What

berlin5556666 2019-02-02 19:50:53
DivByZero 2019-02-02 19:48:55
do you usen’t ?! is this a brand new language ?

he didn’t understand what i want man

DivByZero 2019-02-02 19:52:04
berlin5556666 2019-02-02 19:50:53
he didn’t understand what i want man

no body can understand you with this awful language dude , you need a good english course πŸ™‚ and a good laravel course too

2019-02-02 19:53:24
DivByZero 2019-02-02 19:52:04
no body can understand you with this awful language dude , you need a good english course πŸ™‚ and a good laravel course too

this crucially exploits the fact of using English for dummies, per se

DivByZero 2019-02-02 19:56:54
2019-02-02 19:53:24
this crucially exploits the fact of using English for dummies, per se

hum that makes sense

l_alexis 2019-02-02 23:33:58
DivByZero 2019-02-02 19:52:04
no body can understand you with this awful language dude , you need a good english course πŸ™‚ and a good laravel course too

but I did understand him and I’m not English native…

l_alexis 2019-02-02 23:39:19
berlin5556666 2019-02-02 19:48:21
first i get array of users id that follow me

$follower_id = array();
foreach ($followers as $follower) {
$follower_id[] = $follower->id;

}

then i used a single line to get paginated posts

$posts =Post::whereIn(‘user_id’, $follower_id)->paginate(10);

Imagine someone has 10k followers, this code would be pretty heavy for DB. I’d avoid using count like this but use belongsToMany to get users following the current user and then use Eager Loading to load all the posts

berlin5556666 2019-02-02 23:41:24
l_alexis 2019-02-02 23:39:19
Imagine someone has 10k followers, this code would be pretty heavy for DB. I’d avoid using count like this but use belongsToMany to get users following the current user and then use Eager Loading to load all the posts

first i was try for eager loading
but it returns all posts from followers
πŸ™„

l_alexis 2019-02-02 23:41:50
berlin5556666 2019-02-02 23:41:24
first i was try for eager loading
but it returns all posts from followers
πŸ™„

you can select only N posts for each user

l_alexis 2019-02-02 23:42:51
$limit = 10;
$user->with([‘followers.posts’ => function($query) use($limit) {
$query->limit($limit);
}]);
If that is what you need
berlin5556666 2019-02-02 23:43:33
i gonna get paginated posts
berlin5556666 2019-02-02 23:44:03
and eager loading doesn’t provide this goal
l_alexis 2019-02-02 23:44:30
Did you try use QueryBuilder + join?
berlin5556666 2019-02-02 23:44:53
no i just tested eloquent
berlin5556666 2019-02-02 23:45:17
l_alexis 2019-02-02 23:44:30
Did you try use QueryBuilder + join?

can you write a example please ?

l_alexis 2019-02-02 23:57:56
User::getQuery()->join(‘followers’, ‘users.id’, ‘=’, ‘followers.user_id’)
->join(‘users as followee’, ‘follower.followee_id’, ‘=’, ‘followee.id’)
->join(‘posts’, ‘post.user_id’, ‘=’, ‘followee.id’)
->paginate(10)
Smth like this, I believe
berlin5556666 2019-02-03 00:03:48
l_alexis 2019-02-02 23:57:56
User::getQuery()->join(‘followers’, ‘users.id’, ‘=’, ‘followers.user_id’)
->join(‘users as followee’, ‘follower.followee_id’, ‘=’, ‘followee.id’)
->join(‘posts’, ‘post.user_id’, ‘=’, ‘followee.id’)
->paginate(10)
Smth like this, I believe

has it better performance vs my code ?

l_alexis 2019-02-03 00:06:16
berlin5556666 2019-02-03 00:03:48
has it better performance vs my code ?

It forms one request and filters all data on the DB in single query, so it should has better perfomance (+ you could speed it up with indexes)

berlin5556666 2019-02-03 00:07:18
join table isn’t heavy load?
l_alexis 2019-02-03 00:07:54
select (…) where id in ( /* over100500 IDs*/) is much worse
l_alexis 2019-02-03 00:09:08
you could fill your database with a lot of posts and use
Db::listen(function($query) {
dump($query->sql, $query->bindings, $query->time);
});
to check which query takes more time to execute
berlin5556666 2019-02-03 00:10:38
thank you so much alex
for sharing your experience
l_alexis 2019-02-03 00:11:55
always welcome)
Btw, that is a good practicle to EXPLAIN queries, you could see how it exactly executes the queries
berlin5556666 2019-02-03 00:13:07
recently i used elastic search
for a big project

if mysql doesn’t provide good performance i should use it

sarr_zx 2019-02-03 00:44:03
laravel_discuss-1567.jpg
Does anyone know what’s the problem here?πŸ’”
hazhir 2019-02-03 01:00:48
sarr_zx 2019-02-03 00:44:03
Does anyone know what’s the problem here?πŸ’”

This is a query exception, you are trying to insert the same record on a column which has the unique constraint, handle the exception with a try catch also validate the inputs using Validator facade in laravel.

l_alexis 2019-02-03 01:07:29
hazhir 2019-02-03 01:00:48
This is a query exception, you are trying to insert the same record on a column which has the unique constraint, handle the exception with a try catch also validate the inputs using Validator facade in laravel.

the error is “table is read only”, not like “unique constraint”

l_alexis 2019-02-03 01:08:10
Btw, this is a “google me” problem:
https://stackoverflow.com/questions/9575914/table-is-read-only

Table is ‘read only’Stack Overflow
When I want to execute an update query on my table I got an error saying:
1036 – Table data is read only.
How can I fix that?

Table attributes in /var/db/mysql are set to 777.

‘Repair Table’

marsahadji 2019-02-03 01:22:24
Gmt
hazhir 2019-02-03 02:40:59
l_alexis 2019-02-03 01:07:29
the error is “table is read only”, not like “unique constraint”

you are right!, i saw it wrong

Kevi 2019-02-03 04:34:20
I suggest you to go with QueryBuilder as it has good performance then Eloquent. But if you want clean code then Eloquent is best.
Mnikoei 2019-02-03 04:36:03
Hello guys
what is difference between functionality of laravel throttle and captcha? doesn’t both do the same thing?
Kevi 2019-02-03 04:36:06
You can use something like this:

$user->with([‘followers.posts’ => function($query) {
$query->paginate();
}]);

Kevi 2019-02-03 04:40:07
In simple words, Throttle is for limiting the request and captcha is for validating the request.
Kevi 2019-02-03 04:42:44
You can say that both have similar purpose, to protect your app from DDOS attack. But captcha prevent before making requests and throttle after making request.
Mnikoei 2019-02-03 05:09:00
tnx
l_alexis 2019-02-03 05:16:57
Throttle could be also used for API requests, captcha cannot.
Kevi 2019-02-03 05:56:44
l_alexis 2019-02-03 05:16:57
Throttle could be also used for API requests, captcha cannot.

+1

SmitVora 2019-02-03 10:52:56
Anyone have project for freelancing?
Eng_sa73 2019-02-03 13:28:19
ext-json is missing in composer.json less… (Ctrl+F1)
Inspection info:
Reports usages of classes/functions/constants from php extensions which are not specified in composer.json
Eng_sa73 2019-02-03 13:28:35
laravel_discuss-1601.jpg

|