public function destroy($id)
 {
     $category = $this->categoriesRepo->findOrFail($id);
     $this->categoriesRepo->delete($category);
     \Alert::message("CMS::categories.msg_category_deleted");
     return redirect()->route('CMS::admin.categories.index');
 }
 function test_render_new_messages()
 {
     // Having
     Alert::message('This is a message', 'info');
     // Expect
     $this->assertTemplate('alerts/alert', Alert::render());
 }
Example #3
0
 public function postPassword(Request $request)
 {
     $user = $request->user();
     if (!Hash::check($request->get('current_password'), $user->password)) {
         return redirect()->back()->withErrors(['current_password' => 'La contrasena actual no es valida']);
     }
     $this->validate($request, ['password' => 'required|confirmed', 'password_confirmation' => 'required']);
     $user->password = bcrypt($request->get('password'));
     $user->save();
     \Alert::message('Su contrasena fue cambiada', 'success');
     return redirect('escritorio');
     // ->with('alert', 'Su contrasena fue cambiada');
 }
 public function toggleStatus($id)
 {
     $article = $this->articlesRepo->findOrFail($id);
     $data = '';
     $message = null;
     if ($article->published_at == null) {
         $data['published_at'] = Carbon::now();
         $message = 'CMS::articles.msg_article_published';
     } else {
         $data['published_at'] = null;
         $message = 'CMS::articles.msg_article_unpublished';
     }
     $this->articlesRepo->update($article, $data);
     \Alert::message($message);
     return redirect()->route('CMS::admin.articles.edit', $article->id);
 }
 public function statusToggle($id)
 {
     $user = $this->usersRepo->findOrFail($id);
     if ($user->isBlocked()) {
         $user->blocked_at = null;
         \Alert::message("CMS::users.msg_user_unblocked");
     } else {
         if ($user->id == $this->current_user->id) {
             \Alert::message("CMS::users.msg_you_cant_block_yourself", "danger");
             return redirect()->back();
         }
         $user->blocked_at = Carbon::now();
         \Alert::message("CMS::users.msg_user_blocked");
     }
     $this->usersRepo->save($user);
     return redirect()->route('CMS::admin.users.edit', $user->id);
 }
Example #6
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Request $request
  * @param  int $id
  * @return Response
  */
 public function update($id, PostRequest $request)
 {
     $post = Post::find($id);
     $post->tags()->detach();
     $post->update($request->all());
     $post->tags()->attach($request->input('tags'));
     if ($request->hasFile('thumbnail_link')) {
         $file = $request->file('thumbnail_link');
         $ext = $file->getClientOriginalExtension();
         $fileName = $post->slug . '.' . $ext;
         $file->move('./assets/images/confs', $fileName);
         $post->thumbnail_link = $fileName;
         $post->save();
     }
     return redirect()->to('dashboard.dashboard')->with('message', Alert::message('conférence "' . $post->title . '"
     modifiée avec succès', 'info'));
 }