Skip to content
Advertisement

Tag: laravel

Laravel Eloquent where statement returns no attributes

So from my previous post, I was advised to start using Eloquent models, which I did. My end goal, is to print out specific gifts, that belongs to that specific box. Migrations: gift_items: gift_campaigns: Pivot table: Controller: Error that I receive using this way: Seems like the updated version is trying to call the gift_campaigns table id, instead of the

Laravel Mail attach method – Attached file not opening after downloading

I have used the Laravel Mail attach method to specify file attachment for the mail being sent. The file attached successfully but cannot be viewed. ->attach(route(‘download_attachment’, ‘file=’ . $attachment->name)); One thing I noticed though is that if I generate the link in the email being sent, people can also only download it if they are authenticated. So, I am thinking

Error while adding Eloquent class to User in Laravel

I want to make an eloquent model out of two table, pekerjaan and user. User hasMany pekerjaan and pekerjaan belongsTo User. How do I add eloquent’s method to the User class in Laravel? I have an error that shows: Cannot declare class AppModelsUser, because the name is already in use Here is my User.php model code: And here is my

How to delete file in my database Laravel

How do I delete files in the database, because when I click delete the data in the folder is deleted, but the data in the file_rekap tables don’t want to be deleted, but the ones in the rekap table are deleted RekapController: Model rekap and file_rekap and script in my rekap_blade How ti fix it ? Answer If you want

Laravel 8 – Get search result in friend lists

I am Working on laravel 8 version. I have two Models were table structure is as following. User FriendList i want to search result from User but condition is like it should be in friendlist and user should be individual (is_individual = 1) I have tried following but i wan improve this. Controller FriendList Help me to improve this. Thanks

variable references & in Laravel

In the following code, I noticed &$list is passed by reference in the loop, however $user and $request are passed by variables. Passing $list directly to the loop won’t change $list outside the loop scope. Why is this? Answer Actually its the core PHP functionality rather than Laravel itself, basically when you are passing variables without reference, it actually clone

Advertisement