Skip to content

Instantly share code, notes, and snippets.

@DB-009
Last active August 29, 2015 14:07
Show Gist options
  • Save DB-009/87a793f79787aec37fb8 to your computer and use it in GitHub Desktop.
Save DB-009/87a793f79787aec37fb8 to your computer and use it in GitHub Desktop.
@if ($noajax==1)
@extends('layouts.master')
@endif
@section('content')
//controller
public function test($id,$model)
{
if (Request::ajax())
{
//$foreign_key and $model must be <> null
if ($id == null || $model == null) {
$this->render('../Errors/missing_arg', 'error');
return;
}
if($model=="ArtObj")
{
$partable = "art_objects";
$path='img/art-objects/';
}
$parid=$id;
$noajax=0;
$mediaimgs = Media::where('parent_id' , $id )->where('parent_table', $partable)->paginate(15);
$response = Response::Json($mediaimgs);
return View::make('/Admin/manageimage/manage_image',compact('parid','mediaimgs','model','path','noajax'));
}
else{
if($model=="ArtObj")
{
$partable = "art_objects";
$path='img/art-objects/';
}
$parid=$id;
$mediaimgs = Media::where('parent_id' , $id )->where('parent_table', $partable)->paginate(15);
$response = Response::Json($mediaimgs);
$noajax = 1;
return View::make('/Admin/manageimage/manage_image',compact('parid','mediaimgs','model','path','noajax'));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment