Skip to content

Tag: laravel

How to test create model service?

I decided to create CreateClassroomService to separte logic in my controller method. I am trying to test this service as part of learning unit testing, but I don’t know how. I don’t know how to mock the classroom object to control what the method should return. Does this mean that creating this se…

Combine categories tree

I have an array like that: In these arrays first level and second level are the same, only the last level is different. I want to combine them into one array. I want to receive result like that: Answer

Laravel Mutator Database Value with Variable variables

I have the following Laravel Eloquent Mutator When calling $object->used_working_time i get the value stored in the database as expected. When using Variable variables $object->{‘used_’.$name} with $name = ‘working_time’ the $db value is null. Is there a way to get the database a…

Laravel how to properly pass data to href

sorry if the question is kind of newbie. I am new to php and laravel, still trying to learn through tutorial. I am trying to pass the ‘No’ in my database to the url, so that the url when I clicked on Daftar, it will show http://127.0.0.1:8000/search/{No} Webpage designed I did try to put it this w…