Atomic Model

⚛️ Atomic Model is the main curd for the models .

🔥 Atomic Model has some methods that`s move the panel those methods are.

AtomicFields()

🔥 This method to register fields to model curd.

<?php

namespace App;

use Illuminate\Foundation\Auth\User as Authenticatable;
use MustafaKhaled\AtomicPanel\AtomicModel;
use MustafaKhaled\AtomicPanel\Fields\Email;
use MustafaKhaled\AtomicPanel\Fields\ID;
use MustafaKhaled\AtomicPanel\Fields\Password;
use MustafaKhaled\AtomicPanel\Fields\Text;

class User extends Authenticatable
{
    use AtomicModel;
    public static function AtomicFields()
    {
        return [
            ID::make('id', 'id'),
            Text::make('name', 'name'),
            Email::make('email', 'email'),
            Password::make('password', 'password')
        ];
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

AtomicWidgets()

🔥 This method to register widgets to model index.

public static function AtomicWidgets()
{
    return [
    new WidgetClass()
    ];
}

1
2
3
4
5
6
7

AtomicActions()

🔥 This method to register Actions to model index.

public static function AtomicActions()
{
    return [
    new ActionClass()
    ];
}

1
2
3
4
5
6
7

AtomicIndexContentView()

if you want custom index view for the model , here you go :

/**
* set other view for index view for this model
* @return string
*/
public static function AtomicIndexContentView()
{
   return 'custom_view';
}
1
2
3
4
5
6
7
8

it will have reference of model class

@section('content')

<h3>Custom View Page For Model <strong>{{$AtomicModel::label()}} with count ({{$AtomicModel::count()}})</strong></h3>

@endsection
1
2
3
4
5

AtomicDetailsContentView()

if you want custom details view for the model , here you go :

/**
* set other view for index view for this model
* @return string
*/
public static function AtomicDetailsContentView()
{
   return 'custom_details';
}
1
2
3
4
5
6
7
8

it will have reference of model class

@section('content')

<h3>Custom View Page For Model <strong>{{$AtomicModel::label()}} with count ({{$AtomicModel::count()}})</strong></h3>
<h2>Model ID : {{$model->id}}</h2>

@endsection
1
2
3
4
5
6

AtomicDisplayInNavigation()

Show / hide model from navigation its true by default you can set it false to hide menu:


public static function AtomicDisplayInNavigation()
{
    return false;
}
1
2
3
4
5

getAtomicClass()

return the icon class for navigation menu

/**
 * Navigation Icon Class
 * @return string
 */
public static function getAtomicClass()
{
    return 'fa fa-user';
}

1
2
3
4
5
6
7
8
9

label()

return the plural label title for model

/*
 * get model label name
 * @return string
 */
public static function label()
{
    return 'Users Model';
}
1
2
3
4
5
6
7
8

singularLabel()

return the singular label title for model

/*
 * get model label name
 * @return string
 */
public static function singularLabel()
{
    return 'User  Model';
}
1
2
3
4
5
6
7
8