Some photo management fixes

This commit is contained in:
Deon George 2019-12-15 21:08:33 +11:00
parent af1164e764
commit 149c7dcc53
2 changed files with 13 additions and 7 deletions

View File

@ -9,6 +9,9 @@ use App\Jobs\PhotoDelete;
class PhotoController extends Controller
{
protected $list_duplicates = 20;
protected $list_deletes = 50;
/**
* Create a new controller instance.
*
@ -36,7 +39,7 @@ class PhotoController extends Controller
{
return view('catalog.deletereview',[
'return'=>url('p/deletes'),
'catalog'=>is_null($id) ? Photo::where('remove',1)->with('software.model.make')->paginate(10) : Photo::where('id',$id)->paginate(1)
'catalog'=>is_null($id) ? Photo::where('remove',1)->with('software.model.make')->paginate($this->list_deletes) : Photo::where('id',$id)->paginate(1)
]);
}
@ -57,7 +60,7 @@ class PhotoController extends Controller
{
return view('catalog.duplicatereview',[
'return'=>url('p/duplicates'),
'catalog'=>is_null($id) ? Photo::notRemove()->where('duplicate',1)->with('software.model.make')->paginate(10) : Photo::where('id',$id)->paginate(1)
'catalog'=>is_null($id) ? Photo::notRemove()->where('duplicate',1)->with('software.model.make')->paginate($this->list_duplicates) : Photo::where('id',$id)->paginate(1)
]);
}

View File

@ -115,14 +115,17 @@ abstract class Catalog extends Model
{
$result = '';
if ($this->software->model->make)
$result .= $this->software->model->make->name;
if ($this->software_id) {
if ($this->software->model_id) {
if ($this->software->model->make_id) {
$result .= $this->software->model->make->name;
}
if ($this->software->model)
$result .= ($result ? ' ' : '').$this->software->model->name;
$result .= ($result ? ' ' : '').$this->software->model->name;
}
if ($this->software)
$result .= ($result ? ' ' : '').$this->software->name;
}
return $result;
}