mercredi 30 août 2017

Pheanstalk\Exception\ServerExceptionvendor/pda/pheanstalk/src/Command/ReleaseCommand.php:63

Job 58520 NOT_FOUND: does not exist or is not reserved by client.

In my job script, I am doing two more things. One is DOM html parsing and other is sending cURL request.

I re-attempts curl request 5 times with one second delay in each attempt unless I get success response.

This is a very rare error which occurs 0.1%. We are unable to re-generate it. Any help will be gracious..



via Chebli Mohamed

mardi 29 août 2017

Storing additional data in Laravel jobs table

Is there a way to store additional data in the Laravel jobs table? I am using Laravel 5.1 and the database queue driver. For certain jobs, they're being dispatched to process data for a particular model, and I'd like to record the ID of that model in the row so I can query if there's a job queued up for it.

Otherwise, is there a recommended way to know what the job is queued up for?



via Chebli Mohamed

samedi 26 août 2017

Return the model I belongTo based on foreign key

How can I get the full model based on the foreign key in a table using Laravel?

A user row will have a single tier it's associated with, represented by the ID as the foreign key.

I need to return the user with the tier it belongs to, and the entire contents of that tier as well.

In my User model, I've tried protected $with = ['tier'];, but this doesn't work.

User:

public function tier()
{
    return $this->belongsTo('App\Tier');
}

Tier:

public function users()
{
    return $this->hasMany('App\User');
}

User's table:

enter image description here

User's table structure fk index:

enter image description here



via Chebli Mohamed

vendredi 25 août 2017

AWS cognito user authentication with laravel

We are trying to implement Amazon Cognito services for user authentication with our built in laravel 5.1 application. We are looking for a composer package for laravel 5.1 that allow to Amazon Cognito User Pools, registering user's into User Pools, password resets etc.



via Chebli Mohamed

mercredi 23 août 2017

Does Package creation changes with routes in laravel 5.4

Do we need to maintain separate route like web.php and api.php for routes while creating package in laravel5.4 .

I have a laravel package which is in 5.1 if i need to move in 5.4 do i need to change its route like web and api . Currently i have it in http -> routes.php.



via Chebli Mohamed

mardi 22 août 2017

Undefined offset error when trying to store multiple records in laravel [duplicate]

Hello everyone i am facing this issue when trying to store multiple records in database.

The Error says: Undefined index

Here is my code:

$str1 = $request->s_start[$i];
            $str2 = $request->s_end[$i];
            $startint = preg_replace("/[^0-9]/", "", $str1);
            $endint = preg_replace("/[^0-9]/", "", $str2);
            $words = preg_replace('/[[:digit:]]/', '', $str1);

            for ($i = $startint; $i < $endint; $i++) {
                $newstring = $words . $i;

                    $pls = new \App\ItemSeries();
                    $pls->pl_id = $pl->id;
                    $pls->series = $newstring;

                    $pls->save();

            }

Any one please help me out.



via Chebli Mohamed

lundi 21 août 2017

Laravel DB Query with multiple sub strings

I am looking to run a a DB query where if a user queries with multiple sub-strings across two columns they can bey queried. For example,

Column 1 is Country Name and Column 2 is City and Country Name. Sample data:

Column1| Column2
USA | Portland, Oregon, United States of America
USA | Portland, Maine, United State of America
USA | Bellevue, Washington, United State of America
USA | Bellevue, Nebraska, United State of America

Now user can query using various option. For example:

Portland America 
Portland USA
Portland Oregon USA
Portland Oregon America
Portland United States
... and so on

I am looking to build a query that can solve this for me. I tried the combination of where and orwhere but that didn't solve for it.



via Chebli Mohamed