本文整理汇总了PHP中app\Course::stripes方法的典型用法代码示例。如果您正苦于以下问题:PHP Course::stripes方法的具体用法?PHP Course::stripes怎么用?PHP Course::stripes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Course
的用法示例。
在下文中一共展示了Course::stripes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateRandomString
do {
$rnd = generateRandomString(5);
} while (Course::where('u_identifier', '=', $rnd)->first() != NULL);
$course->u_identifier = $rnd;
$course->name = $course_installer->name;
$course->description = $course_installer->description;
$course->maxStudentsPerStripe = $course_installer->maxStudentsPerStripe;
$course->single_stripe = $course_installer->single_stripe;
$course->referents = $course_installer->referents;
$course->save();
for ($c = 0; $c < 9; $c++) {
if (intval($course_installer->{itoa($c + 1)}) != 0) {
$stripe = new Stripe();
$stripe->stripe_number = $c + 1;
$stripe->stripe_call = $course_installer->{itoa($c + 1)};
$course->stripes()->save($stripe);
}
}
}
return redirect(route("admin"))->withSuccess("Corsi importati con successo.");
}]);
// ------
// Authentication routes
Route::get('/', ['as' => 'auth.getLogin', 'uses' => 'Auth\\AuthController@getLogin']);
Route::post('auth/login', ['as' => 'auth.postLogin', 'uses' => 'Auth\\AuthController@postLogin']);
Route::get('auth/logout', ['as' => 'auth.logout', 'uses' => 'Auth\\AuthController@getLogout']);
// Registration routes
Route::get('auth/register', ['as' => 'auth.getRegister', 'uses' => 'Auth\\AuthController@getRegister']);
Route::post('auth/register', 'Auth\\AuthController@postRegister');
// SIGNUP - QUIT
Route::post('/courses/{course_id}/signup/', function ($course_id) {
示例2: quitStripes
public function quitStripes(Course $course, $stripe_numbers)
{
foreach ($stripe_numbers as $stripe_number) {
$this->stripes()->detach($course->stripes()->where('stripe_number', '=', $stripe_number)->first()->id);
}
}