bozhkos

bozhkos

Member Since 3 Years Ago

Ukraine, Dnipro

Co-Founder & CTO at Exyplis LLC

Experience Points 51,130
Experience Level 11

3,870 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 476
Lessons
Completed
Best Reply Awards 6
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

20 Feb
4 months ago

bozhkos left a reply on Laravel 5.7 Default Authentication

So you need to hash it. Using tinker, create user like this

$user = new User
$user->email = '[email protected]';
$user->password = \Hash::make('secret');
$user->name = 'Some user';
$user->save()


And you will be able to log in with [email protected] as login, and secret as password

bozhkos left a reply on Laravel 5.7 Default Authentication

What exactly you hardcoded? Is user password hashed?

bozhkos left a reply on 'orWhere' Not Work Eloquent Model Relationship

As I see, there are any of columns you search through inside your Client model. So query results are the same.

08 Feb
5 months ago

bozhkos left a reply on Sort Collection

Here you go.

$requests = Applyleave::with(['employeedetails.departments','employeedetails.designations','employeedetails.officelocations'])
    ->get()
    ->sortByDesc(function($item,$key) {
    return $item['status'] ==='pending';
})->all();

Let me know if it worked for you.

bozhkos left a reply on Sort Collection

You can use sortBy method, and pass closure into it, inside which apply weights to status.

bozhkos left a reply on Datetime From DB Value On Server Vs Local Dev

My advice is to use a full string. Go straight, and your code will work as expected, even if it will take more characters for that condition.

bozhkos left a reply on Laravel Dynamic Queue And Worker Creation And Destruction

Well, here we go.

TLDR Laravel doesn't give us built-in features, to configure and control queues and workers on the fly. To create/update/delete workers, you have to generate config files for supervisord or pm2, or whatever you use to run your worker processes. My personal advice is, to try Horizon, and don't start queues like action-XYZ, rather simply action. But this is only advice, it's your business, do whatever you feel right.

And here is an explanation, why my advice is to try this way.

I had a similar problem in the past. For the app (_App itself - medium-sized CRM, we install on-premise for call-centers._), we had 3 types of queues, e.g. notifications,calls,imports, and for every tenant user(every call-center has multiple offices, one office - one tenant) we had setup very similar to what you try to achieve now.

So, tenant-1 had notifications-1,calls-1,imports-1 queues, and we was adjusting a process count, depending on how many users were on that tenant. Configurations for supervisor processes was generated using Laravel Forge, and sometimes manually. So, for a new office, we has created 3 configs, update supervisord, and here we go, jobs processing works, each tenant has separate queues, blah-blah-blah. For every 50 users, we spawn about 6-10 worker processes, depending on how intense their workflow is. Everything worked fine, everyone happy. For about 2 years. Recently, we figured out, that load average on servers is insane, and customers start to experience problems with performance. (if you curious, that was about 45-50 points la, on a server with 6 cores and 8 GB RAM, when customers work, and 25-30 on idle __ what a crap, oh god__).

The fix comes fast, we installed Horizon and removed all suffixes from queues. All coding took us about 30 minutes, or less. So now, we have 3 queues all over the app. notifications,calls,imports, with auto balancing strategy. To save our asses, and increase worker processes count on-premise, we used this hack

'balance'    => 'auto',
'processes'  => 10 * env('HORIZON_MULTIPLIER', 2),

So, if workers count isn't enough, we can just update HORIZON_MULTIPLIER in our .env file, reload Horizon, and good to go. And talking about multiple servers, and scalability - Horizon supports multiple supervisor processes, and connections out of the box. Happy end We figured out, that everything is way better, then we can ever expect. Server load average goes down to 0.2 on idle, and 4-6 on full speeds (we spawning about 100 processes to stay safe during spikes). Now, for the biggest customer(_ several hundreds of active users_) Horizon handles about 2 thousands jobs per minute, with almost zero wait time(0-3 seconds), on the same server (6 cores, 8GB RAM, single-server setup). Very impressive on my taste. We cut server costs in times, using this 30 minutes update.

That's it. To wrap it up, let me say, that your business and needs may be very different from mine. I shared some real-world experience, and hope, it would be helpful for people who fall into a similar situation. For your app, only you have to decide which options you choose, and nobody can make it better, than you.

Good luck in that battle.

Well, here we go.

TLDR Laravel doesn't give us built-in features, to configure and control queues and workers on the fly. To create/update/delete workers, you have to generate config files for supervisord or pm2, or whatever you use to run your worker processes. My personal advice is, to try Horizon, and don't start queues like action-XYZ, rather simply action. But this is only advice, it's your business, do whatever you feel right.

And here is an explanation, why my advice is to try this way.

I had a similar problem in the past. For the app (_App itself - medium-sized CRM, we install on-premise for call-centers._), we had 3 types of queues, e.g. notifications,calls,imports, and for every tenant user(every call-center has multiple offices, one office - one tenant) we had setup very similar to what you try to achieve now.

