milon

Member Since 5 Years Ago

Berlin, Germany

Senior Software Engineer at Urban Sports Club

Experience Points 82,615
Experience Level 17

2,385 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 796
Lessons
Completed
Best Reply Awards 17
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.

11 Jul
1 week ago

milon left a reply on All() Vs Get() - Laravel Eloquent

use 1st option, it runs on the Database side.

12 Apr
2 years ago

milon started a new conversation Problem With Queue ('ErrorException' With Message 'Undefined Index: Job')

I am using lumen 5.2(because I have use laravel 5.5, the library I am using for connecting to SMPP works on 5.5) for an SMS sending server. I have 4 different queue priority, highest, high, default and low. I am using Redis as my queue driver.

Whenever a user requested for sending an SMS, it sends a Job to the queue based on priority. The job is really simple, just open a SMPP connection and send the SMS, then close the connection.

I am running the queue listener with supervisor. Here is the config of supervisor-

[program:send-sms]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/html/artisan queue:listen redis --tries=0 --queue=high,default,low
autostart=true
autorestart=true
numprocs=6
redirect_stderr=true
stdout_logfile=/var/log/supervisor/send_sms.log

The system working fine for most of the time, but sometimes it stops dispatching job from queue. In the error log, I found this-

[2017-04-12 17:40:16] lumen.ERROR: exception 'ErrorException' with message 'Undefined index: job' in /var/www/html/vendor
/illuminate/queue/Jobs/Job.php:126
Stack trace:
#0 /var/www/html/vendor/illuminate/queue/Jobs/Job.php(126): Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}(8
, 'Undefined index...', '/var/www/html/v...', 126, Array)
#1 /var/www/html/vendor/illuminate/queue/Jobs/RedisJob.php(50): Illuminate\Queue\Jobs\Job->resolveAndFire(Array)
#2 /var/www/html/vendor/illuminate/queue/Worker.php(213): Illuminate\Queue\Jobs\RedisJob->fire()
#3 /var/www/html/vendor/illuminate/queue/Worker.php(157): Illuminate\Queue\Worker->process('redis', Object(Illuminate\Que
ue\Jobs\RedisJob), '0', '0')
#4 /var/www/html/vendor/illuminate/queue/Console/WorkCommand.php(126): Illuminate\Queue\Worker->pop('redis', 'highest,hig
h,de...', '0', '3', '0')
#5 /var/www/html/vendor/illuminate/queue/Console/WorkCommand.php(79): Illuminate\Queue\Console\WorkCommand->runWorker('re
dis', 'highest,high,de...', '0', '128', false)
#6 [internal function]: Illuminate\Queue\Console\WorkCommand->fire()

I searched with the error, and found out this thread- https://github.com/laravel/framework/issues/9555.

Then I log into redis console and after running KEYS *, I found a new key called queues:highest:delayed and if I delete it with with DEL command, then the queue started working fine agian. From where It comes. I don't use any delay() dispatch option anywhere in my code.

I also checked what this key contains. It's a sorted set and it contains value something like this-

{"id": "183428934728746524875623", "delay": 159}

So, it is failing while processing the job. From where this value comes from? How can I get rid of this?

09 Dec
2 years ago

milon started a new conversation Using `withCount()` With Already Fetched Entity

I have a model called Campaign and it has a relation called successfulSMS(). So, I can load a related model with already fetched entity like this-

$campaign = Campaign::find(1);
$campaign = $campaign->load('successfulSMS');

Is it possible to use it for loading the count entity like this-

$campaign = Campaign::find(1);
$campaign = $campaign->withLoad('successfulSMS'); // It doesn't work

Any other way to load the count after fetching the original entity? Thanks in advance.

01 Dec
2 years ago

milon left a reply on Do I Really Need To Use Protected $fillable If...

In your scenario, where you never use $request->all(), you don't need to use $fillable or $guarded.

09 Nov
2 years ago

milon started a new conversation Config('value') Is Not Working On Cron(laravel Scheduler)

  • Laravel Version: 5.3.22
  • PHP Version: 7.0.11
  • OS: ubuntu 14.04.4

