public static function post($type, $data) { if ($type == 'id') { return Post::findOrFail($data); } return Post::where($type, $data)->first(); }