So, tenant-1 had notifications-1,calls-1,imports-1 queues, and we was adjusting a process count, depending on how many users were on that tenant. Configurations for supervisor processes was generated using Laravel Forge, and sometimes manually. So, for a new office, we has created 3 configs, update supervisord, and here we go, jobs processing works, each tenant has separate queues, blah-blah-blah. For every 50 users, we spawn about 6-10 worker processes, depending on how intense their workflow is. Everything worked fine, everyone happy. For about 2 years. Recently, we figured out, that load average on servers is insane, and customers start to experience problems with performance. (if you curious, that was about 45-50 points la, on a server with 6 cores and 8 GB RAM, when customers work, and 25-30 on idle __ what a crap, oh god__).

The fix comes fast, we installed Horizon and removed all suffixes from queues. All coding took us about 30 minutes, or less. So now, we have 3 queues all over the app. notifications,calls,imports, with auto balancing strategy. To save our asses, and increase worker processes count on-premise, we used this hack

'balance'    => 'auto',
'processes'  => 10 * env('HORIZON_MULTIPLIER', 2),

So, if workers count isn't enough, we can just update HORIZON_MULTIPLIER in our .env file, reload Horizon, and good to go. And talking about multiple servers, and scalability - Horizon supports multiple supervisor processes, and connections out of the box. Happy end We figured out, that everything is way better, then we can ever expect. Server load average goes down to 0.2 on idle, and 4-6 on full speeds (we spawning about 100 processes to stay safe during spikes). Now, for the biggest customer(_ several hundreds of active users_) Horizon handles about 2 thousands jobs per minute, with almost zero wait time(0-3 seconds), on the same server (6 cores, 8GB RAM, single-server setup). Very impressive on my taste. We cut server costs in times, using this 30 minutes update.

That's it. To wrap it up, let me say, that your business and needs may be very different from mine. I shared some real-world experience, and hope, it would be helpful for people who fall into a similar situation. For your app, only you have to decide which options you choose, and nobody can make it better, than you.

Good luck in that battle.

07 Feb
5 months ago

bozhkos left a reply on Retry Dispatching Job

Here you go

$tries=0;
        while ($tries < 2) {
            try {
                Job::dispatch();
            } catch (\Throwable $e) {
               // optional sleep(second or whatever)
                $tries++;
            }
        }

bozhkos left a reply on Rule It's Not Working In Validation

php artisan clear-compiled && php artisan cache:clear

bozhkos left a reply on Fetching Full Name From Model

@KSHITIZMITTAL - can you please help me a bit, and post here a result of

$sv = Employeedetail::where(['status'=>'Active'])->get(['first_name','last_name','middle_name','emp_id']);

dd($sv->toArray());

bozhkos left a reply on How Can I Display An Image In The Browser From A Laravel API Using Vuejs

Try to use this

<img :src="`/img/${property.image}`"/>

bozhkos left a reply on Fetching Full Name From Model

We aren't able to use pluck this way. You should try something like

$supervisors = Employeedetail::where(['status'=>'Active'])->get(['first_name','last_name','middle_name','emp_id'])

$supervisors->pluck('full_name','emp_id');

bozhkos left a reply on Auto Delete Revoked Token By Expiration Date From Database

@AFSHIN.ASGHARI - I think in terms of performance, these two methods are equivalent. Thing is, using an event, you remove all unnecessary user tokens immediately, whenever scheduler will remove all expired tokes for all users, once a day (or whatever frequency you choose).

It is more about what way fits better for your app :)

bozhkos left a reply on Auto Delete Revoked Token By Expiration Date From Database

Hi. You can listen for Laravel\Passport\Events\AccessTokenCreated event and inside your listener, and remove any revoked and/or expired tokens for a user.

Sure thing, you are able to make new artisan command, which will look into tokens table, and remove expired tokens. Using schedule, run that command once a day, or whatever frequency you like.

bozhkos left a reply on Using Laravel Rules

Hi!

You are not limited to use facades only. For custom validation rules, you have options:

  • create a rule with artisan make:rule

  • Rule class itself is macroable, so you can extend it with very own functionality. More on macros you can find here.

bozhkos left a reply on Laravel Dynamic Queue And Worker Creation And Destruction

Hi. Did you look at Laravel Horizon?

Automatic balancing looks like a good option for you, without the need for any machine learning.

Or your project just have too specific requirements? If so, you can generate supervisord configs right from your app, and start/stop worker processes, once requirements are met. Kinda overengineering on my taste, but this is one of all possible solutions for you.

09 Jan
6 months ago

bozhkos left a reply on Laravel Job Chaining Pass Variable From Another Job To Another Job

AFAIK you can't chain jobs in that way. You have to dispatch your second job from inside of the first one.

bozhkos left a reply on What Kind Of Procedure If I Want To Develop - Sales, Profit, Report ?

