コード例 #1
0
ファイル: UserController.php プロジェクト: namcoder/Topshare
 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')) {
         $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');
 }
コード例 #3
0
ファイル: routes.php プロジェクト: erayaydin/erayaydin-old
<?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"]);
});
コード例 #4
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';
 }