mathewparet

Experience

6,370

0 Best Reply Awards

  • Member Since 11 Months Ago
  • 55 Lessons Completed
  • 1 Favorite

13th July, 2018

mathewparet left a reply on Debugging VueJS Error Messages • 1 week ago

@martinbean But here, I don't think it meant so. Line 1 has only 98 columns!

Anyways I did found the issue and fixed it. It was in line 1 but in a different column.

12th July, 2018

mathewparet started a new conversation Debugging VueJS Error Messages • 1 week ago

How do I debug this error in VueJs:


error  in ./resources/assets/js/components/invitations/InvitationList.vue

Syntax Error: Unexpected token (1:130)


@ ./resources/assets/js/components/invitations/InvitationList.vue 6:23-276
@ ./resources/assets/js/app.js
@ multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss

It doens't give much clue or I don't understand where to look at!

What does 1:130 and 6:23-276 mean? Does it point to the error? H

29th June, 2018

mathewparet left a reply on Wiered Sendmail Problem • 3 weeks ago

I think I found the issue. All mails were going to a closed group in a single domain. Seems like the domain was filtering mails with "awarded" in the subject :)

mathewparet started a new conversation Wiered Sendmail Problem • 3 weeks ago

I've got a wiered problem. My production server is configured to use sendmail for mails. My local environment is configured to send mails to mailtrap.

I have defined 3-4 notification(mails) and all of them work properly in my local environment.

However, in my production environment, one mail alone doesn't go! I temporarily changed the production config to log and can confirm that the mail is being generated. However, recipients aren't receiving that mail alone.

Can anyone help me out on how I can debug sendmail to check whether sendmail processed the mail successfully?

20th June, 2018

mathewparet left a reply on Any Laravel Browser Caching Package? • 1 month ago

Have you found a good way to do this? I am trying to do the same. But just wondering, if I do it in .htaccess, but I have an NGINX server running between the user's browser and apache, will it still work? Or will I have to configure something at NGINX level?

17th June, 2018

mathewparet started a new conversation Composer Install Failing For Laravel Dusk In Bitbucket Pipeleine • 1 month ago

I am getting the below error in my bitbucket pipeline when trying to install dusk:

Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - Installation request for facebook/webdriver 1.6.0 -> satisfiable by facebook/webdriver[1.6.0].
    - facebook/webdriver 1.6.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
  Problem 2
    - facebook/webdriver 1.6.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - laravel/dusk v3.0.8 requires facebook/webdriver ~1.0 -> satisfiable by facebook/webdriver[1.6.0].
    - Installation request for laravel/dusk v3.0.8 -> satisfiable by laravel/dusk[v3.0.8].

My pipeline file looks like this:

# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/VYk8Lw for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: php:7-fpm

pipelines:
  branches:
    master:
      - step:
          name: Build and test
          script: # Modify the commands below to build your repository.
            - apt-get update && apt-get install -y unzip git curl libmcrypt-dev mysql-client
            - yes | pecl install mcrypt-1.0.1
            - docker-php-ext-install pdo_mysql
            - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
            - composer -V
            - composer install
            - export DB_CONNECTION=mysql
            - php artisan key:generate --env=testing
            - cat .env.testing | grep KEY
            - cp .env.testing .env
            - php artisan migrate:install --env=testing
            - php artisan migrate --env=testing
            - php artisan config:cache
            - vendor/bin/phpunit
            - php artisan dusk
          services:
            - mysql

      - step:
          name: Deploy to Prod
          deployment: production
          script:
            - apt-get update && apt-get install -y git curl
            - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
            - composer -V
            - echo "Deploying to production"
            - composer global require laravel/envoy
            - ~/.composer/vendor/bin/envoy run deploy

definitions:
  services:
    mysql:
      image: mysql:5.7
      environment:
        MYSQL_DATABASE: 'fifa_test'
        MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
        MYSQL_USER: 'test_user'
        MYSQL_PASSWORD: 'test_secret'

30th May, 2018

mathewparet left a reply on First Time Testing. Need Advice • 1 month ago

Thank you @Resin01

I'll take that :)

mathewparet started a new conversation First Time Testing. Need Advice • 1 month ago

I am doing testing for he first time. Most of my projects are personal and I don't do testing. But I liked the concept of PHPUnit and Dusk. I have managed to prepare a few tests. I would like to outline it here and would like someone to read and confirm whether I am missing something or am I overdoing the test cases. Some of these look like an over-kill.

tests\Browser\NewUserRegisterTest.php


namespace Tests\Browser;

use Tests\DuskTestCase;

use App\User;
use App\MobileVerification;
use Laravel\Dusk\Browser;
use Illuminate\Foundation\Testing\DatabaseMigrations;