Can you clarify your problem? The way you ask your question is too hard to understand

08 Nov
8 months ago

bozhkos started a new conversation New Design Is Insane

Wow, Jeffrey, this new Laracasts design so much better, i excited af. Cant even take my eyes off it.

Awesome work, take my congratulations, and keep your product as awesome as it is now.

bozhkos left a reply on How I Can Fatch Data From DB It's On Json Formate

MariaDB becuase it's not support Json field - so you can't use whereJsonContains as well as other json query operations.

bozhkos left a reply on How/what's The Best Way To Make A 'review Product Feature' ?

Storing the review from guest in the same table with the member, probably most effective. You can make name nullable, so to retreive guests reviews you can define scope, for that reviews. In that case, it takes less queries to DB, makes your code easier to maintain, and cure cancer ?

29 May
1 year ago

bozhkos left a reply on Laravel Envoyer Deployment Hook Install Composer Dependencies Failed

I'm 90% sure this is network related. Maybe, it depends on current server load, when resources heavy used, installs and compilations way slower, than on servers with more free CPU & RAM available.

Of course, i can be wrong, but i suggest you to take a look into at network speed and resources usage on your servers.

bozhkos left a reply on Laravel Envoyer Deployment Hook Install Composer Dependencies Failed

BTW, timeouts fire on Envoyer's server, not on yours.

bozhkos left a reply on Laravel Envoyer Deployment Hook Install Composer Dependencies Failed

Oh, that's is an issue. in our composer script npm install and npm update.

Consider using separate steps in Envoyer, where you install NPM deps, and build your assets. That's only option in your case, since Envoyer, does not support increasing timeouts. Deployment hook designed right for that actions.

bozhkos left a reply on Laravel Envoyer Deployment Hook Install Composer Dependencies Failed

Did you try to manually log into server, and install Composer deps? 10 minutes is huge time, maybe you have some network troubles on server

03 Feb
1 year ago

bozhkos left a reply on Laravel_session & Other Cookies Created Only On Main Route

Hi, does all your routes which visitors can hit, has web middleware?

16 Nov
1 year ago

bozhkos left a reply on Please I Am Getting This Error [BadMethodCallException]

Please, format your code with markdown.

public function SearchFriends(Request $request) { $term = $request->term; $searching = User::where('email', 'LIKE', '%'. $term . '%') ->orWhere('location', 'LIKE', '%'.$term.'%') ->orWhere('name', 'LIKE', '%'.$term.'%') ->orWhereHas('App\profiles', function($asking) use ($term){ $asking->where('community', 'LIKE', '%'.$term.'%') ->orWhere('ethnicity', 'LIKE', '%'.$term.'%') ->orWhere('state', 'LIKE', '%'.$term.'%'); })->orderBy('id')->paginate(20); $data = []; foreach($searching as $key => $value){ $data[] = [ 'id' => $value->id, 'email' => $value->email, 'location' => $value->location, 'name' => $value->name, 'community' => $value->community, 'ethnicity' => $value->ethnicity, ]; } return response()->Json($data); }
$(document).ready(function(){ $('input[name="keywords"]').autocomplete({ source : "{!!url('/keysearch')!!}", autoFocus : true, minLength : 1, select:function(key, value){ console.log(value); } }); });

namespace App;

use Illuminate\Database\Eloquent\Model; use App\User;

class profiles extends Model { protected $fillable = [ 'user_id', 'address', 'ethnicity', 'state', 'community', 'age' ]; public function user() { return $this->belongsTo(User::class); } }
public function Profiles() { return $this->hasOne(profiles::class); }

12 Jan
2 years ago

bozhkos left a reply on How To Create Href Link From Vue Js Response

Try get current domain via default JS Something like this

this.detail = window.location.hostname + '/' + response.data

bozhkos left a reply on Base Seeding

You can set seed class name for new seeds. For example php artisan db:seed --class=YourSeeder

That`s all, you need.

29 Nov
2 years ago

bozhkos left a reply on Laravel On VPS

seems like you set wrong root path in website configuration. Must be like /var/www/html/%yourProject%/public. Also if youre using Apache check is rewrite module enabled. Simplebash a2enmode rewrite && service apache2 restart `

24 Mar
3 years ago

bozhkos left a reply on Laravel Scheudle With Cron

Anything looks ok. Im sorry, now i havent any idea why this don`t work. I think $maxoffers variable is empty, does you check it?

22 Mar
3 years ago

bozhkos left a reply on I Get 500 After Upgrading From 5.1 To 5.2

Does you check server error log? Most times here is explain of the errors.

bozhkos left a reply on Laravel Scheudle With Cron

can you post here example of your cron handler?

bozhkos left a reply on Subdomain Token Mismatch

are you set 'domain' property? This work's for me. Route::group(['middleware' => ['web'], 'domain' => 'sub.domain.com']