Description:

I was trying to send an email from a job. It was actually calls an external API and I store the URL in config/services.php file like this-

<?php

return [

    'mailgun' => [
        'domain' => env('MAILGUN_DOMAIN'),
        'secret' => env('MAILGUN_SECRET'),
    ],

    'ses' => [
        'key' => env('SES_KEY'),
        'secret' => env('SES_SECRET'),
        'region' => 'us-east-1',
    ],

    'sparkpost' => [
        'secret' => env('SPARKPOST_SECRET'),
    ],

    'stripe' => [
        'model' => App\User::class,
        'key' => env('STRIPE_KEY'),
        'secret' => env('STRIPE_SECRET'),
    ],

    'sm_api' => env('SM_API', 'api-url'),

];

I also use this sm_api value from frontend like this config('services.sm_api'). There it works like a charm. but when I try to use the same value from a laravel job class, which actually dispatched from Redis queue server, the same function call returns null. I tried to log the whole config()->all() and it returns the predefined values, except sm_api.

array (
    'mailgun' => array (
        'domain' => NULL,
        'secret' => NULL,
    ),
    'ses' => array (
        'key' => NULL,
        'secret' => NULL,
        'region' => 'us-east-1',
    ),
    'sparkpost' => array (
        'secret' => NULL,
    ),
    'stripe' => array (
        'model' => 'App\\User',
        'key' => NULL,
        'secret' => NULL,
    ),
)

It also shows mailgun's domain and secret value to null though I set it in the .env file. I also log the env('SM_API') value, and it works from the same job. So, the problem is I can bear with env('SM_API') from the job, but I can use mail, as the mailgun driver and key is null. But all this works fine from the frontend. I also tried it in php artisan tinker, and it works perfectly.

I searched on google for this and found this. This issue suggest to use php artisan config:cache to resolve this. I tried this as well. But nothing happens.

I also posted an issue on laravel/framework repo. If you are interested, then you can look into it here.

16 Oct
2 years ago

milon started a new conversation Fatal Error In Laravel Scout In Elasticsearch Driver

