本文整理汇总了PHP中flash函数的典型用法代码示例。如果您正苦于以下问题:PHP flash函数的具体用法?PHP flash怎么用?PHP flash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了flash函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: destroy
/**
* Remove the specified resource from storage.
*
* @param string $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$social_media = $this->social_medias->find($id);
$social_media->delete();
flash()->info('Deleted', 'Social Media has been deleted');
return redirect()->route('admin.social_media.index');
}
开发者ID:CbCaio,项目名称:pwebdev,代码行数:13,代码来源:SocialMediaController.php
示例2: update
/**
* Update the specified resource in storage.
*
* @param UserRequest $request
* @param User $user
* @return Response
*/
public function update(UserRequest $request, User $user)
{
$user->update($request->all());
$user->uploadAndSave();
flash()->success("User has been successfully updated!");
return redirect()->back()->withInput();
}
开发者ID:vazmer,项目名称:mudrosti-laravel,代码行数:14,代码来源:UserController.php
示例3: destroy
/**
* Removes the specified user from the specified role.
*
* @param int|string $roleId
* @param int|string $userId
*
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy($roleId, $userId)
{
$this->authorize('admin.roles.users.destroy');
$role = $this->role->findOrFail($roleId);
$user = $role->users()->findOrFail($userId);
// Retrieve the administrators name.
$adminName = Role::getAdministratorName();
// Retrieve all administrators.
$administrators = $this->user->whereHas('roles', function ($query) use($adminName) {
$query->whereName($adminName);
})->get();
$admin = Role::whereName($adminName)->first();
// We need to verify that if the user is trying to remove all roles on themselves,
// and they are the only administrator, that we throw an exception notifying them
// that they can't do that. Though we want to allow the user to remove the
// administrator role if more than one administrator exists.
if ($user->hasRole($admin) && $user->id === auth()->user()->id && count($administrators) === 1) {
flash()->setTimer(null)->error('Error!', "Unable to remove the administrator role from this user. You're the only administrator.");
return redirect()->route('admin.roles.show', [$roleId]);
}
if ($role->users()->detach($user)) {
flash()->success('Success!', 'Successfully removed user.');
return redirect()->route('admin.roles.show', [$roleId]);
}
flash()->error('Error!', 'There was an issue removing this user. Please try again.');
return redirect()->route('admin.roles.show', [$roleId]);
}
开发者ID:stevebauman,项目名称:ithub,代码行数:35,代码来源:RoleUserController.php
示例4: destroy
public function destroy(ConsumablesMinimumLevel $consumables_minimum_levels)
{
$this->authorize('edit_consumable_minimum_levels');
$consumables_minimum_levels->delete();
flash()->success('Consumables Minimum Level Deleted', 'The consumables minimum level has been removed');
return redirect()->action('ConsumablesMinimumLevelsController@index');
}
开发者ID:buys-fran,项目名称:mtech-mis,代码行数:7,代码来源:ConsumablesMinimumLevelsController.php
示例5: destroy
public function destroy($id)
{
$user = $this->model->findOrFail($id);
$this->userRepository->deleteUser($user);
flash()->success(trans('LaravelAdmin::laravel-admin.userDeleted'));
return Redirect::back();
}
开发者ID:shinichi81,项目名称:laravel-admin,代码行数:7,代码来源:UsersController.php
示例6: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$project = Project::findOrFail($id);
$project->delete();
flash('Your Project Was Deleted Successfully');
return redirect()->back();
}
开发者ID:agoiabel,项目名称:ocupidconcept,代码行数:13,代码来源:UploadRecentProjectController.php
示例7: modify
private function modify($user, $message)
{
$user->requested_new_role = false;
$user->save();
flash()->success($user->name . " " . $message);
return redirect()->route('role.index');
}
开发者ID:AUCSC,项目名称:sac,代码行数:7,代码来源:RolesController.php
示例8: putAll
/**
* Handle permissions change
*
* @param Request $request
* @return \Illuminate\Http\RedirectResponse
*/
public function putAll(Request $request)
{
$permissions = Permission::all();
$input = array_keys($request->input('permissions'));
try {
DB::beginTransaction();
$permissions->each(function ($permission) use($input) {
if (in_array($permission->id, $input)) {
$permission->allow = true;
} else {
$permission->allow = false;
}
$permission->save();
});
DB::commit();
flash()->success(trans('permissions.save_success'));
} catch (\Exception $e) {
var_dump($e->getMessage());
die;
flash()->error(trans('permissions.save_error'));
}
try {
Cache::tags(['permissions'])->flush();
} catch (\Exception $e) {
Cache::flush();
}
return redirect()->back();
}
开发者ID:Denniskevin,项目名称:Laravel5Starter,代码行数:34,代码来源:AdminPermissionsController.php
示例9: store
/**
* @param Requests\CreateArticleRequest $request
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function store(ArticleRequest $request)
{
//validation
$this->createArticle($request);
flash("Your post has been successful")->important();
return redirect('articles');
}
开发者ID:thinusn,项目名称:lblg,代码行数:11,代码来源:ArticlesController.php
示例10: actionReturn
function actionReturn($code)
{
$url = "https://github.com/login/oauth/access_token?client_id=" . $this->app_key . "&redirect_uri=" . urlencode($this->url) . "&client_secret=" . $this->app_secret . "&code=" . $_GET['code'] . "";
$content = file_get_contents($url);
$s = $content;
$s = explode('&', $s);
$d = explode('=', $s[0]);
$access_token = $d[1];
if ($access_token) {
try {
$this->auth = OAuth2::provider($this->type, array('id' => $this->app_key, 'secret' => $this->app_secret));
$token = Token::factory('access', array('access_token' => $access_token));
$info = $this->auth->get_user_info($token);
$uid = $info['uid'];
$me['id'] = $uid;
$me['name'] = $info['name'];
$me['email'] = $info['emial'];
$r = $this->member_get_third_set_user($me, $this->oauth_id, $access_token);
flash('success', __('login success'));
$this->redirect(return_url());
} catch (OAuthException $e) {
flash('error', __('login error'));
$this->redirect(return_url());
}
}
exit;
}
开发者ID:rocketyang,项目名称:mincms,代码行数:27,代码来源:GithubController.php
示例11: update
/**
* Update the business service types.
*
* @param Business $business
* @param Request $request
*
* @return Response
*/
public function update(Business $business, Request $request)
{
logger()->info(__METHOD__);
logger()->info(sprintf('businessId:%s', $business->id));
$this->authorize('manageServices', $business);
// BEGIN
$servicetypeSheet = $request->input('servicetypes');
$regex = '/(?P<name>[a-zA-Z\\d\\-\\ ]+)\\:(?P<description>[a-zA-Z\\d\\ ]+)/im';
preg_match_all($regex, $servicetypeSheet, $matches, PREG_SET_ORDER);
$publishing = collect($matches)->map(function ($item) {
$data = array_only($item, ['name', 'description']);
$data['slug'] = str_slug($data['name']);
return $data;
});
foreach ($business->servicetypes as $servicetype) {
if (!$this->isPublished($servicetype, $publishing)) {
$servicetype->delete();
}
}
foreach ($publishing as $servicetypeData) {
$servicetype = ServiceType::firstOrNew($servicetypeData);
$business->servicetypes()->save($servicetype);
}
flash()->success(trans('servicetype.msg.update.success'));
return redirect()->route('manager.business.service.index', [$business]);
}
开发者ID:josevh,项目名称:timegrid,代码行数:34,代码来源:ServiceTypeController.php
示例12: deletePreset
public function deletePreset(Request $request)
{
$id = $request->id;
$preset = RecordPreset::where('id', '=', $id)->first();
$preset->delete();
flash()->overlay('Record has been removed as a preset.', 'Success!');
}
开发者ID:roehlerw,项目名称:Kora3,代码行数:7,代码来源:RecordPresetController.php
示例13: permissionsDelete
public function permissionsDelete($id, $permission)
{
$role = $this->model->findOrFail($id);
$role->perms()->detach($permission);
flash()->success(trans('LaravelAdmin::laravel-admin.permissionsDetachedSuccess'));
return Redirect::back();
}
开发者ID:shinichi81,项目名称:laravel-admin,代码行数:7,代码来源:RolesController.php
示例14: update
public function update($id, Requests\BrandRequest $request)
{
$brand = Brand::findOrFail($id);
$brand->update(['name' => $request->get('name'), 'code' => $request->get('code')]);
flash()->success('Brand has been updated.');
return redirect('brands');
}
开发者ID:zekaroz,项目名称:Opel,代码行数:7,代码来源:BrandsController.php
示例15: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(ModuleRequest $request, $id)
{
$module = Module::findOrFail($id);
$module->update($request->all());
flash()->success(trans('all.module_edited'));
return redirect(action('Admin\\ModulesController@index'));
}
开发者ID:Vatia13,项目名称:gbtimes,代码行数:14,代码来源:ModulesController.php
示例16: store
/**
* Store a newly created resource in storage.
*
* @param FlyerRequest $request
* @return Response
*/
public function store(FlyerRequest $request)
{
$flyer = $this->user->publish(new Flyer($request->all()));
flash()->success('Success', 'Your flyer has been created!');
return redirect(flyer_path($flyer));
//temporary
}
开发者ID:emptyWang,项目名称:flyer,代码行数:13,代码来源:FlyersController.php
示例17: updateEdition
public function updateEdition(Request $request, $bookId, $editionId)
{
$edition = Edition::findOrFail($editionId);
$edition->update($request->all());
flash()->success('Updated', 'Edition has been updated');
return redirect("/admin/books/{$bookId}/editions");
}
开发者ID:binalfew,项目名称:FlairBooks,代码行数:7,代码来源:EditionsController.php
示例18: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$comment = Comment::findOrFail($id);
$comment->delete();
flash()->success('Success', "Comment deleted successfully");
return redirect()->back();
}
开发者ID:SlipperyPenguine,项目名称:tracker,代码行数:13,代码来源:CommentController.php
示例19: postReceive
public function postReceive()
{
$code = Input::get('code');
if ($code) {
$coupon = AdminCoupon::where(['coupon_code' => $code])->first();
if ($coupon) {
$data = [];
$data['coupon_id'] = $coupon->id;
$data['user_id'] = Session::get('uid');
$data['is_used'] = 0;
$isCoupon = PhoneUserToCoupon::where($data)->first();
if ($isCoupon) {
flash('亲,您已经领取过这个红包啦~');
return redirect()->back();
}
$couponToUser = new PhoneUserToCoupon();
$couponToUser->coupon_id = $coupon->id;
$couponToUser->user_id = Session::get('uid');
if ($couponToUser->save()) {
$coupon->used += 1;
$coupon->save();
return redirect("coupon/success/{$coupon->coupon_price}");
} else {
flash('亲~现在服务器压力山大~请稍后再试');
return redirect()->back();
}
} else {
flash('亲~兑换码不对呦~请重试');
return redirect()->back();
}
} else {
flash('亲~兑换码不能为空哦~请重试');
return redirect()->back();
}
}
开发者ID:pinse98,项目名称:mitao,代码行数:35,代码来源:CouponController.php
示例20: create
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return User
*/
protected function create(array $data)
{
$user = User::create(['first_name' => $data['first_name'], 'second_name' => $data['second_name'], 'email' => $data['email'], 'verify_token' => str_random(60), 'password' => bcrypt($data['password'])]);
flash()->success('success', 'You are now logged in');
$user->roles()->attach(1);
return $user;
}
开发者ID:karlos545,项目名称:takeaway,代码行数:13,代码来源:AuthController.php
注:本文中的flash函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论