Beispiel #1
0
 public function scopeByArticleId($query, $id)
 {
     $image = DB::table('articles_images')->where('article_id', $id)->first();
     if ($image === null || count($image) === 0) {
         return null;
     }
     $image_id = $image[0]->image_id;
     return Image::find($image_id);
 }
Beispiel #2
0
 public function edit(AdminImageEditFormRequest $request)
 {
     $id = Input::get('id');
     $caption = Input::get('caption');
     $alt = Input::get('alt');
     $name = Input::get('name');
     $image = Image::find($id);
     if ($image === null) {
         return redirect('admin/images');
     }
     $image->caption = $caption;
     $image->name = $name;
     $image->alt = $alt;
     $image->save();
     Session::flash('succ', 'Uspješna izmjena!');
     return redirect('/admin/image/' . $id);
 }