예제 #1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id, User $users)
 {
     $item = Article::findOrFail($id);
     $users = $users->getUsers(['Author', '3rd party content provider', 'Administrator', 'Publisher', 'Frontpage editor', 'Super Admin'], 'name|asc');
     //$users = array_pluck($users,'id');
     $user_names = array();
     $i = 0;
     foreach ($users as $user) {
         foreach ($user->details as $u) {
             $user_names[$user->name] = $u->full_name;
         }
         $i++;
     }
     $users = array_name($user_names);
     $child = $item->categories()->select('cat_id')->first();
     $images = $item->images()->get();
     $image_gallery = [['img' => null, 'title' => null, 'alt' => null, 'source' => null, 'author' => null, 'meta_desc' => null, 'meta_key' => null]];
     if (count($images) > 0) {
         $image_gallery = add_image_array($images);
     }
     if (count(Session::get('_old_input')['image']) > 0) {
         $image_gallery = add_image_array(Session::get('_old_input')['image']);
     }
     $checked_cats = '';
     if (count(Session::get('_old_input')['cat']) > 0) {
         $checked_cats = join(',', Session::get('_old_input')['cat']);
     }
     $parent = Cat::select('parent')->where('id', $child->cat_id)->first()->parent;
     //$cats = $cats->select('id','name')->latest()->postextra(['parent'=>2,'id'=>[5,6,7]])->get();
     $catid = $child->cat_id;
     $extra_fields = get_fields($item->extra_fields);
     $json_extra = '';
     if (count($extra_fields) > 0 && !empty($extra_fields)) {
         $json_extra = json_encode($extra_fields);
     }
     if (count(Session::get('_old_input')['extra_fields']) > 0) {
         $extra_fields = Session::get('_old_input')['extra_fields'];
         $json_extra = json_encode($extra_fields);
     }
     $fields = hasFields([2], ['select' => ['col-sm' => 5], 'input' => ['col-sm' => 5], 'textarea' => ['col-sm' => 9]], $extra_fields);
     return view('admin.articles.edit', compact('item', 'users', 'fields', 'parent', 'catid', 'image_gallery', 'extra_fields', 'checked_cats', 'json_extra'));
 }
예제 #2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id, Cat $cats, User $users)
 {
     $movie = Article::where('id', $id)->ordercat([8])->get();
     $movie = $movie[0];
     $users = $users->latest('name')->orderrolein(['Author'])->get();
     $users = array_pluck($users, 'name');
     $users = array_name($users);
     $auth = Auth::user()->hasRole('Author') ? Auth::user()->name : null;
     $cats = $cats->select('id', 'name', 'parent')->posts(8)->orderBy('name')->get();
     return view('admin.movies.edit', compact('movie', 'cats', 'users', 'auth'));
 }
예제 #3
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id, User $users)
 {
     $gallery = Image::findOrFail($id);
     $images = unserialize($gallery->images);
     $img_title = unserialize($gallery->img_title);
     $users = $users->latest('name')->orderrolein(['Author'])->get();
     $users = array_pluck($users, 'name');
     $users = array_name($users);
     $auth = Auth::user()->hasRole('Author') ? Auth::user()->name : null;
     return view('admin.gallery.edit', compact('gallery', 'images', 'img_title', 'users', 'auth'));
 }