This only affect to profiles table right?
Perhaps you know how to stop email spoofing?
How can I solve this error?
Are you still looking for one?
Why we need refresh token with generated token?
Sir,which is secure location to store refresh tokens?
Guys i am need from eloquent array without key, how i could get it?
Is hard to migrate a domain?
Hey, anyone know how to paginate two collections at the same time?
anyone can help me with this?
who help me to deploy my laravel website ?
what is your webserver ?
public function up()
{
Schema::create(‘profiles’, function (Blueprint $table) {
$table->increments(‘id’);
$table->integer(‘user_id’)->unsigned();
$table->foreign(‘user_id’)->references(‘id’)->on(‘users’)->onDelete(‘cascade’);
$table->string(‘first_name’);
$table->string(‘last_name’);
$table->string(‘phone’);
$table->string(‘institution’);
$table->string(‘department’)->nullable();
$table->string(‘city’);
$table->string(‘country’);
$table->string(‘zip’);
$table->rememberToken();
$table->timestamps();
});
}
I already set relation beetwen those table on User model and Profile model:
here is User.php
public function profile(){
return $this->hasOne(‘AppProfile’);
}
and here is my Profile.php
public function user() {
return $this->belongsTo(‘AppUser’);
}
As so far, those table already have relation, but the problem is the user can create more than One profile.
I have read some related tutorial with add some code to the ProfileController on store class but didn’t solve my problem. Here is my store function:
public function store(Request $request)
{
$profile=new Profile();
$profile->user_id = auth()->user()->id;
$profile->first_name=$request->get(‘first_name’);
$profile->last_name=$request->get(‘last_name’);
$profile->phone=$request->get(‘phone’);
$profile->institution=$request->get(‘institution’);
$profile->department=$request->get(‘department’);
$profile->city=$request->get(‘city’);
$profile->country=$request->get(‘country’);
$profile->zip=$request->get(‘zip’);
$profile->save();
return view(‘profile.ku’)->with(‘success’, ‘Abstract has been successfully submited pending for approval’);
}
Wish any body can help, please
Having a One to One Relationship does not stop users from creating more than one profile, you can restrict multiple account creation by adding a unique key constraint to a column to your profiles table.
Eg.
Make user_id an unique filed in the profiles table and you will not be able to create more than one record for a user because of the database’s unique key constraints.
public function up()
{
Schema::create(‘profiles’, function (Blueprint $table) {
$table->increments(‘id’);
$table->integer(‘user_id’)->unsigned();
$table->foreign(‘user_id’)->references(‘id’)->on(‘users’)->onDelete(‘cascade’);
$table->string(‘first_name’);
$table->string(‘last_name’);
$table->string(‘phone’);
$table->string(‘institution’);
$table->string(‘department’)->nullable();
$table->string(‘city’);
$table->string(‘country’);
$table->string(‘zip’);
$table->rememberToken();
$table->timestamps();
});
}
.
.
$table->integer(‘user_id’)->unsigned()->unique();
.
.
Eg.
Make user_id an unique filed in the profiles table and you will not be able to create more than one record for a user because of the database’s unique key constraints.
This only affect to profiles table right??? What if I have another table with one to one relation with the userstable and i need this table to allow user to create more than one record. Is that possible?
Thanks Brother


