本文整理汇总了PHP中flash函数的典型用法代码示例。如果您正苦于以下问题:PHP flash函数的具体用法?PHP flash怎么用?PHP flash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了flash函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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');
}
示例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();
}
示例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]);
}
示例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');
}
示例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();
}
示例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();
}
示例7: modify
private function modify($user, $message)
{
$user->requested_new_role = false;
$user->save();
flash()->success($user->name . " " . $message);
return redirect()->route('role.index');
}
示例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();
}
示例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');
}
示例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;
}
示例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]);
}
示例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!');
}
示例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();
}
示例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');
}
示例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'));
}