Getting Started
Admin Panel
Search for a command to run...
This guide shows you how to add new features and extend existing functionality in Deeplancer.
// app/Livewire/Admin/CustomFeature/CustomFeatureComponent.php
namespace App\Livewire\Admin\CustomFeature;
use Livewire\Component;
use Livewire\Attributes\Layout;
use Artesaos\SEOTools\Facades\SEOMeta;
#[Layout('components.layouts.admin')]
class CustomFeatureComponent extends Component
{
public function mount(): void
{
if (!auth()->user()->can('custom_feature.view')) {
abort(403);
}
}
public function render()
{
SEOMeta::setTitle(seo_title(__('admin.custom_feature_title')));
return view('livewire.admin.custom-feature.custom-feature');
}
}{{-- resources/views/livewire/admin/custom-feature/custom-feature.blade.php --}}
<div>
<x-deep.heading>
{{ __('admin.custom_feature_title') }}
</x-deep.heading>
{{-- Your content --}}
</div>// routes/admin.php
Route::get('custom-feature', CustomFeatureComponent::class)
->name('admin.custom-feature.index');// database/seeders/PermissionSeeder.php
Permission::create(['name' => 'custom_feature.view']);// app/Models/CustomModel.php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class CustomModel extends Model
{
protected $fillable = [
'name',
'description',
];
}// database/migrations/xxxx_create_custom_models_table.php
Schema::create('custom_models', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->text('description')->nullable();
$table->timestamps();
});// app/Http/Controllers/Api/CustomController.php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class CustomController extends Controller
{
public function index()
{
// Your logic
}
}// routes/api.php
Route::get('/custom', [CustomController::class, 'index']);// app/Services/CustomService.php
namespace App\Services;
class CustomService
{
public function processData($data)
{
// Your business logic
}
}// In components
use App\Services\CustomService;
$service = new CustomService();
$result = $service->processData($data);// app/Http/Middleware/CustomMiddleware.php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
class CustomMiddleware
{
public function handle(Request $request, Closure $next)
{
// Your logic
return $next($request);
}
}// bootstrap/app.php
$middleware->alias([
'custom' => \App\Http\Middleware\CustomMiddleware::class,
]);// Extend existing component
class ExtendedGigsComponent extends GigsComponent
{
public function customMethod()
{
// Your custom logic
}
}// In component class
public $customProperty = '';
public function updatedCustomProperty()
{
// Handle property update
}// In model
public function customRelation()
{
return $this->hasMany(CustomModel::class);
}// In component
$items = Model::with('customRelation')->get();// app/Events/CustomEvent.php
namespace App\Events;
use Illuminate\Foundation\Events\Dispatchable;
class CustomEvent
{
use Dispatchable;
public function __construct(public $data)
{
}
}// In component or service
event(new CustomEvent($data));// app/Notifications/CustomNotification.php
namespace App\Notifications;
use Illuminate\Notifications\Notification;
class CustomNotification extends Notification
{
public function via($notifiable)
{
return ['mail', 'database'];
}
public function toMail($notifiable)
{
// Email content
}
}$user->notify(new CustomNotification());// In model
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
public function registerMediaCollections(): void
{
$this->addMediaCollection('custom')
->singleFile();
}// In component
if ($file instanceof TemporaryUploadedFile) {
$model->addMedia($file->getRealPath())
->toMediaCollection('custom');
}Test Checklist:
CRUD Operations:
Form Handling:
Search & Filter: