D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
tattooscyy
/
api
/
app
/
Http
/
Controllers
/
Filename :
GalleryController.php
back
Copy
<?php namespace App\Http\Controllers; use App\Galleries; use Illuminate\Http\Request; class GalleryController extends Controller { public function getId($id = '') { $obj = Galleries::with('artist')->where('id', $id)->first(); return $this->respon($obj); } public function getAll() { $objs = Galleries::with('artist')->get(); return $this->respon($objs); } private function respon($obj) { if (!$obj) { $obj = new Galleries; } return response()->json([ 'data' => $obj->toArray() ]); } }