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
Tag: laravel
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
return user to a view with success message after registration laravel 9.x
I am trying to return a view with a success message with a link to the login page after registering a user, however the session message isn’t passed along with the view. Here is my registred() method Here is the view page Answer We can use session() global helper instead of Session: get flash message by key from your blade
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
Create view in one controller and store data in other controller laravel
I’m new to Laravel and I’m trying to store a form. I created the view with the House controller but now I want to store the data in the view with the Booking controller. But when I click the button nothing happens. My question is if it is possible to make a view with one controller and store it with
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
Totaling the values of columns and get the average to save it on another table
I have a table work in a database that have columns score_1, score_2, score_3, and score_4. I want to get the total value and save it to database as a total_score. And from that total_score I want to get the average matching the work data with the vendor ID. How to achieve this? At the moment I have, the total_score
How to connect internal Bootsrap 5.2 with laravel 7
Hey i still learning laravel framework and i try to connect my bootstrap v.5.2 with my laravel v.7 project but it cant connect, i store css and js folder on bootsrap folder in the same level as app, config, database public, etc. and i already tried to connect it with the code: but it still cant connect? Answer Put Your