PHP code example of mustafakhaleddev / laravel-atomic
1. Go to this page and download the library: Download mustafakhaleddev/laravel-atomic 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/ */
mustafakhaleddev / laravel-atomic example snippets
/**
* Register the Atomic gate.
*
* This gate determines who can access Atomic in non-local environments.
*
* @return void
*/
protected function gate()
{
Gate::define('viewAtomic', function ($user) {
return in_array($user->email, [
'[email protected]'
]);
});
}
namespace App;
use Illuminate\Database\Eloquent\Model;
use MustafaKhaled\AtomicPanel\AtomicModel;
class MyModel extends Model
{
use AtomicModel;
}
namespace App;
use Illuminate\Database\Eloquent\Model;
use MustafaKhaled\AtomicPanel\AtomicModel;
class MyModel extends Model
{
use AtomicModel;
public static function AtomicFields()
{
return [];
}
}
namespace App;
use Illuminate\Database\Eloquent\Model;
use MustafaKhaled\AtomicPanel\AtomicModel;
use MustafaKhaled\AtomicPanel\Fields\ID;
use MustafaKhaled\AtomicPanel\Fields\Text;
use MustafaKhaled\AtomicPanel\Fields\Trix;
class MyModel extends Model
{
use AtomicModel;
public static function AtomicFields()
{
return [
ID::make('id', 'id'),
Text::make('Title', 'title'),
Trix::make('Content', 'content'),
];
}
}