class NewUserRegisterTest extends DuskTestCase
{
    use DatabaseMigrations;

    protected $user;

    public function setUp()
    {
        parent::setUp();
        $this->user = factory(User::class)->make(['mobile'=>'9176047303']);
    }

    /**
     * @group fields
    */
    public function testNameField()
    {
        $this->browse(function (Browser $browser) {
            $browser->visit(route('register'))
                    ->maximize()
                    ->press('Register')
                    ->assertRouteIs('register')
                    ->assertSee('The name field is required')
                    ->type('name',$this->user->name)
                    ->press('Register')
                    ->assertRouteIs('register')
                    ->assertDontSee('The name field is required')
                    ;
        });
    }

    /**
     * @group fields
    */
    public function testEmailField()
    {
        $user = factory(User::class)->create(['mobile'=>'9176047303']);
        $newUser = factory(User::class)->make(['mobile'=>'9176047304']);
        $this->browse(function (Browser $browser) use($user, $newUser) {
            $browser->visit(route('register'))
                    ->maximize()
                    ->press('Register')
                    ->assertRouteIs('register')
                    ->assertSee('The email field is required')
                    ->type('email',$user->name)
                    ->press('Register')
                    ->assertRouteIs('register')
                    ->assertSee('The email must be a valid email address')
                    ->type('email',$user->email)
                    ->press('Register')
                    ->assertRouteIs('register')
                    ->assertSee('The email has already been taken')
                    ->type('email',$newUser->email)
                    ->press('Register')
                    ->assertRouteIs('register')
                    ->assertDontSee('The email has already been taken')
                    ->assertDontSee('The email field is required')
                    ->assertDontSee('The email must be a valid email address')
                    ;
        });
    }

    /**
     * @group fields
    */
    public function testMobileField()
    {
        $user = factory(User::class)->create(['mobile'=>'9176047303']);
        $this->browse(function (Browser $browser) use($user) {
            $browser->visit(route('register'))
                    ->maximize()
                    ->press('Register')
                    ->assertRouteIs('register')
                    ->assertSee('The mobile field is required')
                    ->type('mobile',$user->mobile)
                    ->press('Register')
                    ->assertRouteIs('register')
                    ->assertSee('The mobile has already been taken')
                    ->type('mobile','12345')
                    ->press('Register')
                    ->assertRouteIs('register')
                    ->assertSee('The mobile must be 10 characters')
                    ->type('mobile','1234567890123')
                    ->press('Register')
                    ->assertRouteIs('register')
                    ->assertSee('The mobile must be 10 characters')
                    ->type('mobile','a123456789')
                    ->press('Register')
                    ->assertRouteIs('register')
                    ->assertSee('The mobile format is invalid')
                    ->type('mobile','1234567890')
                    ->press('Register')
                    ->assertRouteIs('register')
                    ->assertDontSee('The mobile field is required')
                    ->assertDontSee('The mobile has already been taken')
                    ->assertDontSee('The mobile must be 10 characters')
                    ->assertDontSee('The mobile format is invalid')
                    ;
        });
    }

    /**
     * @group fields
    */
    public function testOTPField()
    {
        $this->browse(function (Browser $browser) {
            $browser->visit(route('register'))
                    ->maximize()
                    ->press('Register')
                    ->assertRouteIs('register')
                    ->assertSee('The otp field is required')
                    ->type('mobile',$this->user->mobile)
                    ->press('Get OTP')
                    ->waitFor('#otpResponseSuccess')
                    ->type('otp','anc')
                    ->press('Register')
                    ->assertRouteIs('register')
                    ->assertSee('The otp must be a number')
                    ->type('otp',1234)
                    ->press('Register')
                    ->assertRouteIs('register')
                    ->assertDontSee('The otp field is required')
                    ->assertDontSee('The otp must be a number')
                    ;
        });
    }

    /**
     * @group fields
    */
    public function testTermsField()
    {
        $this->browse(function (Browser $browser) {
            $browser->visit(route('register'))
                    ->maximize()
                    ->press('Register')
                    ->assertRouteIs('register')
                    ->assertSee('The terms must be accepted')
                    ->check('terms')
                    ->press('Register')
                    ->assertRouteIs('register')
                    ->assertDontSee('The terms must be accepted')
                    ;
        });
    }

    /**
     * @group fields
    */
    public function testPasswordField()
    {
        $this->browse(function (Browser $browser) {
            $browser->visit(route('register'))
                    ->maximize()
                    ->press('Register')
                    ->assertRouteIs('register')
                    ->assertSee('The password field is required')
                    ->type('password','test')
                    ->press('Register')
                    ->assertSee('The password must be at least 6 characters')
                    ->type('password','secret')
                    ->press('Register')
                    ->assertSee('The password confirmation does not match')
                    ->type('password','secret')
                    ->type('password_confirmation','secret')
                    ->press('Register')
                    ->assertDontSee('The password confirmation does not match')
                    ->assertDontSee('The password must be at least 6 characters')
                    ;
        });
    }

    /**
     * @group otp
    */
    public function testUserRegistrationActiveOtp()
    {
        $this->browse(function (Browser $browser) {
            $browser->visit(route('register'))
                    ->maximize()
                    ->type('name',$this->user->name)
                    ->type('email', $this->user->email)
                    ->assertDisabled('otp')
                    ->type('mobile', $this->user->mobile)
                    ->press('Get OTP')
                    ->waitFor('#otpResponseSuccess')
                    ->assertEnabled('otp');

            $this->assertDatabaseHas('mobile_verifications',['mobile'=>$this->user->mobile, 'verified'=>0]);
            $m = MobileVerification::find($this->user->mobile);

            $browser->type('otp',$m->otp)
                    ->maximize()
                    ->type('password','secret')
                    ->type('password_confirmation','secret')
                    ->check('terms')
                    ->press('Register')
                    ->assertPathIs('/');

            $this->assertDatabaseHas('users', ['name'=>$this->user->name, 'email'=>$this->user->email, 'mobile'=>$this->user->mobile]);

            $user = User::whereEmail($this->user->email)->first();

            $browser->visit(route('verification_link',['user'=>$user->id, 'email_key'=>$user->email_key]))
                ->assertRouteIs('login')
                ->assertSee('Email address successfully verified');

            $this->assertDatabaseMissing('users', ['name'=>$this->user->name, 'email'=>$this->user->email, 'mobile'=>$this->user->mobile,'email_key'=>$user->email_key]);

        });

        
    }

    /**
     * @group otp
    */
    public function testUserRegistrationExpiredOtp()
    {
        $this->browse(function (Browser $browser) {
            $browser->visit(route('register'))
                    ->maximize()
                    ->type('name',$this->user->name)
                    ->type('email', $this->user->email)
                    ->assertDisabled('otp')
                    ->type('mobile', $this->user->mobile)
                    ->press('Get OTP')
                    ->waitFor('#otpResponseSuccess')
                    ->assertEnabled('otp');

            $this->assertDatabaseHas('mobile_verifications',['mobile'=>$this->user->mobile, 'verified'=>0]);
            $m = MobileVerification::find($this->user->mobile);

            $browser->type('otp',$m->otp)
                    ->maximize()
                    ->type('password','secret')
                    ->type('password_confirmation','secret')
                    ->check('terms')
                    ->press('Register')
                    ->assertRouteIs('register')
                    ->assertSee('Invalid OTP or OTP expired');

            $this->assertDatabaseMissing('users', ['name'=>$this->user->name, 'email'=>$this->user->email, 'mobile'=>$this->user->mobile]);

        });

        
    }

}```

29th March, 2018

mathewparet started a new conversation Why Would I Create A Sync Job. How Is It Different From Placing The Code In The Job In The Controller Itself. • 3 months ago

Why would I create a sync job. How is it different from placing the code in the job in the controller itself?

28th March, 2018

mathewparet left a reply on What Happens If A Laravel "synchronous" Job Fails? • 3 months ago

Exactly... That's what I don't understand. Why would I create a sync job. How is it different from placing the code in the job in the controller itself.

And oh by the way, when I posted this I was not logged into my workstation. I was on mobile.

mathewparet started a new conversation What Happens If A Laravel "synchronous" Job Fails? • 3 months ago

What happens if a Laravel "synchronous" job fails? Since it executes along with the page that calls the job, will it fail the calling page from being loaded?

Eg. I add a huge order. My OrderController calls a job that is configured as a synchronous job to add the details of the order into another table. The controller redirects to orders list page.

If the synchronous job fails, will the controller still continue its normal course and go to the order list page? Or will it fail?

9th January, 2018

mathewparet left a reply on Use Laravel Policies With Anonymous Users • 6 months ago

Did you find a solution?

23rd November, 2017

mathewparet started a new conversation How Do I Convert ```'``` To ```'```? • 8 months ago

How do I convert ' to '?

20th November, 2017

mathewparet started a new conversation Send Notification After All Instances Of A Job Completes • 8 months 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 • 8 months 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 • 8 months 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 • 8 months 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 • 8 months 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 • 8 months 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. • 8 months 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 • 9 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 • 9 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 • 9 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 • 9 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 • 10 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 • 10 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 • 10 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 • 11 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 • 11 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 • 11 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 • 11 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 • 11 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 • 11 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.