I want to pass, customer id, with route method, How can I do?
Have you solved it?
More efficient as how?
How could I add switch case to my RedirectIfAuthenticated class to redirect user to different dashboar after login?
How can i use Laravel Auth and Vue-Router ?
someone can give me example for this case ?
Any one ionic developer here?
here is my class CreateUsersTable:
public function up()
{
Schema::create(‘users’, function (Blueprint $table) {
$table->increments(‘id’);
$table->enum(‘isAdmin’, [4, 3, 2, 1, 0])->default(0);
$table->string(‘name’);
$table->string(’email’)->unique();
$table->timestamp(’email_verified_at’)->nullable();
$table->string(‘password’);
$table->rememberToken();
$table->timestamps();
});
}
I want to set every single type of user [4,3,2,1,0] has different home/dashboad page. How can I make middleware to manage user access and redirect those 5 type of user to their home/dashboard page is there any body have tutorial how to do this?

Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
set name for route ,for example : single_customer
then
href={{route(‘single_customer’,$customer->id)}}
any one with laravel tutorials
here is my class CreateUsersTable:
public function up()
{
Schema::create(‘users’, function (Blueprint $table) {
$table->increments(‘id’);
$table->enum(‘isAdmin’, [4, 3, 2, 1, 0])->default(0);
$table->string(‘name’);
$table->string(’email’)->unique();
$table->timestamp(’email_verified_at’)->nullable();
$table->string(‘password’);
$table->rememberToken();
$table->timestamps();
});
}
I want to set every single type of user [4,3,2,1,0] has different home/dashboad page. How can I make middleware to manage user access and redirect those 5 type of user to their home/dashboard page is there any body have tutorial how to do this?
Have you solved it?
No, still looking for some related tutorials, but I didn’t found it
Route::get(‘/dashboard’, ‘ControllerName@function’);
In the controller function, get user’s isAdmin value and write this conditional statement
if(isAdmin == 1){
return view(‘dashboard1);
} else if(…
Route::get(‘/dashboard’, ‘ControllerName@function’);
In the controller function, get user’s isAdmin value and write this conditional statement
if(isAdmin == 1){
return view(‘dashboard1);
} else if(…
Because he is only evaluating one value, switch case is more efficient
I am really a newbie in laravel, and I don’t know how to do that, any tutorials how to use switch case?
More efficient as how? He can use switch case if he likes or use if statement if he likes.
Other than websites, I also do some IoT projects with constrained device. You will really feel the difference between if else and switch case there. You might be not able to really feel the impact of these two in web programming.
But still, take a look at this

Is it possible to redirect users with different user roles to a different page in laravel 5.1?
I have looked into Auth middleware and Auth controller, but found nothing that processes the login re…
<?php
namespace AppHttpMiddleware;
use Closure;
use IlluminateSupportFacadesAuth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param IlluminateHttpRequest $request
* @param Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect(‘/home’);
}
return $next($request);
}
}
How could I add switch case to my RedirectIfAuthenticated class to redirect user to different dashboar after login?
<?php
namespace AppHttpMiddleware;
use Closure;
use IlluminateSupportFacadesAuth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param IlluminateHttpRequest $request
* @param Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect(‘/home’);
}
return $next($request);
}
}
How could I add switch case to my RedirectIfAuthenticated class to redirect user to different dashboar after login?
this class check user login every request ,
But still, take a look at this
I already found my solution. I fixed it with adding switch case in login controller. Thank U


You didn’t import that in this controller
You have to write auth api
also jwt ?
someone can give me example for this case ?
someone can give me example for this case ?
https://codeburst.io/api-authentication-in-laravel-vue-spa-using-jwt-auth-d8251b3632e0
Introduction: Laravel is the fastest growing PHP framework and is used by thousands of developers around the globe to rapidly build robust…

In my ionic app when I select image from gallery it’s upload on server but not show preview
Yes
I called pivot table, a cart.
this is relationship code
return $this->belongsToMany(‘AppModelsProduct’, ‘carts’)->withPivot([‘uuid’, ‘user_ip’, ‘status’]);
When I run the following code, I get the following error.
$user->products()->attach([
‘product_id’ => $id,
‘uuid’ => Uuid::generate(4)->string,
‘user_ip’ => request()->ip(),
‘status’ => 1
]);
this is error:
SQLSTATE[HY000]: General error: 1364 Field ‘uuid’ doesn’t have a default value (SQL: insert into carts (product_id, user_id) values (3, 2), (2c443c9c-f724-420c-bfe8-6299d322e68d, 2), (192.168.1.20, 2), (1, 2))
I called pivot table, a cart.
this is relationship code
return $this->belongsToMany(‘AppModelsProduct’, ‘carts’)->withPivot([‘uuid’, ‘user_ip’, ‘status’]);
When I run the following code, I get the following error.
$user->products()->attach([
‘product_id’ => $id,
‘uuid’ => Uuid::generate(4)->string,
‘user_ip’ => request()->ip(),
‘status’ => 1
]);
this is error:
SQLSTATE[HY000]: General error: 1364 Field ‘uuid’ doesn’t have a default value (SQL: insert into carts (product_id, user_id) values (3, 2), (2c443c9c-f724-420c-bfe8-6299d322e68d, 2), (192.168.1.20, 2), (1, 2))
Make sure your primary keys are auto incrementing
yes there are auto incrementing.
I called pivot table, a cart.
this is relationship code
return $this->belongsToMany(‘AppModelsProduct’, ‘carts’)->withPivot([‘uuid’, ‘user_ip’, ‘status’]);
When I run the following code, I get the following error.
$user->products()->attach([
‘product_id’ => $id,
‘uuid’ => Uuid::generate(4)->string,
‘user_ip’ => request()->ip(),
‘status’ => 1
]);
this is error:
SQLSTATE[HY000]: General error: 1364 Field ‘uuid’ doesn’t have a default value (SQL: insert into carts (product_id, user_id) values (3, 2), (2c443c9c-f724-420c-bfe8-6299d322e68d, 2), (192.168.1.20, 2), (1, 2))
From this there is a collumn not receiving values
OK, I used this on the relation:
->withPivot([‘uuid’, ‘user_ip’, ‘status’]);
->withPivot([‘uuid’, ‘user_ip’, ‘status’]);
Uuid is not receiving any value
‘uuid’ => ‘hiiii’,