Question: I want to give storage permission for my app. My code working perfect till Marshmallow, only problem in Nougat

The below method always return false in nougat even permission granted manually from settings.

```
private boolean checkWriteExternalPermission() {

    String permission = "android.permission.WRITE_EXTERNAL_STORAGE";
    int res = getApplicationContext().checkCallingOrSelfPermission(
            permission);
    return (res == PackageManager.PERMISSION_GRANTED);
}

```

I used this for Nougat and allow permission but above method still returns false.

```
void storagePermission(){
    StorageManager sm = (StorageManager)getSystemService(Context.STORAGE_SERVICE);
    StorageVolume volume = sm.getPrimaryStorageVolume();
    Intent intent = volume.createAccessIntent(Environment.DIRECTORY_PICTURES);
    startActivityForResult(intent, 1);

}

```

Please help me to resolve this.

Answer: 
Assuming that you mean months ammount ( i.e for a monthly payment )

You can do it like this in your store method i.e:

```
$start_day = Carbon::parse($request->created_at); //get a carbon instance with created_at as date
$expiry_day = $start_day->addMonths($request->user_selected_months); //add X months to created_at date

```
```
    public function store(StoreRequest $request) {

    date_default_timezone_set('asia/calcutta');
    $month = $request->month;       
    $expiry_date = Carbon::now()->addMonths($month);            
    $request['expiry_date'] = $expiry_date;

    }

```