in web.php I have this routes:
$this->namespace('Users')->prefix('users')->group(function (){
$this->get('/create' , 'UserController@create');
});
this Route opens a form.
And
theis Route use for return arrays of countires. I use that array to fill a select box via ajax in the form.
Route::namespace('API')->prefix('api')->group(function (){
$this->get('/get-country-list','LocationsController@index');
});
Controller:
app\Http\Controllers\API\LocationsController
class LocationsController extends Controller
{
public function index()
{
return DB::table('countries')->pluck("name","id")->all();
}
.
.
.
app\Http\Controllers\Users\UserController
class UserController extends Controller
{
public function create()
{
return view('panel.users.home.create.show');
}
.
.
.
How can I call LocationsController@index in create() function? what is the best method?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire