本文整理匯總了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);
}
}