I want to call controller into my route while making custom module. I am having my custom module into the App folder, my module folder such as App/Modules/OEM/
my routes.php (into App/Modules/OEM/routes.php)
Route::group(['prefix' => '', 'namespace' => 'App\Modules\OEM\Controllers'], function () {
Route::get('/welcome', 'OemControllers@welcome');
});
my Controller file: (App/Modules/OEM/Controller/OemControllers.php)
<?php namespace App\Modules\OEM\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Modules\OEM\Models\OemModel;
class OemControllers extends Controller{
public function __construct (OemModel $OemModel)
{
$this->middleware('auth');
$this->OemModel = $OemModel;
}
public function welcome(){
return view('OEM::welcome');
}
}
My Model file: (App/Modules/OEM/Models/OemModel.php)
<?php
namespace App\Modules\OEM\Models;
use Illuminate\Database\Eloquent\Model;
class OemModel extends Model{
public static function get_url_list() {
return "this is model of OEM";
}
}
My problem is when I am hitting the URL localhost:8000/welcome, then it will re-direct to home, so unable to call the controller from my routes, and also unable to call model into controller.