I created a static method to help me know what mobile OS app my users upload.
public static function knowAppPlatform($file){
$extension= $file->getClientOriginalExtension();
if ($extension=== "apk"){
return 'android';
}
elseif ($extension=== "appx"){
return 'windows';
}
elseif ($extension=== "ipa"){
return 'ios';
}
}
Then i tried to call that same static method in another method in the same model. but it keeps returning a null, it works fine outside the model but not inside.
public static function uploadScreenshot($file){
$platform = static::knowAppPlatform($file);
dd($platform);
$name = Auth::id() . 'screenshots' . time(). '.' . $file->getClientOriginalExtension();
$name = $file->storeAs('mobileApps/screenshots', $name);
return $name;
}
I have researched here on stack overflow and implemented some of the answers, yet no show.
I have tried,
$platform = static::knowAppPlatform($file);
$platform = self::knowAppPlatform($file);
$platform = \App\model\students\App::knowAppPlatform($file);
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire