Can anyone suggest image compression packages for laravel?

|
niyazvpp 2021-10-02 18:29:11
can anyone suggest image compression packages for laravel?
vhryu 2021-10-02 18:33:38
vhryu 2021-10-02 16:38:24

How to resolve this issue guys

Cedric Aubin 2021-10-02 18:52:35
vhryu 2021-10-02 16:38:24

I guest this is from the returned message (confirmation message) send after you save your user in db.

Can I see the code of the save method or at least the end of it and the code of the view (blade) where this error appears ?

vhryu 2021-10-02 18:53:32
Cedric Aubin 2021-10-02 18:52:35
I guest this is from the returned message (confirmation message) send after you save your user in db.

Can I see the code of the save method or at least the end of it and the code of the view (blade) where this error appears ?

Yeah sure

Cedric Aubin 2021-10-02 19:01:33
vhryu 2021-10-02 18:53:32
Yeah sure

Ok, waiting

vhryu 2021-10-02 19:01:52
public function store(StoreAdminRequest $request, Admin $admin)
{
abort_if(Gate::denies(‘admins_create’), Response::HTTP_FORBIDDEN, ‘THIS ACTION IS UNAUTHORIZED.’);

$password= Str::random(8);
$request->request->add([‘password’=>$password,’user_series’=>”]);
$input = $request->all();
$input[‘status’] = $request->status ? 1 : 2;
$input[‘password’] = Hash::make($password);

if($admin = Admin::create($input)){
$input[‘password’] = $password;
Mail::to($request->email)->send(new SendAdminPassword($input));
if(!empty($request->input(‘roles’))){
$admin->roles()->sync($request->input(‘roles’, []));
}
$admin = Admin::findOrFail($admin->id);
return response()->json([‘status’=>’success’,’admin’ => $admin,’html’ => view(‘admin.admins.row’,compact(‘admin’))->render(), ‘message’=>”User added successfully.”]);
}else{
return response()->json([‘status’=>’fail’,’message’=>”An unexpected error occured.”]);
}
// $create = $request->all();
// $create[‘password’] = Hash::make($request->password);
// $admin = Admin::create($create);
#$admin->roles()->sync($request->input(‘roles’, []));

}

vhryu 2021-10-02 19:02:28
This is controller
vhryu 2021-10-02 19:05:30
This is create blade file
Cedric Aubin 2021-10-02 19:06:23
vhryu 2021-10-02 19:05:30
This is create blade file

It has been deleted. Can’t you just make a screenshot and send ?

vhryu 2021-10-02 19:06:42
Cedric Aubin 2021-10-02 19:06:23
It has been deleted. Can’t you just make a screenshot and send ?

Sure

Cedric Aubin 2021-10-02 19:09:21
Ok
vhryu 2021-10-02 19:10:27
laravel_discuss-96132.jpg

vhryu 2021-10-02 19:10:27
laravel_discuss-96131.jpg

vhryu 2021-10-02 19:10:28
laravel_discuss-96133.jpg

vhryu 2021-10-02 19:20:30
Cedric Aubin 2021-10-02 19:09:21
Ok

Did you find anything ??

Cedric Aubin 2021-10-02 20:07:41
vhryu 2021-10-02 19:10:27

I think the error is because in your view you create the html variable in a if condition but you use it outside that if statement making it undefined

vhryu 2021-10-02 20:08:39
Cedric Aubin 2021-10-02 20:07:41
I think the error is because in your view you create the html variable in a if condition but you use it outside that if statement making it undefined

Okay I will try it once tqq

Cedric Aubin 2021-10-02 20:09:41
Waiting your feedback
vhryu 2021-10-02 20:36:01
laravel_discuss-96140.jpg

vhryu 2021-10-02 20:36:01
laravel_discuss-96139.jpg

vhryu 2021-10-02 20:36:12
It doesn’t show anything now
vhryu 2021-10-02 20:36:32
laravel_discuss-96142.jpg

vhryu 2021-10-02 20:36:33
laravel_discuss-96144.jpg

vhryu 2021-10-02 20:36:33
laravel_discuss-96143.jpg

natghi2010 2021-10-02 20:39:28
is it not possible to access auth()->user from the user model?
natghi2010 2021-10-02 20:40:34
vhryu 2021-10-02 20:36:32

show console.log

vhryu 2021-10-02 20:47:37
Wait I will send
vhryu 2021-10-02 20:50:40
laravel_discuss-96148.jpg

vhryu 2021-10-02 20:50:51
Console.log
heartless980 2021-10-02 20:54:07
How can i get record base on pivot table…. Need help..?
vhryu 2021-10-02 20:55:21
natghi2010 2021-10-02 20:39:28
is it not possible to access auth()->user from the user model?

How to resolve that issue then

natghi2010 2021-10-02 20:58:12
vhryu 2021-10-02 20:55:21
How to resolve that issue then

That was my own question

natghi2010 2021-10-02 20:58:38
vhryu 2021-10-02 20:50:40

Okay better

natghi2010 2021-10-02 20:59:10
vhryu 2021-10-02 20:50:40

Show controller

vhryu 2021-10-02 21:01:11
vhryu 2021-10-02 19:01:52
public function store(StoreAdminRequest $request, Admin $admin)
{
abort_if(Gate::denies(‘admins_create’), Response::HTTP_FORBIDDEN, ‘THIS ACTION IS UNAUTHORIZED.’);

$password= Str::random(8);
$request->request->add([‘password’=>$password,’user_series’=>”]);
$input = $request->all();
$input[‘status’] = $request->status ? 1 : 2;
$input[‘password’] = Hash::make($password);

if($admin = Admin::create($input)){
$input[‘password’] = $password;
Mail::to($request->email)->send(new SendAdminPassword($input));
if(!empty($request->input(‘roles’))){
$admin->roles()->sync($request->input(‘roles’, []));
}
$admin = Admin::findOrFail($admin->id);
return response()->json([‘status’=>’success’,’admin’ => $admin,’html’ => view(‘admin.admins.row’,compact(‘admin’))->render(), ‘message’=>”User added successfully.”]);
}else{
return response()->json([‘status’=>’fail’,’message’=>”An unexpected error occured.”]);
}
// $create = $request->all();
// $create[‘password’] = Hash::make($request->password);
// $admin = Admin::create($create);
#$admin->roles()->sync($request->input(‘roles’, []));

}

This is controller

|