I’m using Laravel 8 for my project and in this project and I have created a custom Middleware called Admin that goes like this: And I tried applying it like this: And on Kernel.php: So I called the isAdmin() at User Model which simply checks if the role of the user is correct or not: Currently, I have these two
Tag: laravel
Laravel LiveWire 2 : Do we have to make a new class or we can do like traditional Controller
So, it’s my first LiveWire learning Project. Just to the point, I’m making a Livewire Component called User using php artisan make:livewire user and then this is what I got First User.php And so, I want to make a create user at different pages. NOTES: Ive already use turbolinks for the SPA, and when I create like the traditional Laravel
Comparing user submitted data, then sending a response back
newbie here I apologize for the cryptic title, I’m new to Laravel and PHP. I’m building a CTF application using Laravel Jetstream with LiveWire as part of a university project. Users will submit flags they’ve found, and I want that data to be compared with a database entry. If they flag is correct, I want this to be shown: If
Passing options containing blank spaces from Laravel blade to Vue multiselect
I’m trying to use Vue Multiselect in my Laravel blade file. I am putting the data in array and pass it in options as props. When option is one word(ex. “View”) everything is working. But when the option contains multiple words(ex. “View customer”) I am receiving the following error: When I print the json array, the data is shown as
Laravel 8: Call to a member function notify() on string
I’m working with Laravel 8 to make a forum and now I wanted to send a notification to a user who has asked a question whenever someone answered that question. So in order to do that, I added this to the Controller: So the $question is the question id and $asker is the user id of the person who has
Return a view with Laravel Octane Route
I’m trying to use Octane routing with Laravel in the routes/web.php file. The code above works, but how can I return a view with data. I tried many things, but nothing is working. Is it possible to return views like the Route facade with Octane ? Thank’s for help ! Answer Laravel has a lot of magic under the hood
laravel 8 migration error: Unknown column ‘batch’ in ‘order clause’ (SQL: select `migration` from `migrations` order by `batch` asc, `migration` asc)
[SOLVED] i new to Laravel and PHP. i tried to migrate my own migrations but i can’t. this my laravel and php information: my php info PHP 8.0.3 (cli) (built: Mar 4 2021 05:33:14) ( NTS ) Composer version 2.0.11 2021-02-24 Laravel 8.x mysql Server version: 10.5.9-MariaDB Arch Linux my OS info uname: Linux ali 5.4.105-1-MANJARO #1 SMP PREEMPT 2021
Problems when using join and pagination together in Laravel
I have some tables in my database and I’m trying to transact between them. My aim is to show the project name and the employees in that project in the form of cards on my projects page as in the image below. (Other than the method I mentioned, if there are better ways to do this, I ask you to
How to name a policy for multimodel route in Laravel?
I’m trying to write a policy for this route: Route::delete( ‘users/{user}/locations/{location}’, [UserLocationController::class, ‘destroy’], )->middleware(‘can:delete,user,location’); but …
How to multiple withcount() columns sum and order by in laravel
I have to need to order by records based on withcount() function in laravel 6 In this code, I have two withCount() functions and I need to order By based on that two-column sum before get(). It works when order by using one column but if I use two-column then it returns an unknown column. Is it possible or not?