简体   繁体   中英

I am trying to use If() condition , however, it's not working in laravel

I have few field in my store method, so I wanted to use if() condition, but it's not working

here is code

    if($request->has('link'))
    {
        $data['link']=$request->link;

    }
    if($request->has('content'))
    {
        $data['content']=$request->content;

    }

改用$request->filled('link')

You can you below codes....

if($request->link == NULL)
             or
if(empty($request->link))
             or
if ($this->isEmptyString($value)) return false;

These are some alternative you can use.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM