%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/sljcon/app/Http/Controllers/
Upload File :
Create Path :
Current File : /var/www/html/sljcon/app/Http/Controllers/TestimonialController.php

<?php

namespace App\Http\Controllers;

use App\Models\Testimonial;
use Illuminate\Http\Request;

class TestimonialController extends Controller
{
    public function index()
    {
        $testimonials = Testimonial::query()
            ->where('isDeleted', false)
            ->paginate(10);
        return view('admin.testimonial.all', [
            'testimonials' => $testimonials
        ]);
    }

    public function draftOrPublish($id)
    {
        $testimonial = Testimonial::query()
            ->find($id);
        if($testimonial){
            $testimonial->isApproved = !$testimonial->isApproved;
            $testimonial->save();
            return redirect('/admin/testimonials');
        }else{
            return abort(404);
        }
    }

    public function delete($id){
        $testimonial = Testimonial::query()
            ->find($id);
        if($testimonial){
            $testimonial->isDeleted = true;
            $testimonial->save();
            return redirect('/admin/testimonials');
        }else{
            return abort(404);
        }
    }
}

Zerion Mini Shell 1.0