How does a user create in a class when there is no method for creating a user in an extending class?

|
prime 2020-06-02 15:44:39
Dc1sc0 2020-06-02 07:33:53
Hmm code?

if ($request->hasFile(‘images’)) {
foreach ($request->file(‘images’) as $image) {
$name=$image->getClientOriginalName();
$thumbnail=Image::make($name)->resize(259,194, function($constraint){
$constraint->aspectRatio()->save(public_path(‘/storage/storage/thumbnail2/’.$request->$image->hasName()));
//Image::make($image)

});
$data[‘images’] = $request->$image->hasName();
}
}

GTLeader 2020-06-02 15:50:17
cayetanohosma 2020-05-28 01:45:19
HYIP?? What’s that?

HYIP is High Yield Investment Program

GTLeader 2020-06-02 15:50:29
Like a Ponzi scheme
GTLeader 2020-06-02 15:53:27
Siberfx 2020-05-28 05:08:35
Virus maybe ?))

Not a virus

cayetanohosma 2020-06-02 15:58:21
GTLeader 2020-06-02 15:50:17
HYIP is High Yield Investment Program

Thanks!!

2020-06-02 15:59:28
At long last am able to install laravel
2020-06-02 16:13:10
Bittle 2020-06-02 01:01:40
Error is self explanatory, youre dividing by 0.

#/0 is not allowed.

So $hitung is 0 when it reaches like 34.

i get solution dude, so must declaration variable $hitung, like this

2020-06-02 16:13:55
laravel_discuss-39763.jpg

2020-06-02 16:14:21
program can running
Siberfx 2020-06-02 16:22:20
Could be another way too with an if statement and return 0; after if
Siberfx 2020-06-02 16:23:35
if ($hitung != 0) {…} return 0;
Siberfx 2020-06-02 16:25:43
Also more clean way, before foreach check if the relation has data returned
Siberfx 2020-06-02 16:28:01
if ($this->mapel()->count() == 0) { return 0; }
Siberfx 2020-06-02 16:28:44
Then you can remove trinary statement
Dc1sc0 2020-06-02 16:30:59
prime 2020-06-02 15:44:39
if ($request->hasFile(‘images’)) {
foreach ($request->file(‘images’) as $image) {
$name=$image->getClientOriginalName();
$thumbnail=Image::make($name)->resize(259,194, function($constraint){
$constraint->aspectRatio()->save(public_path(‘/storage/storage/thumbnail2/’.$request->$image->hasName()));
//Image::make($image)

});
$data[‘images’] = $request->$image->hasName();
}
}

dd ($request)

Siberfx 2020-06-02 16:31:39
Dc1sc0 2020-06-02 16:30:59
dd ($request)

dd($request->all())

Dc1sc0 2020-06-02 16:34:16
Yeah
prime 2020-06-02 16:34:28
Dc1sc0 2020-06-02 16:30:59
dd ($request)

i solved it…..thanks for your help……

Dc1sc0 2020-06-02 16:35:13
prime 2020-06-02 16:34:28
i solved it…..thanks for your help……

What problem
?

prime 2020-06-02 16:37:27
Dc1sc0 2020-06-02 16:35:13
What problem
?

laravel_discuss-39776.jpg

prime 2020-06-02 16:37:42
that is how i solved it……
Bittle 2020-06-02 17:32:58
laravel_discuss-39782.jpg

Eliberio 2020-06-02 17:33:21
https://serversideup.net/uploading-files-vuejs-axios/

Uploading Files With VueJS and Axios – Server Side UpServer Side Up
Handling files is always a task. This tutorial will simplify the process and show you how to upload files with VueJS and Axios through AJAX.
2020-06-02 17:50:27
Siberfx 2020-06-02 16:22:20
Could be another way too with an if statement and return 0; after if

Thanks dude, your information… about another way…

Dc1sc0 2020-06-02 17:54:29
Type blod
Cast
2020-06-02 20:42:33
can anyone me with this bug
2020-06-02 20:42:46
Route [admin.manage_roles] not defined. (View: E:tyddetasktechdesignresourcesviewslayoutsadmin.blade.php) (View: E:tyddetasktechdesignresourcesviewslayoutsadmin.blade.php)
prime 2020-06-02 21:05:07
2020-06-02 20:42:46
Route [admin.manage_roles] not defined. (View: E:tyddetasktechdesignresourcesviewslayoutsadmin.blade.php) (View: E:tyddetasktechdesignresourcesviewslayoutsadmin.blade.php)

i think you should register the admin.manage_roles route to the web.php … Route::get(‘admin/manage_roles’,’ YourController@manage_roles’);

2020-06-02 21:07:31
prime 2020-06-02 21:05:07
i think you should register the admin.manage_roles route to the web.php … Route::get(‘admin/manage_roles’,’ YourController@manage_roles’);

my controller is this
Route::group([‘middleware’ => [‘auth’]], function() {
Route::resource(‘admin.manage_roles’,’RoleController’);
Route::resource(‘admin.manage_users’,’UserController’);

});
is anthing wrong?

prime 2020-06-02 21:10:29
2020-06-02 21:07:31
my controller is this
Route::group([‘middleware’ => [‘auth’]], function() {
Route::resource(‘admin.manage_roles’,’RoleController’);
Route::resource(‘admin.manage_users’,’UserController’);

});
is anthing wrong?

in your controller there is class that deals with manage_roles..?

2020-06-02 21:12:45
prime 2020-06-02 21:10:29
in your controller there is class that deals with manage_roles..?

yes the classes are already the in that section group

DesolatorMagno 2020-06-02 21:14:33
2020-06-02 21:07:31
my controller is this
Route::group([‘middleware’ => [‘auth’]], function() {
Route::resource(‘admin.manage_roles’,’RoleController’);
Route::resource(‘admin.manage_users’,’UserController’);

});
is anthing wrong?

Just do a php artisan route: list and you will see what you are doing wrong.

prime 2020-06-02 21:15:33
i think you should try this RoleController@class_name_of_manage_roles
DesolatorMagno 2020-06-02 21:16:38
No, he is working with resource controllers, the code there is right, what is wrong is the name that he think they get.
devmansurov 2020-06-02 21:24:33
How does a user create in a class when there is no method for creating a user in an extending class?

Class
CreateUserByCredentialsTask.php

<?php

namespace AppContainersUserTasks;

use AppContainersUserDataRepositoriesUserRepository;
use AppContainersUserModelsUser;
use AppShipExceptionsCreateResourceFailedException;
use AppShipParentsTasksTask;
use Exception;
use IlluminateSupportFacadesHash;

class CreateUserByCredentialsTask extends Task
{

protected $repository;

public function __construct(UserRepository $repository)
{
$this->repository = $repository;
}

public function run(
bool $isClient = true,
string $email,
string $password,
string $name = null,
string $gender = null,
string $birth = null
): User {

try {
$user = $this->repository->create([
‘password’ => Hash::make($password),
’email’ => $email,
‘name’ => $name,
‘gender’ => $gender,
‘birth’ => $birth,
‘is_client’ => $isClient,
]);

} catch (Exception $e) {
throw (new CreateResourceFailedException())->debug($e);
}

return $user;
}
}

——————————————————

Class UserRepository.php

<?php

namespace AppContainersUserDataRepositories;

use AppShipParentsRepositoriesRepository;

class UserRepository extends Repository
{
protected $fieldSearchable = [
‘name’ => ‘like’,
‘id’ => ‘=’,
’email’ => ‘=’,
‘confirmed’ => ‘=’,
‘created_at’ => ‘like’,
];
}

Here is full source code on github:

https://github.com/apiato/apiato/blob/9.0/app/Containers/User/Tasks/CreateUserByCredentialsTask.php

apiato/apiatoGitHub
PHP Framework for building scalable API’s on top of Laravel 7 – apiato/apiato
DesolatorMagno 2020-06-02 21:27:25
devmansurov 2020-06-02 21:24:33
How does a user create in a class when there is no method for creating a user in an extending class?

Class
CreateUserByCredentialsTask.php

<?php

namespace AppContainersUserTasks;

use AppContainersUserDataRepositoriesUserRepository;
use AppContainersUserModelsUser;
use AppShipExceptionsCreateResourceFailedException;
use AppShipParentsTasksTask;
use Exception;
use IlluminateSupportFacadesHash;

class CreateUserByCredentialsTask extends Task
{

protected $repository;

public function __construct(UserRepository $repository)
{
$this->repository = $repository;
}

public function run(
bool $isClient = true,
string $email,
string $password,
string $name = null,
string $gender = null,
string $birth = null
): User {

try {
$user = $this->repository->create([
‘password’ => Hash::make($password),
’email’ => $email,
‘name’ => $name,
‘gender’ => $gender,
‘birth’ => $birth,
‘is_client’ => $isClient,
]);

} catch (Exception $e) {
throw (new CreateResourceFailedException())->debug($e);
}

return $user;
}
}

——————————————————

Class UserRepository.php

<?php

namespace AppContainersUserDataRepositories;

use AppShipParentsRepositoriesRepository;

class UserRepository extends Repository
{
protected $fieldSearchable = [
‘name’ => ‘like’,
‘id’ => ‘=’,
’email’ => ‘=’,
‘confirmed’ => ‘=’,
‘created_at’ => ‘like’,
];
}

Here is full source code on github:

https://github.com/apiato/apiato/blob/9.0/app/Containers/User/Tasks/CreateUserByCredentialsTask.php

You still have the class repository, where is usually where are put method as create, search, delete, etc.

devmansurov 2020-06-02 21:31:18
DesolatorMagno 2020-06-02 21:27:25
You still have the class repository, where is usually where are put method as create, search, delete, etc.

I can’t found repository class with methods: create, delete… In my case class UserRepository is empty without any methods.

devmansurov 2020-06-02 21:32:01
DesolatorMagno 2020-06-02 21:27:25
You still have the class repository, where is usually where are put method as create, search, delete, etc.

You can see here full code

https://github.com/apiato/apiato/blob/9.0/app/Containers/User/Tasks/CreateUserByCredentialsTask.php

apiato/apiatoGitHub
PHP Framework for building scalable API’s on top of Laravel 7 – apiato/apiato
DesolatorMagno 2020-06-02 21:32:10
Yes, the class implementation should be almost empty.
devmansurov 2020-06-02 21:32:57
DesolatorMagno 2020-06-02 21:32:10
Yes, the class implementation should be almost empty.

Then where defined create method in my case?

DesolatorMagno 2020-06-02 21:33:17
Repository..
devmansurov 2020-06-02 21:35:40
DesolatorMagno 2020-06-02 21:33:17
Repository..

Here UserRepository class but in this class not defined create method and no other UserRepository class except this

https://github.com/apiato/apiato/blob/9.0/app/Containers/User/Data/Repositories/UserRepository.php

apiato/apiatoGitHub
PHP Framework for building scalable API’s on top of Laravel 7 – apiato/apiato
DesolatorMagno 2020-06-02 21:37:43
Dude, plz, read again, I never say UserRepository is “Respository” the class that is being extended.
DesolatorMagno 2020-06-02 21:38:16
It would be stupid to make create, search, get, getall, etc. Inside UserRepository.
natghi2010 2020-06-02 22:21:15
Is there a way to write a 3 way ternary operator?
natghi2010 2020-06-02 22:22:10
other than this
$province = 7;
$Myprovince = (
($province == 6) ? “city-1” :
(($province == 7) ? “city-2” :
(($province == 8) ? “city-3” :
(($province == 30) ? “city-4” : “out of borders”)))
);
DesolatorMagno 2020-06-02 22:22:29
Just use a switch.
natghi2010 2020-06-02 22:22:40
on blade?
DesolatorMagno 2020-06-02 22:23:07
laravel_discuss-39815.jpg

natghi2010 2020-06-02 22:23:37
DesolatorMagno 2020-06-02 22:23:07

okay thank you

|