Question: I'm new to WordPress. I just successfully installed it on my site. 

Now I'm trying to toy with creating my own custom theme. I created one with a custom index.php and a style.css. I zipped the folder, and uploaded it successfully from my WordPress admin by going to `Themes > Appearance > Add New > Upload Theme`, then browsing the zipped file. I activate the newly uploaded theme, and run my site's url, and lo and behold, the new theme gets loaded up in the browser. So far so good. But then when I look into my wp-content/themes folder in my web server through my ftp client, the newly uploaded theme isn't there. The default themes(twentyfifteen, twentysixteen and twentyseventeed) are all there but not my new theme. What could possibly be happening? Isn't that where the new theme should be?

Is there some crucial step in the installation of WordPress that I may have missed?

On the flip side, if I directly FTP to my new folder into the `wp-content/themes` folder in my web server, it doesn't show up in my `Themes > Appearance` page.

What gives? Please any hints/clues will be greatly appreciated.

Answer: 
try this:

assume Post is your model

```
$posts = Post::where('is_public', 1);
if (isset($date)) { 
    $posts->where('created_at', '>', $date);
}
if (isset($search)) {
    $posts->where(function($query) use ($search) {
                 $query->where('title', 'like', "%'.$search.'%")
                  ->orWhere('body', 'like', "%'.$search.'%");
             });
}
$posts = $posts->get();

```
This is Example code : assume Post is your model 

```
$getPosts=Post::query()->where('is_public',1);

$getPosts->when(isset($date),function($q) use ($date){
    $q->where('created_at','>',$date);
 });

$getPosts->when(isset($search),function($q) use ($search){
    $q->where('title','like','%'.$search.'%');
    $q->orWhere('body','like','%'.$search.'%');
 });
$posts=$getPosts->get();

```