I am developing an application with laravel 5.3
THE application changes the name App to MyApp with artisan
Everything works fine except when I went to use an eloquent model, for example User
composer.json
...
"psr-4": {
"Cprsync\": "app/",
"Abkrim\Rbackcp\": "vendor/abkrim/rbackcp/src/",
"Abkrim\Tools\": "vendor/abkrim/tools/src/"
}
...
app / Console / Commands / CpMyCommand.app
...
namespace Cprsync\Console\Commands;
// Some code
$cpanel = new Cpanel() // Llama a una Clase bajo namespace vendor/abkrim/rbackcp/src/;
$cpanel->setUserList;
...
vendor / abkrim / rbackcp / src / Cpanel.php
<?php
namespace Abkrim\Rbackcp;
use Illuminate\Support\Facades\App;
use Log;
use SSH;
use Cprsync\User; // De acuerdo a https://laravel.com/docs/5.3/eloquent#retrieving-models
...
private $users;
...
...
public function setUserList()
{
// Some code update private $users
$this->users = json_decode($this->getUserList(),true);
$this->updateUsers();
}
private function updateUSers()
{
$users_cpanel = $this->users;
$users = User:all(); // para coger todos los usuarios que existen en mi tabla de usuarios
// Aqui se produce el error.
}
Error
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Abkrim\Rbackcp\User' not found
If I return everything to the state of calling my app, in the original App (rerunning php app:name App
if it works.
What is my mistake?