I am building an application which has a quite complex model (at least for me). I’ve been looking for solutions for a few days now and still not sure I understand the correct way to write this. I have a "main" model, which is named EscalationPolicy. The policy can have targets (1 or many): Team, ..

I am using laravel policies to authenticate user actions on an application backend which was built using laravel nova. I am also using spatie permissions and roles package https://spatie.be/docs/laravel-permission/v3/introduction in this project. I have a UserTransactionPolicy which allows users with certain roles view a user’s transactions and only those with a certain permission. public function ..

how are you ? I’m using Guzzle to send post method but when i tried to send the post method with variable getting error so i tried to convert it to sting but still same this is my current code $user = Auth::user();$mobile = $user->mobile;$client = new Client(); $booking = Booking::where(‘id’, ‘=’, e($id))->first(); ..

I’m building a web app, and on this web app the user page displays the user’s comment karma (works exactly like reddit, it’s basically the sum of the total score of all their comments). So in my user model I have a function to calculate this: public function comments() { return $this->hasMany(Comment::class, ‘created_by’, ‘id’); } .. Read more I am trying to include Vue-Multiselect in my Laravel 7.3 project I eventually want to include the Multiple select options but am trying to get it set up for a normal select option to start with and trial it. I have tried setting it up following all of the instructions given for it (installing it .. Read more I’m trying to fetch some records if a certain condition is met, but am having trouble building the correct query. Here’s my example code: //$stars_selected = "4" $brokers = Broker::query() ->with(‘avgScore’); // example will returns 3.5 ->paginate(10) ->withQueryString(); Now, let’s say I have another variable present$stars_selected = "4", and I only want to ..

If there is a list of users, which has their images on firebase storage bucket. To show image in the list, we need to make multiple calls. Server will make many calls. Can these be calls merged And issue facing in integrated with Laravel Sourc..

I’m fairly new to Laravel, but I’m trying to make a small API for my course. I’ve got this route Route::get(‘films/search’, ‘[email protected]’); which calls my custom function search which get as a parameter a Request. Here it is: public function search(Request $request) {$keyword = $request->input(‘keyword’);$rating = $request->input(‘rating’);$minLength = $request->input(‘minLength’);$maxLength = $request->input(‘maxLength’); .. Read more I am trying to implement a follow and unfollow feature on my laravel project. If I have followed the user, the unfollow button should be shown and if I have not followed the user, the follow button should be shown. The unfollow button is not showing even after I follow the user. Is it that .. Read more I am trying to implement a follow and unfollow feature on my laravel project. If I have followed the user, the unfollow button should be shown and if I have not followed the user, the follow button should be shown. The unfollow button is not showing even after I follow the user. Is it that .. Read more I hope this is the right place to ask this – if not, please direct me to the appropriate forum. I’ve been doing a lot of research all day on the best route to take with an application that I’m developing and would appreciate your advice. Here are the basics. I am building a ReactNative .. Read more hey everybody is it technically possible to set data in an extra column in the pivot table? my database is like products sellers id id title name brand_id and… prodduct_sellrs id product_id seller_id price and I want to Seed my database with factory Faker data and here is my code in my seeder (I’ve already .. Read more How can I chain an array of relations to a query builder instance in Laravel? I currently have an array of relations passed in from another part of the system. Something like this:$relations = [ "company", "staff", "category", ] I’ve then got an instance of a model, and want to loop and add each ..

I am importing from Excel into database using Laravel-5.8 and Maatwebsites-3.1: public function importGrade(Request $request){$request->validate([ ‘file’ => ‘required|max:10000|mimes:xlsx,xls’, ]); $path1 =$request->file(‘file’)->store(‘import’); $path=storage_path(‘app’).’/’.$path1; $import = new GradeLevelsImport;$import->import($path); if ($import->failures()->isNotEmpty()) { Session::flash(‘failure’, $import->failures()); return redirect()->route(‘hr.grades.index’); } Session::flash(‘success’, ‘Grade Records Imported Successfully’); return redirect()->route(‘hr.grades.index’); }$import->failures() has 4 items: row(), attribute(), errors() and errors() as ..

I would like to use Vue 3 components/vue files within Blade Templates. I have been spending the whole day trying to get it working, so this is my last hope.I tried watching video tutorials, I tried reading the documentation, I have tried pretty much everything. I first tried to install Vue using npm: npm install ..

I’m using Tailwind CSS for the first time in my Laravel project. I followed the documentation on the Tailwind CSS website to install Tailwind. After some usage, I noticed my .bg-color classes didn’t work. Eventually, I realized the classes weren’t even being compiled because there were no classes named .bg-color in the public/app.css file. As ..

Having the next request with Axios in VueJS axios.post(‘route-of-the-method’), { data, }).then((res) => { self.$vs.notification({ title: this.$page.props.language.section.success, text: this.$page.props.language.section.action_done, }); … Then the response from the controller is the next: return response()->json(true); So looks quite simple, it should to launch the notification properly, but it crashes because vue cannot read the shaded props from inertia. .. Read more There is a table of MySQL "Categories". Model "Category" has a "hasMany" relation that looks like this public function children(){ return$this->hasMany(self::class, ‘parent_id’); } On the category edit page, in order to assign a parent category to the current one, I need to generate a Select tag, which will contain all rows from the Categories ..

I want to add an external library (TAD php) into my project that I made it using Laravel, but I couldn’t that because I’ve never tried this before, this library is in GitHub and this is the link: https://github.com/cobisja/tad-php please tell me how can add it to composer and install it because I am new ..

I want my registered users to appear in my administration panel How could the path be or how can I make all the records from the users table appear in the admin panel? Sourc..

I have checked other questions similar to this but haven’t yet found a working solution. I have my quantity variable globally declared at the top of my controller like so: // defining global quantity variable private $quantity; I then have my index() function, which returns my cart view along with the quantity variable. It also .. Read more I’m passing an array of json objects through the request to be validated in the controller: Controller public function store(Request$request) { $this->validate($request, [ ‘situation’ => ‘required’, ]); $emotions= [‘data’ =>$request->input(’emotions’)]; $emotionsValidation = IlluminateSupportFacadesValidator::make($emotions, [ ‘data.*.id’ => ‘integer|between:1,70’, ‘data.*.intensity’ => ‘integer|between:0,100’, ‘data.*.new_intensity’ => ‘integer|between:0,100’ ]); if(\$emotionsValidation->fails()) { return response([‘error’ => ‘There was a problem ..