HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ip-172-26-0-120 6.17.0-1009-aws #9~24.04.2-Ubuntu SMP Fri Mar 6 23:50:29 UTC 2026 x86_64
User: ubuntu (1000)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/www/html/owlcrm/app/first-project/app/Http/Controllers/PostController.php
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Models\Post;
class PostController extends Controller
{
       function operations() {
        return Post::all();
       }

       function mutators() {
       // return "hello its mutator function.";
      // return Post::all();
      $Post = new Post;
      $Post->name="isha";
      $Post->Description="from meerut";
      $Post->save();
       }



//form
    public function index()
    {
        $posts = DB::table('postss')->get();
        return view('Post.index',['data' => $posts]);
    }
//table
    public function create()
    {
        return view('Post.create');
    }
//data store
    public function store(request $req)
    {
        $req->validate([
            'Name' => 'required',
            'Description' => 'required'
        ]);
        $Post = DB::table('postss')
            ->insert([
                'name' => $req->Name,
                'Description' => $req->Description
            ]);
//redirect to create
        if ($Post) {
            return redirect()->route('Post.index')->with('message', "data inserted successfully...");
        } else {
            echo "<h1>error...</h1>";
        }
    }

}