mercredi 5 octobre 2016

Multi authentication laravel 5.2

I find a lot but didn't get result ,which one is best way to multi Authentication laravel 5.2



via Chebli Mohamed

Get rows from database in laravel

Image one is "video_submission" table

Image one is "video_submission_transaction" table

I want to make group by job_no, same job_no should come under one group, how will be the laravel Query, from those two tables I should get 3 rows, both tables should have a join also,



via Chebli Mohamed

How do I bind a Model Object while using resource controller in Laravel 5.1

What I'm looking for is something like this

public function store(Help $help)
{
    $help->save();

    return response
}

I have added the model class is Routes.php file like this

Route::model('help', 'App\Help');
Route::resource('api/help', 'HelpController');

And this is my Help.php file

class Help extends Model
{
    use SoftDeletes;

    protected $primaryKey = 'id';

    protected $table = 'help';

    protected $dates = ['deleted_at'];

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = array('name','description','deleted_at','created_at', 'updated_at');

}

Binding is happening to an extent, i.e, there is a new row in the table but the attributes "name" and "description" are empty.



via Chebli Mohamed

mardi 4 octobre 2016

Is there any way to pass variable in rememberForever callback?

I have following code,

\Cache::rememberForever('Roles', function() {
    return RoleModel
        ::where('ParentRoleID' >= $CurrenctUserRoleID)
        ->get();
});

Issue is: I am getting Error

Undefined variable: CurrenctUserRoleID

Question: Is there any way to pass variable in callback?



via Chebli Mohamed

$this->clearLoginAttempts($request); is not working preperly?

I have Route like this.

Route::post('login',           
    array (
        'uses'          => 'Auth\LoginController@login',
        'as'            => 'postlogin',
        'middleware'    => ['throttle:3,1']
    )
);

Below mentioned method can be found in this file:

vendor\laravel\framework\src\Illuminate\Foundation\Auth\AuthenticatesUsers.php

protected function sendLoginResponse(Request $request)
{
    $request->session()->regenerate();

    $this->clearLoginAttempts($request);

    return $this->authenticated($request, $this->guard()->user())
            ?: redirect()->intended($this->redirectPath());
}

What am I doing?

I am authenticated Successfully and then pressed Logout button. I did the same thing 3 times. Each time I am authenticated successfully and then pressing logout button. On 4th attempt, I am locked for 1 minute.

What's the problem?

On successful login, this code $this->clearLoginAttempts($request); executes and clears the previous login attempts. Still I am locked. Why? Is it an issue in Laravel 5.3?



via Chebli Mohamed

Check if a value is present in a comma separated varchar string

I have a record "id_zone" in database that store cites id like this $abilitato->id_zone = '1, 2, 3, 9, 50' From laravel i need to check if a value passed from url is present in this field. The following work only if i have a single value

$abilitato = \App\Models\Servizi::where('id', $servizio)->('id_zone', $verifica->id_citta)->first();
                if(!empty($abilitato) && empty($verifica->multicap)) {
                $json = ['CAP' => '1' , 'DEB' => $cap ];
                    }else{
                $json = ['CAP' => '0' , 'DEB' => $cap];

            }

i need to check if



via Chebli Mohamed

lundi 3 octobre 2016

pdo drivers shows no value in linux

this is screenshot i have install php5.6 with the following command: - sudo apt-get install -y php5.6 and also install the php cli with this command : sudo apt-get install php5-cli.

then,

I have added following line to php.ini file for extenstion: extension=pdo.so and extension=pdo_mysql.so

and given the extension path : extension = /usr/lib/php/20131226/pdo_mysql.so

and use command : sudo apt-get install php-mysql

but still shows the pdo drivers no value when running phpinfo()

so, how to solve?



via Chebli Mohamed