I have made a custom class, which is a Facade. Here is the class:
<?php namespace MT\Library;
class Posting
{
function Draft($inputs)
{
return ($this->create($inputs, 0)) ? true : false;
}
private function create ($inputs, $type)
{
$post = new Illuminate\Database\Post();
$post->title = $inputs["title"];
return ($post->save()) ? true : false;
}
}
Posting() is the name of my custom class.
Post()
is the name of my Laravel Eloquent Model. When I use the class Postin::Draft() it throws an error that cannot find the model new Illuminate\Database\Post();
How should I use my model in my custom library? Since my library uses a namespace I cannot simply do Post() for model, as it throws an error telling cannot find Post()