PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, March 7, 2022

[FIXED] Class App not found error in (Laravel 5.4)

 March 07, 2022     laravel, laravel-5, php     No comments   

Issue

I want to insert the remark field into the database, but it seems that it doesn't work. So instead, I get the following error.

Class 'App\Job' not found

Jobs.php

class Job extends Model
{
    public function index()
    {
        return view('create-job');
    }

    public function user()
    {
        return  $this->belongsTo('App\User');
    }
}

JobController.php

class JobController extends Controller
{
    public function postCreateJob(Request $request)
    {
        // Validation
        $post = new Job();
        $post->remarks = $request['remarks'];

        $request->job()->save($post);

        return redirect()->route('home');
    }

    public function index()
    {
        return view('create-job');
    }
}

Solution

Your model name is Jobs.

Need to change the name of the model to Job

Hope this helps.



Answered By - John
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing