Making in laravel/framework 9.1 admin area with orchid/crud 3.8 and orchid/platform 13.6 custom notifications I have to add orchid AsSource trait for Illuminate\Notifications\DatabaseNotification class - that will give me possibility to use this class in orchid screens so I need to convert data App\Models\orchid\DatabaseNotification (I copied this class from Illuminate\Notifications\DatabaseNotification and added AsSource trait )
use App\Models\orchid\DatabaseNotification; // My custom class
//use Illuminate\Notifications\DatabaseNotification;
class CustomAdminNotificationsScreen extends Screen
{
public function query(Request $request): iterable
{
/** @var Paginator $notifications */
$notifications = $request->user()
->notifications()
->where('type', DashboardMessage::class)
->paginate(10);
/// This data have Illuminate\\Notifications\\DatabaseNotification class claas
$notifications->data
I got error :
has Undefined property: Illuminate\Pagination\LengthAwarePaginator::$data
Can I replace LengthAwarePaginator::$data manually ?
If there is a way how to fix it ?
Thanks!
Yes, you can remake the $request->user()->notifications()
you can just use its model when getting the data :
DatabaseNotification::query()
->where('notifiable_id', Auth()->id())
->where('type', DashboardMessage::class)
->paginate(10);
ps. I don't quite understand the second question but try answer I given first.