I have a bunch of functions related to image processing so I made an ImageProcessing.php
class for my controller to reference. I put the code below -- in my ImageProcessing
class, do I need a construct function and if so, what would I need to put in since I am passing in the data I need already? I am new to Laravel from doing Kotlin for years so I'm still learning the ins and outs.
Controller
public function processSmallImages(Request $request)
{
$imageId = $request->input('image_id');
$image = Image::where('id', '=', $imageId)->first();
return (new ImageProcessing)->processSmall($image->id);
}
ImageProcessing.php
use App\Models\Image;
class Image
public function processSmall($imageId)
{
$image = Image::find($imageId);
//// do Image stuff
}
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2MRJgKo
via IFTTT
Aucun commentaire:
Enregistrer un commentaire