错误:
未定义操作App \ Http \ Controllers \ formController @ form。 (视图:C:\ xampp \ htdocs \ ucar3 \ resources \ views \ layouts \ Form.blade.php)(视图:C:\ xampp \ htdocs \ ucar3 \ resources \ views \ layouts \ Form.blade.php)>
我尝试更改web.php中的路由
web.php
str = """period
JAN16
YTD JAN16
2017"""
# sample dataframe
df = pd.read_csv(pd.io.common.StringIO(str))
months = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC']
years = [ '{}'.format(x) for x in range(2000, 2100)]
# condition for month
m = df.period.str[:3].isin(months)
# condition for annual
y = df.period.isin(years)
# if contains spaces, then do JAN16, YTD
n = df.period.str.contains('\s')
df['period_type'] = np.select([m, y, n], ['month', 'annual', df.period.str.split().str[::-1].str.join(', ')])
df
# period period_type
#0 JAN16 month
#1 YTD JAN16 JAN16, YTD
#2 2017 annual
控制器
Route::resource('Inscription','inscriController');
模型
class FormController extends Controller
{
public function show()
{
return view('pages.Inscription');
}
public function insert(Request $request)
{
$Cin = $request->input('Cin');
$nom = $request->input('nom');
$prenom = $request->input('prenom');
$email = $request->input('email');
$telephone = $request->input('telephone');
$specialite = $request->input('specialite');
$typedediplome = $request->input('typedediplome');
$mentiondiplome = $request->input('mentiondiplome');
$redoublement = $request->input('redoublement');
$communication = $request->input('communication');
$publication = $request->input('publication');
$experiencePedagogiqueSecondaire = $request
->input('experiencePedagogiqueSecondaire');
$experiencePedagogiqueSupérieur = $request
->input('experiencePedagogiqueSupérieur');
$data = array(['Cin'=>$Cin,
'nom'=>$nom,
'prenom'=>$prenom,
'email'=>$email,
'telephone'=>$telephone,
'specialite'=>$specialite,
'typedediplome'=>$typedediplome,
'mentiondiplome'=>$mentiondiplome,
'redoublement'=>$redoublement,
'communication'=>$communication,
'publication'=>$publication,
'experiencePedagogiqueSecondaire'=>$experiencePedagogiqueSecondaire,
'experiencePedagogiqueSupérieur'=>$experiencePedagogiqueSupérieur
]);
DB::table('users')->insert($data);
return view('pages.success');
}
}
答案 0 :(得分:1)
如错误所述
formController@form not defined.
但是在您的课程中您已经
FormController extends Controller
请检查您是否正在使用小写字母'F'调用FormController。
答案 1 :(得分:1)
我认为您的 inscriController 和路由有问题,请使用以下代码:
web.php
use App\Http\Controllers\inscriController;
Route::resource('Inscription', inscriController::class);
app/Http/Controllers.php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
class inscriController extends Controller {
public function __construct() {
$this->middleware('auth');
}
}
答案 2 :(得分:0)
检查是否在FormController.php中设置了正确的命名空间
您还缺少FormController中的函数表单。