Buy your loved one the ultimate gift. Lifetime gift certificates are $100 off.

mathewparet

Experience

5,710

0 Best Reply Awards

  • Member Since 4 Months Ago
  • 52 Lessons Completed
  • 1 Favorite

23rd November, 2017

mathewparet started a new conversation How Do I Convert ```'``` To ```'```? • 3 weeks ago

How do I convert ' to '?

20th November, 2017

mathewparet started a new conversation Send Notification After All Instances Of A Job Completes • 3 weeks ago

Every day twice a scheduled cron triggers multiple instances of a Laravel. Multiple queue workers also run at the same - so many of these jobs might run in parallel. This number of instances could vary each time. Is there a built-in way to identify if all instances of the job dispatched at the same time completed?

For example. I have a job called GetNewItems scheduled to run at 1 am and 1 pm. Suppose there are 10 instances of the job that started at 1 am. In case a few of these don't complete and it is already 1 pm, then a new set of jobs come in again. Is there a way I can send a notification when all the instances initiated at 1 am completes?

19th November, 2017

mathewparet left a reply on Need Code Suggestion To Identify Similar News Articles • 3 weeks ago

Thanks @jlrdw & @tisuchi

They sound promising. Let me try them out.

mathewparet left a reply on Need Code Suggestion To Identify Similar News Articles • 3 weeks ago

I've tried that already, but doesn't help. I get a lot of false positives even at about 65%.

So I am looking for an alternative.

mathewparet left a reply on Need Code Suggestion To Identify Similar News Articles • 3 weeks ago

I download and save normal RSS feeds into a table (I save title and description). Based on the data stored in these fields, I need to identify if there is a duplicate entry for the news (not exact duplicate record).

For example, source a reports "Dog landed on moon for the first time". Source b reports "Crown, a dog, landeds on the moon". I need to identify that both these are the same news. How do I do that!

18th November, 2017

mathewparet left a reply on Empty Relationship Query • 3 weeks ago

I would suggest you to use:

public function temp()
{
    return $this->hasMeny(serviceTempProducts::class);
}

...
...
...

$model->temp()->sum('quantitly')->groupBy('product_id');

mathewparet started a new conversation Need Code Suggestion To Identify Similar News Articles • 3 weeks ago

I have a requirement to identify similar "news" articles from among say 1000s. I have all the 1000 articles saved in a table with (title, description, date published (might vary -/+ one day).

Ideally, I am trying to identify if a particular news is reported in multiple news sources and if yes, club them together.

Is there a way I can accomplish this without using AI?

10th November, 2017

mathewparet started a new conversation Laravel Job Not Failing, Instead Keeps Trying Even Beyond Limit. • 1 month ago

I have created a job in Laravel which fetches data from a remote server. When the file is not present in the remote server, I expect the job to be retried for some time and then to move to faild_jobs.

However, in my case, the job fails (I mean I can see 404 error being thrown) but the job is tried multiple times until I get the below error:

production.ERROR: SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'attempts' at row 1 (SQL: update `jobs` set `reserved_at` = 1510338600, `attempts` = 256 where `id` = 943) {"exception":"[object] (Illuminate\\Database\\QueryException(code: 22003): SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'attempts' at row 1 (SQL: update `jobs` set `reserved_at` = 1510338600, `attempts` = 256 where `id` = 943) at /srv/users/serverpilot/apps/pathram/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664, Doctrine\\DBAL\\Driver\\PDOException(code: 22003): SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'attempts' at row 1 at /srv/users/serverpilot/apps/pathram/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:107, PDOException(code: 22003): SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'attempts' at row 1 at /srv/users/serverpilot/apps/pathram/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:105)

But the job still doesn't move to failed state! Am I missing something?

10th October, 2017

mathewparet left a reply on Eagerloading Not Working • 2 months ago

Found the issue - I was using an accessor for the ID field:

public function getIdAttribute($value)
    {
        return str_pad($value,config('app.customer_id_length'),0,STR_PAD_LEFT);
    }

It started working after I commented out the accessor.

mathewparet left a reply on Eagerloading Not Working • 2 months ago

@bobbybouwmann The foreign_key and local_key arguments are optional and are needed only if the conventional naming is different from the field names I've used. Since you said, I still went ahead and added foreign key and local key and I still get the same result - empty collection!

mathewparet left a reply on Eagerloading Not Working • 2 months ago

@Snapey - the second option (load) didn't work. It returned empty collection as I said earlier.

I can assure you that the data in the db is correct, because if I am using $customer->contacts->get() I get the values

The foreign_key and local_key arguments are optional and are needed only if the conventional naming is different from the field names I've used. Since you said, I still went ahead and added foreign key and local key and I still get the same result - empty collection!

mathewparet started a new conversation Eagerloading Not Working • 2 months ago

I defined a relationship and tried to eager load a relation. It worked in one instance while it didn't work in another (both are on 5.4). I am pretty sure it must be some silly mistake, but I am unable to spot it.

The following works (Project Laracron):

class DomainController extends Controller
{
public function show(Domain $domain)
    {
        
        $this->authorize('view',$domain);

        $domain=$domain->where('domain_name',$domain->domain_name)->with('monitors')->first();
        return view('domain.show',compact('domain'));
    }
}

class Domain extends Model
{
public function monitors() {
        return $this->hasMany(Monitor::class,'domain_name','domain_name');
    }
}

The following doesn't (MLLM):

class CustomerController extends Controller
{
public function show(Customer $customer)
    {
        $customer = $customer->where('ID',$customer->id)->with('contacts')->first();
        return view('customer.show', compact('customer'));
    }
}

class Customer extends Model
{
public function contacts()
    {
        return $this->hasMany(Contact::class);
    }
}
``
In case of MLLM when I eager load, I get (relations return empty collection!):
Customer {#234 ▼
  #dates: array:1 [▶]
  #connection: "mysql"
  #table: null
  #primaryKey: "id"
  #keyType: "int"
  +incrementing: true
  #with: []
  #withCount: []
  #perPage: 15
  +exists: true
  +wasRecentlyCreated: false
  #attributes: array:9 [▶]
  #original: array:9 [▶]
  #changes: []
  #casts: []
  #dateFormat: null
  #appends: []
  #dispatchesEvents: []
  #observables: []
  #relations: array:1 [▼
    "contacts" => Collection {#228 ▼
      #items: []
    }
  ]
  #touches: []
  +timestamps: true
  #hidden: []
  #visible: []
  #fillable: []
  #guarded: array:1 [▶]
}

14th September, 2017

mathewparet left a reply on After Upgrade To Laravel 5.5 (from Laravel 5.4) NewPivot Is Broken • 3 months ago

I am stuck with this for the past few days. Does anyone have any solution to this?

13th September, 2017

mathewparet started a new conversation After Upgrade To 5.5 NewPivot Is Broken • 3 months ago

After upgrading to 5.5, the method override for newPivot is failing:

My existing override (works in 5.4):

 public function newPivot(Model $parent, array $attributes, $table, $exists, $using = null)
    {
        if ($parent instanceof User) return new PlanUserPivot($parent, $attributes, $table, $exists);

        return parent::newPivot($parent, $attributes, $table, $exists);
    }

Error received:

Type error: Argument 1 passed to Illuminate\Database\Eloquent\Model::__construct() must be of the type array, object given, called in /Users/mathewparet/eclipse/workspace/laracron/app/Plan.php on line 17 (View: /Users/mathewparet/eclipse/workspace/laracron/resources/views/layouts/two-sided-right.blade.php) (View: /Users/mathewparet/eclipse/workspace/laracron/resources/views/layouts/two-sided-right.blade.php)

Error is thrown at Eloquent/Model.php on:

 public function __construct(array $attributes = [])
    {

26th August, 2017

mathewparet left a reply on Roles And Permissions And Policy Classes • 3 months ago

I am having the same issue. Is your's fixed, @xtremer360 ?

20th August, 2017

mathewparet left a reply on Unable To Require Zandervdm/gitception • 3 months ago

#Closed

My mistake. I found the complete stack trace in Laravel log. It was a missing , in config/app.php

mathewparet left a reply on Unable To Require Zandervdm/gitception • 3 months ago

Stack trace:

Stack trace:
#0 /Users/mathewparet/eclipse/workspace/LaraCron/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(39): Illuminate\Foundation\Bootstrap\LoadConfiguration->loadConfigurationFiles(Object(Illuminate\Foundation\Application), Object(Illuminate\Config\Repository))
#1 /Users/mathewparet/eclipse/workspace/LaraCron/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(208): Illuminate\Foundation\Bootstrap\LoadConfiguration->bootstrap(Object(Illuminate\Foundation\Application))
#2 /Users/mathewparet/eclipse/workspace/LaraCron/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(267): Illuminate\Foundation\Application->bootstrapWith(Array)
#3 /Users/mathewparet/eclipse/workspace/LaraCron/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(114): Illuminate\Foundation\Console\Kernel->bootstrap()
#4 /Users/mathewparet/eclipse/workspace/LaraCron/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 {main}  ```

mathewparet started a new conversation Unable To Require Zandervdm/gitception • 3 months ago

When trying to require zandervdm/gitception using composer I am getting the below error:

gMac:LaraCron mathewparet$ composer require zandervdm/gitception
Using version ^0.0.1 for zandervdm/gitception
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 4 installs, 0 updates, 0 removals
  - Installing jacobkiers/oauth (1.0.12): Loading from cache
  - Installing kriswallsmith/buzz (v0.15.1): Loading from cache
  - Installing gentle/bitbucket-api (0.8.4): Loading from cache
  - Installing zandervdm/gitception (0.0.1): Loading from cache
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize

                                                            
  [Symfony\Component\Debug\Exception\FatalThrowableError]   
  Parse error: syntax error, unexpected ';', expecting ']'  
                                                            

Script php artisan optimize handling the post-update-cmd event returned with error code 1

Installation failed, reverting ./composer.json to its original content.

I am facing this issue only on my development box. I tried the above composer command in prod and it didn't throw any error. Can someone please try to help me sort this out?

16th August, 2017

mathewparet left a reply on Link In Email Generated Wrongly • 3 months ago

I found a fix for this - or at least a work around. I modified the APP_URL in .env from localhost to my domain name and it started working as expected.

However, I still don't understand why the first mail worked without this change!

mathewparet left a reply on Link In Email Generated Wrongly • 3 months ago

But I need to pass the domain attribute. It is required for the route to be generated properly.

mathewparet started a new conversation Link In Email Generated Wrongly • 3 months ago

I have configured 2 email messages in my Laravel app.

One: when the user registers:

@component('mail::message')
# Welcome to {{config('app.name')}}

Thank you, {{$user->name}}, for registering with us.

You have now subscribed to the **{{$user->plan()->first()->name}}** plan. This is what you get:

@component('mail::table')
| Feature | Limit |
| ------- | -----:|
@foreach($user->features as $feature)
| {{$feature->name}} | {{$feature->max_units>0?$feature->max_units:'UNLIMITED'}}{{$feature->unit_name?' '.$feature->unit_name:''}} |
@endforeach
@endcomponent

@component('mail::button', ['url' => route('domains.create')])
Add a Domain Name
@endcomponent

Thanks,<br>
{{ config('app.name') }}
@endcomponent

Two: when a user's domain name is verified

@component('mail::message')
# {{ $domain->domain_name }} is Verified

We have successfully verified your ownership of the domain: {{ $domain->domain_name }}

@component('mail::button', ['url' => route('domains.monitors.create',['domain'=>$domain->domain_name])])
Add Monitors
@endcomponent

Thanks,<br>
{{ config('app.name') }}
@endcomponent

in both conditions the mail::button component derives the URL using route(). In the first email, I get the correct domain name, while in the second email the domain name comes as "localhost". Both emails come from production.

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.