I can't figure out why am I getting this error.
Controller: SectionHeaderController
<?php
namespace SimpleCms\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
use Carbon\Carbon;
use App\Http\Requests;
use App\SectionHeader;
class SectionHeaderController extends Controller {
public function store(Request $request) {
$header = new SectionHeader();
$this->validate($request, [
'title' => 'required',
'image' => 'required|mimes:jpeg,png|max:1024|dimensions:max_width=300,max_height=100',
'heading' => 'required',
'description' => 'required'
]);
$header->title = $request->title;
$header->heading = $request->description;
$header->description = $request->description;
if($request->hasFile('image')) {
$file = Input::file('image');
$timestamp = str_replace([' ', ':'], '-', Carbon::now()->toDateTimeString());
$name = $timestamp. '-' .$file->getClientOriginalName();
$header->filePath = $name;
$file->move(public_path().'/images/', $name);
}
$header->save();
return $this->create()->with('success', 'Done!');
}
}
Model: SectionHeader
<?php
namespace SimpleCms;
use Illuminate\Database\Eloquent\Model;
class SectionHeader extends Model {
protected $table = 'sectionheader';
protected $fillable = [
'title',
'description',
'heading',
'image'
];
}
Routes:
Route::post('/home/store', 'SectionHeaderController@store' );
I don't know what is wrong nor how to fix this.
This error appears once I hit form submit which points to this SectionHeaderController@store
Any idea?
Thank you.
EDIT: I changed per suggestions and I get new error
FatalErrorException in SectionHeaderController.php line 34: Class 'App\SectionHeader' not found