PHP code example of tur1 / laravelmodules

1. Go to this page and download the library: Download tur1/laravelmodules library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tur1 / laravelmodules example snippets



class User extends Model
{
    /**
     * Register filters for the User model.
     *
     * @return array
     */
    public static function filters()
    {
        return [
             StatusFilter::class,
        ];
    }
}

User::withFilters()->get();


class User extends Model
{

  protected $search = ['name', 'email', 'roles.name'];


   public function roles()
   {
        return $this->hasMany(Role::class);
   }

    /**
     * Register filters for the User model.
     *
     * @return array
     */
    public static function filters()
    {
        return [
             StatusFilter::class,
        ];
    }

}
bash
Modules/
├── Admins/
    ├── Controllers/
    │   └── AdminController.php
    ├── Database/
    │   ├── factories/
    │   │   └── AdminFactory.php
    │   ├── migrations/
    │   │   └── 2024_09_16_xxxxxxx_admins_table.php
    │   └── seeders/
    │       └── AdminSeeder.php 
    ├── Events/
    │   ├── AdminCreatedEvent.php
    │   ├── AdminDeletedEvent.php
    │   └── AdminUpdatedEvent.php
    ├── Exceptions/
    │   └── AdminException.php
    ├── Filters/
    │   ├── GenderFilter.php
    │   └── StatusFilter.php
    ├── Middleware/
    │   └── AdminMiddleware.php
    ├── Models/
    │   └── Admin.php
    ├── Observers/
    │   └── AdminObserver.php
    ├── Policies/
    │   └── AdminPolicy.php 
    ├── Requests/
    │   ├── StoreAdminRequest.php
    │   └── UpdateAdminRequest.php
    ├── Resources/
    │   ├── AdminListResource.php
    │   └── AdminShowResource.php
    ├── Routes/
    │   └── AdminRoutes.php
    ├── Services/
    │   └── AdminService.php
    └── Traits/
        ├── AdminAttributesTrait.php
        ├── AdminRelationshipsTrait.php
        └── AdminScopesTrait.php
bash
php artisan module:create Users
bash
php artisan page:create Dashboard