Yes, on profiles table.
Then user One-to-Many becuase that relationship is not One-to-One.
Then user One-to-Many becuase that relationship is not One-to-One.
Ofcourse I meant one to many for the other table 😅. Thanks alot
You mean profiles table?
Here is what you need to do:
One-to-One on users table
One-to-One on profiles table
(but on profiles table, user_id must be ->unique())
Here is what you need to do:
One-to-One on users table
One-to-One on profiles table
(but on profiles table, user_id must be ->unique())
Since you want only one record for a user.
Once you want more than one record for a particular model by a user the One-to-Many or other type of relationship will be more appropriate.
Quite often I get a question from junior developers like “how to get better at Laravel”, and there’s so much to study potentially that I decided to gather the topics and classify them somehow. Let’s begin. Notice: this is kind of a follow-up on my article How to Test Junior Laravel Developer Skills. Topic 1. […]
How can I solve this error?
Try to reinstall your laravel
Are you still looking for one?
If yes, let’s DM
They serve different roles at authenticating an api request.
More like two layers of security but I assume you understand basic concept of APIs.
This should help:
https://auth0.com/blog/refresh-tokens-what-are-they-and-when-to-use-them/
… TLDR; …
ACCESS Token:
– 1. Guards client requests (determines authenticity/authorization of a client request).
– 2. Works at RESOURCE server section.
– 3. Short-lived.
– 4. Not as jealously gaurded as refresh token.
– 5. Access a resource directly.
REFRESH Token:
– 1. Guards the Access Tokens (determines authenticity of the current Access Token).
– 2. Generates a new Access Token (when old one expires and gets access to a new resource for the first) time by creating a new access token 👌)
– 3. Works at AUTH server section.
– 4. Life span is longer.
– 5. Jealously guarded by storing in more secure location to prevent leakage.
You don’t have to worry about these things though, they have been handled in Laravel.
Guess you only want to know their differences.
Learn about refresh tokens and how they help developers balance security and usability in their applications.
More like two layers of security but I assume you understand basic concept of APIs.
This should help:
https://auth0.com/blog/refresh-tokens-what-are-they-and-when-to-use-them/
… TLDR; …
ACCESS Token:
– 1. Guards client requests (determines authenticity/authorization of a client request).
– 2. Works at RESOURCE server section.
– 3. Short-lived.
– 4. Not as jealously gaurded as refresh token.
– 5. Access a resource directly.
REFRESH Token:
– 1. Guards the Access Tokens (determines authenticity of the current Access Token).
– 2. Generates a new Access Token (when old one expires and gets access to a new resource for the first) time by creating a new access token 👌)
– 3. Works at AUTH server section.
– 4. Life span is longer.
– 5. Jealously guarded by storing in more secure location to prevent leakage.
You don’t have to worry about these things though, they have been handled in Laravel.
Guess you only want to know their differences.
Sir,which is secure location to store refresh tokens?
Is hard to migrate a domain?
I have a .xyz and bought a .com, now I need to migrate. xD
Is hard to migrate a domain?
I have a .xyz and bought a .com, now I need to migrate. xD
Hi…
it’s not hard..
Just upload the current domain information to the new domain …
Laravel 5 – Repositories to abstract the database layer – GitHub – andersao/l5-repository: Laravel 5 – Repositories to abstract the database layer
it’s not hard..
Just upload the current domain information to the new domain …
Thanks! 😀
Generally as encrypted cookies or so but not at publicly accessible part of your server.
If you’re using a framework like laravel you don’t have to worry much but advisable to check the documentation to know what goes on under the hood.
Developers/companies/frameworks implement it differently so you’ve got to check what works best for you.

Hello guys im returning some nested json resopnse from laravel controller from a route in api
problem is after 4th and 5th child of the json its not showning the json data
problem is after 4th and 5th child of the json its not showning the json data
here is my controller:
$results = [];
$cases = [];
$mobile = Mobile::getBySlug($mobile);
$material = Material::getBySlug($collection);
$collection = Collection::getBySlug($collection);
$stickers = $collection->stickers;
$modes = $material->modes;
foreach ($modes as $mode)
{
array_push($cases, Acase::getByModeAndMobile($mode->id, $mobile->id));
}
$cases = collect($cases);
foreach ($stickers as $sticker)
{
array_push($results, [
‘sticker’ => $sticker->name,
‘sticker_slug’ => $sticker->slug,
‘modes’ => ModeResource::collection($modes),
‘cases’ => $cases->each(function (
$case
) use ($sticker)
{
return [
‘name’ => $case->name,
‘slug’ => $case->slug,
‘mobile’ => $case->mobile->name,
‘mobile_slug’ => $case->mobile->slug,
‘brand’ => $case->mobile->brand->name,
‘brand_slug’ => $case->mobile->brand->slug,
‘mode’ => $case->mode->name,
‘mode_slug’ => $case->mode->slug,
‘price’ => (float) $case->price,
‘sss’ => GalleryResource::collection(Gallery::where(‘acase_id’,
$case->id)->where(‘sticker_id’, $sticker->id)->get()),
];
}),
]);
}
return response()->json($results);
$results = [];
$cases = [];
$mobile = Mobile::getBySlug($mobile);
$material = Material::getBySlug($collection);
$collection = Collection::getBySlug($collection);
$stickers = $collection->stickers;
$modes = $material->modes;
foreach ($modes as $mode)
{
array_push($cases, Acase::getByModeAndMobile($mode->id, $mobile->id));
}
$cases = collect($cases);
foreach ($stickers as $sticker)
{
array_push($results, [
‘sticker’ => $sticker->name,
‘sticker_slug’ => $sticker->slug,
‘modes’ => ModeResource::collection($modes),
‘cases’ => $cases->each(function (
$case
) use ($sticker)
{
return [
‘name’ => $case->name,
‘slug’ => $case->slug,
‘mobile’ => $case->mobile->name,
‘mobile_slug’ => $case->mobile->slug,
‘brand’ => $case->mobile->brand->name,
‘brand_slug’ => $case->mobile->brand->slug,
‘mode’ => $case->mode->name,
‘mode_slug’ => $case->mode->slug,
‘price’ => (float) $case->price,
‘sss’ => GalleryResource::collection(Gallery::where(‘acase_id’,
$case->id)->where(‘sticker_id’, $sticker->id)->get()),
];
}),
]);
}
return response()->json($results);
anyone can help me with this?

who help me to deploy my laravel website ? i cant understan why still whowing this error
Dude! Do you solve the problem?
what is your webserver ?