예제 #1
0
 public function edit($id)
 {
     if (Request::isMethod('get')) {
         $roles = UserRole::orderBy('id', 'desc')->get();
         $info = User::find($id);
         $cats = BlogCategory::where('lang_code', $info->userblog->lang_code)->get();
         $langs = Language::all();
         return view('admin.users.edit', array('cats' => $cats, 'langs' => $langs, 'info' => $info, 'roles' => $roles));
     }
     // POST
     parse_str(Request::input('data'));
     $category_save = implode(',', $category);
     $u = User::find($id);
     $u->name = $name;
     $u->address = $address;
     $u->zipcode = $zipcode;
     $u->city = $city;
     $u->phone = $phone;
     $u->cpr = $cpr;
     $u->role = $role;
     $u->account_number = $account_number;
     if ($password != null || $password != '') {
         $u->password = Hash::make($password);
     }
     $u->save();
     $info_update = array('blogname' => $blogname, 'domain' => $blogurl, 'lang_code' => $lang_code, 'blog_categories' => $category_save);
     UserBlog::where('user_id', $id)->update($info_update);
 }
예제 #2
0
 public function edit($id)
 {
     if (Request::isMethod('get')) {
         $lang = Language::all();
         $info = BlogCategory::find($id);
         return view('admin.blogcategories.edit', array('lang' => $lang, 'info' => $info));
     }
     $data = Request::all();
     $c = BlogCategory::find($id);
     $c->name = $data['name'];
     $c->lang_code = $data['lang_code'];
     $c->save();
     return redirect('admin/blog-categories')->with('ok', 'Saved');
 }
