samedi 8 octobre 2016

laravel 5.2 multi user authentication from multiple tables using package

please suggest any package for multiple user authentication from multiple tables in Laravel



via Chebli Mohamed

laravel 5.2 session flash working on localhost but not working on server?

Session flash working fine on local but not working on server in laravel5.2 ?

In controller

Session::flash('key', value"); return Redirect::to('/');

 In view

@if (Session::has('key') && Session::get('key')!='')

alert('.......'); @endif

})



via Chebli Mohamed

vendredi 7 octobre 2016

laravel 5.2 Session not persist after login

Laravel 5.2 Session not persist after login, I have not used any middleware or default laravel auth for login. I used native php login code



via Chebli Mohamed

jeudi 6 octobre 2016

Multi user authentication laravel 5.2

can anyone tell me where to put below code in auth.php This is link i used for authentication

'multi' => [ 'user' => [ 'driver' => 'eloquent', 'model' => App\User::class, 'table' => 'users' ], 'admin' => [ 'driver' => 'eloquent', 'model' => App\Admin::class, 'table' => 'admins' ] ],



via Chebli Mohamed

Fatal error: Class 'App\Http\Controllers\Redirect' not found

when i run below command in my terminal it shows below code instead of routes

php artisan route:list



 <html>
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="refresh" content="1;url=http://localhost/login" />

        <title>Redirecting to http://localhost/login</title>
    </head>
    <body>
        Redirecting to <a href="http://localhost/login">http://localhost/login</a>.
    </body>
</html>

[Symfony\Component\Debug\Exception\FatalThrowableError] Fatal error: Class 'App\Http\Controllers\Redirect' not found



via Chebli Mohamed

mercredi 5 octobre 2016

Migrate data from table to different tables with Laravel

I'm working with an existent project on Laravel and I need to change current database schema and keep current data.

For example, I have this table in the initial migration:

Person

----------------------------------------------
| **Id**        |**Name**  | **PhoneNumber** |
----------------------------------------------
|             1 | John Doe | 111-55-5855     |
----------------------------------------------
|             2 | Jane Doe | 111-55-5521     |
----------------------------------------------

But now, I need to split this into two tables:

Person

----------------------------
| **Id**        |**Name**  |
----------------------------
|             1 | John Doe |
----------------------------
|             2 | Jane Doe |
----------------------------

Person Phone

---------------------------------------------------
| **PhoneId**   | **PersonId**  | **PhoneNumber** |
---------------------------------------------------
|             1 |             1 | 111-55-5855     |
---------------------------------------------------
|             2 |             2 | 111-55-5521     |
---------------------------------------------------

So, in the new migration I delete PhoneNumber from Person and add the new table PersonPhone.

Is there any way to map PhoneNumber to the new table and keep PhoneId and PersonId in Person table? Or the only way is create a MySQL script?



via Chebli Mohamed

Via Remember me always return false

Before I posted this, I did some searching but still I don't know it always return false. My code is below

html

<input type="checkbox" name="remember"/> 

controller

$remember = ($request->has('remember')) ? true : false;

if (Auth::attempt($credentials, $remember))

Then after successful logged-in. I checked the dd(Auth::viaRemember()); and it return false. Even changed my config/session.php setting 'expire_on_close' => true from false.

Basically what I want is when the user tick the remember me checkbox I will set the session lifetime to 3 days else to 1 day only.



via Chebli Mohamed