Reputation: 115
I want to save my generated milon barcode to my laravel directory on server. I'm using this code in my controller:
public function store(Request $request)
{
$total = $request->qty;
for( $i = 0; $i < $total; $invitation = $i++ ){
$barcode = $this->code(5);
$invitation = New Invitation;
$invitation->reg_no = $barcode;
$invitation->distributor_id = $request->distributor;
$invitation->event_id = $request->event;
$invitation->type = $request->type;
$invitation->status = 0; //0->blum dipakai
$invitation->QR = DNS2D::getBarcodePNGPath($invitation->reg_no, "QRCODE");
$invitation->save();
}
return redirect()->back()->with('message','cie berhasil masukin data');
}
It turns out that it automatically saved, but not in my public directory, but outside the directory, like this: image saved outside public
then I tried to put on my last code but nothing happen
\Storage::disk('public')->put('test.png',base64_decode(DNS2D::getBarcodePNGPath($invitation->reg_no, "QRCODE")));
is there anything i can do about this?
Upvotes: 0
Views: 1124
Reputation: 2629
Did you link your storage into your public/storage ?
Run this command and try saving via Storage:: .. like you mentioned in your ques.
php artisan storage:link
Upvotes: 1