예제 #3
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  Blog $blog
  * @return view
  */
 public function edit(Blog $blog)
 {
     $blogcategory = BlogCategory::lists('title', 'id');
     return view('admin.blog.edit', compact('blog', 'blogcategory'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function getDelete(BlogCategory $blogcategory)
 {
     $blogcategory->delete();
     return redirect('admin/blogcategory');
 }
예제 #5
0
 public function edit($id)
 {
     if (Request::isMethod('get')) {
         $customerAPI = json_decode($this->curlGet());
         $in = Assignment::find($id);
         $cats = BlogCategory::where('lang_code', $in->lang_code)->get();
         $langs = Language::all();
         return view('admin.assignment.edit', array('langs' => $langs, 'cats' => $cats, 'in' => $in, 'customerAPI' => $customerAPI));
     }
     /// POST
     $data = Request::all();
     $customer = $data['customer'];
     $release_date = $data['release_date'];
     $customerName = $data['customerName'];
     $max_blogger = $data['max_blogger'];
     $lang_code = $data['lang_code'];
     $keyword = $data['keyword'];
     $minimum_wordcount = $data['minimum_wordcount'];
     if (isset($data['img'])) {
         $img = $data['img'];
     } else {
         $img = null;
     }
     $categories = implode(',', $data['category']);
     if (isset($data['link'])) {
         $link = $data['link'];
     } else {
         $link = null;
     }
     if (isset($data['anchor_text'])) {
         $anchor_text = $data['anchor_text'];
     }
     if ($link) {
         foreach ($link as $key => $value) {
             $listUploadedImg_Link[$key]['img'] = $img[$key];
             $listUploadedImg_Link[$key]['link'] = $link[$key];
             $listUploadedImg_Link[$key]['anchor_text'] = $anchor_text[$key];
         }
         $imgLink_store = json_encode($listUploadedImg_Link);
     } else {
         $imgLink_store = null;
     }
     $a = Assignment::find($id);
     $a->customer_id = $customer;
     $a->customer_name = $customerName;
     $a->keyword = $keyword;
     $a->minimum_wordcount = $minimum_wordcount;
     $a->max_blogger = $max_blogger;
     $a->blog_categories = $categories;
     $a->lang_code = $lang_code;
     $a->img_link = $imgLink_store;
     $a->release_date = $release_date;
     $a->save();
     return redirect('admin/assignments')->with('ok', 'Edit Successful');
 }
예제 #6
0
<?php

Route::bind("blog", function ($value, $route) {
    return \App\Blog::where("slug", $value)->first();
});
Route::bind("blog_category", function ($value, $route) {
    return \App\BlogCategory::where("slug", $value)->first();
});
Route::get("/", ["as" => "home.index", "uses" => "HomeController@index"]);
Route::get("blog", ["as" => "blog.index", "uses" => "BlogController@index"]);
Route::get("blog/{blog}", ["as" => "blog.show", "uses" => "BlogController@show"]);
Route::get("blog/category/{blog_category}", ["as" => "blog.category.show", "uses" => "BlogCategoryController@show"]);
Route::group(["middleware" => ["guest"]], function () {
    Route::get("login", ["as" => "user.login", "uses" => "UserController@login"]);
    Route::post("login", ["as" => "user.login", "uses" => "UserController@doLogin"]);
});
Route::group(["middleware" => ["auth"], "namespace" => "Backend", "prefix" => config("app.backend")], function () {
    Route::get("blog", ["as" => "backend.blog.index", "uses" => "BlogController@index"]);
    Route::get("blog/create", ["as" => "backend.blog.create", "uses" => "BlogController@create"]);
    Route::post("blog", ["as" => "backend.blog.store", "uses" => "BlogController@store"]);
    Route::get("blog/{blog}/edit", ["as" => "backend.blog.edit", "uses" => "BlogController@edit"]);
    Route::put("blog/{blog}", ["as" => "backend.blog.update", "uses" => "BlogController@update"]);
    Route::get("blog/{blog}/delete", ["as" => "backend.blog.destroy", "uses" => "BlogController@destroy"]);
    Route::get("blog/category", ["as" => "backend.blog.category.index", "uses" => "BlogCategoryController@index"]);
    Route::get("blog/category/create", ["as" => "backend.blog.category.create", "uses" => "BlogCategoryController@create"]);
    Route::post("blog/category", ["as" => "backend.blog.category.store", "uses" => "BlogCategoryController@store"]);
    Route::get("blog/category/{blog_category}/edit", ["as" => "backend.blog.category.edit", "uses" => "BlogCategoryController@edit"]);
    Route::put("blog/category/{blog_category}", ["as" => "backend.blog.category.update", "uses" => "BlogCategoryController@update"]);
    Route::get("blog/category/{blog_category}/delete", ["as" => "backend.blog.category.destroy", "uses" => "BlogCategoryController@destroy"]);
    Route::get("logout", ["as" => "user.logout", "uses" => "UserController@logout"]);
});
예제 #7
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy(BlogCategory $blogcategory)
 {
     if ($blogcategory->delete()) {
         return redirect('admin/blogcategory')->with('success', trans('blogcategory/message.success.delete'));
     } else {
         return Redirect::route('admin/blogcategory')->withInput()->with('error', trans('blogcategory/message.error.delete'));
     }
 }
 public function destroy(BlogCategory $category)
 {
     $category->delete();
     return redirect()->route("backend.blog.category.index");
 }
 /**
  * Display the specified resource.
  *
  * @param  \App\BlogCategory  $category
  * @return \Illuminate\Http\Response
  */
 public function show(BlogCategory $category)
 {
     return view("blog.category.show", ["category" => $category, "blogs" => $category->blogs()->paginate(7)]);
 }
예제 #10
0
 public function index()
 {
     $users = User::count();
     $cats = BlogCategory::count();
     return view('admin.dashboard', array('num_users' => $users, 'cats' => $cats));
 }
예제 #11
0
 public function myprofile()
 {
     if (Request::isMethod('get')) {
         $langs = Language::all();
         $cats = BlogCategory::where('lang_code', Auth::user()->userblog->lang_code)->get();
         return view('frontend.profile.myprofile', array('cats' => $cats, 'langs' => $langs));
     }
     parse_str(Request::input('data'));
     $u = User::find(Auth::user()->id);
     $u->name = $name;
     if ($password != null || $password != '') {
         $u->password = Hash::make($password);
     }
     $u->address = $address;
     $u->city = $city;
     $u->zipcode = $zipcode;
     $u->phone = $phone;
     $u->cpr = $cpr;
     $u->save();
     echo 'done';
 }