Closed mjquimbita closed 2 years ago
Hi @mjquimbita, could you put your source code to this PR comments? Tq :pray:
Hi @MufidJamaluddin, How can I use custom-created Libraries? I just create a simple test class in libraries folder but i cant access. Example: <?php
namespace App\Libraries;
class OciInteration { public function Test() {
return 'Test';
}
public function upload_file_oracle($bucket_name, $folder_name, $file_name)
{
echo "HI";
exit;
}
} // how can I use this in my modules controller? in my controller, I added this library but its showing error use App\Libraries\OciInteration; In my controller, I created the instance of this class but it shows an error.
Class 'App\Libraries\OciInteration' not found
Can you please help me out.
Hi @vimsmak, you could use PSR-4 standard. Simply, import from your libraries folder.. :pray:
Example:
<?php namespace App\Modules\Admin\Controllers;
use App\Libraries\YourLibraryClass;
Reference:
Yes, I am doing the same as your answer still I am getting the error "class not found". if I place my custom library class in the vendor folder then its works. but if I place it in the app\libraries folder then it's showing an error.
Hi @vimsmak, you could use PSR-4 standard. Simply, import from your libraries folder.. 🙏
Example:
<?php namespace App\Modules\Admin\Controllers; use use App\Libraries\YourLibraryClass;
Reference:
- Standard PSR-4 (https://www.php-fig.org/psr/psr-4/)
coba sendiri deh pak. kayaknya ada erorr jg.
Hi @mdestafadilah , Hi @vimsmak , please add namespace
in your library for use
import. :pray:
On my machine, the Library worked.
Yes, I am doing the same as your answer still I am getting the error "class not found". if I place my custom library class in the vendor folder then its works. but if I place it in the app\libraries folder then it's showing an error.
First, please add namespace App\Libraries;
in top of your library class.
Second, use use
keyword for import it. Example: use App\Libraries\YourLibraryClass;
Cc @vimsmak @mdestafadilah
🙏
very good i can try it
Hi @mjquimbita, @vimsmak, @mdestafadilah, and @ArnandoFajar, there're new release (v0.2.2) to simplify the module creation using php spark module
command.
Ty mas @MufidJamaluddin
Hi, i added a new module Login and modifit Routes.php to set default controller; then I added a new module Modulos from command line also update like the indications. But when I use http://localhost:8080/Modulos/index the result is 404 error like this Controller or its method is not found: \App\Modules\Login\Controllers\Modulos::index. I also use the function: return redirect()->to('/Modulos/index'); and is the same error. Whast can I do??? Thanks