@ninjajoe why you wanna create two classes in one file? why not two files?
Jul 7, 2020
4
Level 1
Laravel: One File with Two Classes?
In Laravel, is it possible to have one file with two custom classes? E.g.:
In app/Portal.php, I have two custom classes, Portal and PaymentLogs:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Portal
{
public static function state($abbreviation)
{
// ...
}
}
class PaymentLogs extends Model
{
// ...
}
Is that possible?
If yes, how can I call each class from another file, like a view or controller? I'm looking for something like:
\App\Portal::PaymentLogs::create();
How can I call the PaymentLogs class in from app/Http/Controllers/PortalController.php and the state() method from the Portal class?
Please or to participate in this conversation.