I am trying to use laravel-scout package for full text searching. I am using this package (https://github.com/ErickTamayo/laravel-scout-elastic). I already added the service provider and then import the indices successfully. Then when I try to search any index, then this error message shows-

[Symfony\Component\Debug\Exception\FatalErrorException]
  Class ScoutEngines\Elasticsearch\ElasticsearchEngine contains 1 abstract me
  thod and must therefore be declared abstract or implement the remaining met
  hods (Laravel\Scout\Engines\Engine::getTotalCount)

what should I do?

19 Sep
2 years ago

milon started a new conversation Limit On Queue Worker

Hi, I am building a sms sending tool where you can schedule any number of sms and then it will send those sms to the recipients. I am using laravel queue api for this and using beanstalkd as queue driver. But the problem is my sms provider has a limit of sending sms per second. I can't send more than 15 sms per second. So, is there any option for limiting the queue worker to do just a certain number of job? That means let say I already sent 15 smses for the second. So, the queue worker will wait until this second finished, and then send again.

Thanks in advance.

08 Sep
2 years ago

milon left a reply on Laravel Scheduler Discussion

i am using beanstalkd for queuing the sms. that is not my concern now. i am worried about the scheduling part.

milon left a reply on Laravel Scheduler Discussion

thanks for your reply, actually i am doing this right now. let's see if some other ideas come out.

milon started a new conversation Laravel Scheduler Discussion

I am building a scheduler app, where people can schedule a sms to a list of people, and when that time comes, a scheduler command will send those sms. It's fine till now, but I am bit confused about how to add those job in the kernel class. I know there is a when and skip method but still confused about how to read the time and date from the database and then add it to the kernel class. Is it okay to query the DB on the kernel class and then schedule it with when method? I am totally confused about it. As I don't have a sound knowledge about cron related stuff, just some script run through the cron and that's it.

I need some expert advice here. And if possible some code sample as well. Thanks in advance.

31 Aug
2 years ago

milon started a new conversation Create New Postgres User In Homestead

Hello Everyone, I have a huge database dump from an existing project. This dump is about 3.5GB in size. When I try to import this with psql command it fails because in the previous server it was under a user called postgres. But the homestead username is homestead. So, I then tried to create a user in homestead with createuser command but it fails with the following message-

createuser: could not connect to database postgres: FATAL:  role "vagrant" does not exist

So, is there any way to create a user in homestead called postgres, or any other way to import that dump.sql file to any database owned by homestead user? I am stuck here for about a day now, help please.

02 Aug
2 years ago

milon left a reply on Messenger Package

@n0tttrui why not go through the readme?

milon left a reply on Messenger Package

You could use this as well. Pretty stable, and function proof. https://github.com/nahid/talk

10 Apr
3 years ago

milon left a reply on It Works, But Wait What? Is It Magic?

Jeffrey put some tutorial on almost every topic of laravel including relationship. Just search the lesson and watch.

12 Jan
3 years ago

milon left a reply on Simple Full Screen Mode In MacVim

@JeffreyWay please do a series on VIM

09 Jan
3 years ago

milon left a reply on Question About Composer

There are some videos on composer in laracasts. Make sure you search and watch that before watching mailers video.

22 Dec
3 years ago

milon left a reply on Nginx Error After Homestead Update

UPDATE:
Fixed. There were 2 homestead instance running. one is 0.3.3 and another is 0.4.0 I just run following commands-

vagrant box remove laravel/homestead --box-version 0.3.3
vagrant halt
vagrant up --provision

milon started a new conversation Nginx Error After Homestead Update

I tried homestead update this morning. If seems fine and I can ssh into homestead box as well. I tried php -v and it shows 7.0.1

here is my Homestead.yml file-

---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/projects
      to: /home/vagrant/projects

sites:
    - map: playground.app
      to: /home/vagrant/projects/playground/public

    - map: laravel.app
      to: /home/vagrant/projects/laravel/public

    - map: hospital.app
      to: /home/vagrant/projects/hms/public

    - map: phpmyadmin.app
      to: /home/vagrant/projects/phpmyadmin

    - map: ict-mbstu.app
      to: /home/vagrant/projects/ict-mbstu/public

    - map: erp.app
      to: /home/vagrant/projects/erp/public

    - map: rx71.app
      to: /home/vagrant/projects/rx-71/public

databases:
    - playground
    - laravel
    - hospital
    - ict_mbstu
    - erp
    - rx71

variables:
    - key: APP_ENV
      value: local

# blackfire:
#     - id: foo
#       token: bar
#       client-id: foo
#       client-token: bar

# ports:
#     - send: 93000
#       to: 9300
#     - send: 7777
#       to: 777
#       protocol: udp

and here is my /etc/hosts file-

127.0.0.1   localhost
127.0.1.1   milon-desktop

# Virtual Hosts
127.0.0.1   app.laravel5.dev
127.0.0.1   app.lumen.dev
127.0.0.1   app.rx-71.dev
127.0.0.1   app.appointment.dev
127.0.0.1   music.app

# Vagrant Boxes
192.168.10.10   laravel.app
192.168.10.10   playground.app
192.168.10.10   phpmyadmin.app
192.168.10.10   hospital.app
192.168.10.10   ict-mbstu.app
192.168.10.10   erp.app
192.168.10.10   rx71.app

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

I have provisioned the homestead box. Everything seems fine and I checked the database and my listed database are created as well. But when I try to browse any of my app from browser the nginx shows 502 Bad Gateway error. Any idea why this happen?

10 Dec
3 years ago

milon left a reply on NoSQL In Laravel

+1

09 Dec
3 years ago

milon left a reply on Homestead PHP 7

clone this branch of homestead and you are ready to go

git clone -b php-7 https://github.com/laravel/homestead.git Homestead
06 Dec
3 years ago

milon left a reply on Delete A Row From A Table

use this-

{!! Form::model($category, ['method' => 'delete', 'route' => ['pharmacy.categories.destroy', $category->id], 'class' =>'form-inline form-delete']) !!}
    {!! Form::hidden('id', $category->id) !!}
    {!! Form::button('<i class="fa fa-trash-o"></i> '.trans('categories.delete'), ['type' => 'submit', 'class' => 'btn btn-xs btn-danger delete', 'name' => 'delete_modal']) !!}
{!! Form::close() !!}

milon left a reply on [Composer] Autoload Braintree Package

Braintree_Transaction class is in root namespace. try this-

use Braintree_Transaction;

milon left a reply on Test

May I ask, why you put the closing ?> php tag?

milon left a reply on Nesting Level

use baum, works like a charm

milon left a reply on Vagrant Up (Error - El Capitan)

try this command, it works for me-

sudo /etc/init.d/vboxdvr setup

then try vagrant up

milon left a reply on Redirecting To Home

try this on terminal-

php artisan view:clear

milon left a reply on Should I Buy Jeffery's Book

It's an awesome book. You could ask @Jeffrey for a discount coupon as it is outdated, I hope he be would happy to do so.

milon left a reply on L5.1 And Get Parameters

$foo = \Request::get('foo');
05 Dec
3 years ago
02 Dec
3 years ago

milon left a reply on PHP 7 Released!

laravel works fine with latest version of php-5.6.16
hope it will work fine with php7

milon left a reply on Best Way To Load Javascript On A Per Page Basis?

use webpack as your component manager

01 Dec
3 years ago

milon left a reply on Vue 1.0 Laravel Setup

that's weird. I tried the same code, and works perfectly for me.

milon left a reply on How To Call External Api From Laravel

@mahady, use guzzle instead of traditional curl

30 Nov
3 years ago

milon left a reply on Relationship, With(), Only Want Id Column

As actor_id is your foreign key, you must send it to the list.

milon left a reply on Love Vue.js, Seriously!

I love react, but I actually work with mostly server rendered app where I need a little bit js to work with. In this case react feels overwhelmed, where vue feels more natural to me. If I create a full blown SPA the I will definitely use react but otherwise I will use vue.

milon left a reply on Relationship, With(), Only Want Id Column

this is very much possible.

$movieList = App\Movie::with(['actor' => function($query){
     $query->addSelect(array('id', 'name'));
}]);

You must add the foreign key on the addSelect method list. otherwise it won't able to link the models together.

milon left a reply on Where To Store Validation Rules.

use form request

milon left a reply on Best Practice For Date Conversion For View Data/data From Ajax

As you are dealing with Student object just declare birth date and start date as date field in model.

class Student
{
    protected $dates = ['birth_date', 'start_date'];

    //other codes
}

then it will be a Carbon object. so in the transformer you can do like this-

'birth_date'     => $student->birth_date->toDateString(),
'start_date'     => $student->start_date->toDateString()

milon left a reply on Laravel 5 Boilerplate VS From Scratch Code Base

I don't use any boilerplate, I start with barebone framework.

milon left a reply on How To Delete A File Or A Photo From The Folder When Deleting It From Database?

@Shahin, he wants to automate the process so, when he call delete method from the model, it automatically delete the file. you show how to delete it manually.

29 Nov
3 years ago

milon left a reply on Keeping Laravel Uptodate

it would be a bad idea, cause every update comes with a chance of breaking your codebase. you could manually update it from composer.

composer update

milon left a reply on Site Looks Wrong On LG MS870 Cell

what is the screen size?

milon left a reply on How To Delete A File Or A Photo From The Folder When Deleting It From Database?

just override the delete method of related model.

public function delete()
{
    if(file_exists('file_path')){
        @unlink('file_path');
    }
    parent::delete();
}
26 Nov
3 years ago

milon left a reply on Been Using Frameworks For So Long Now...

I felt sort of your feelings. then I tried to make some package for laravel and learn other language like nodejs or go.

milon left a reply on Which Editor Is Best For Nodejs

try http://atom.io its free, open source and awesome.