Author : Yevgeniy Afanasyev

I have a model Agent and it has many agent accounts. public function agentAccounts(): Relation { return $this->hasMany(AgentAccount::class); } I want to delete them in one transaction but using boot method public static function boot() { parent::boot(); self::deleting([self::class, ‘onDeleting’]); } I understand, that when I create a Db transaction inside "onDeleting" funcion like this public ..

Read more

I have a model Agent and it has many agent accounts. public function agentAccounts(): Relation { return $this->hasMany(AgentAccount::class); } I want to delete them in one transaction but using boot method public static function boot() { parent::boot(); self::deleting([self::class, ‘onDeleting’]); } I understand, that when I create a Db transaction inside "onDeleting" funcion like this public ..

Read more

convert image to base 64 string with Laravel I want to convert an image to base 64 with Laravel. I get the image from a form . I tried this in my controller: public function newEvent(Request $request){ $parametre =$request->all(); if ($request->hasFile(‘image’)) { if($request->file(‘image’)->isValid()) { try { $file = $request->file(‘image’); $image = base64_encode($file); echo $image; } ..

Read more