appslabke/reviewable

This is package help you add reviews to any model and/or make any model a reviewer

v0.0.6 2020-03-23 15:14 UTC

This package is auto-updated.

Last update: 2024-12-12 17:39:41 UTC


README

Installation

$user = app('App\User')->find(1);

    $hotel = app('App\Models\Hotel')->create([
        'name' => 'demo guy',
        'slogan' => 'this is it',
        'email' => 'marv@d'.time().'d.com',
        'phone_no' => '0704407117',
        'street' => 'langata',
        'photo' => '/dejje',
        'slug' => 'dmeo-dmeo',
        'user_id' => $user->id,
        'activated' => true
    ]);

    $result = $review->fill(array_merge([
        'title' => 'demo',
        'review' => 'demo fuck review demo guy this it demro marvin',
        'approved' => 1,
        'hotel_id' => 1,
        'rating' => 7,
    ],[
        'reviewer_id' => $user->id,
        'reviewer_type' => get_class($user)
    ]));

    $hotel->reviews()->save($result);