how get role of user in laravel spatie
$user->getRoleNames()
Here is what the above code is Doing:
1. We’re getting the user from the database using the id.
2. We’re getting the role names of the user.
3. We’re returning the role names.
$user->getRoleNames()
Here is what the above code is Doing:
1. We’re getting the user from the database using the id.
2. We’re getting the role names of the user.
3. We’re returning the role names.
Vehicle::find(3)->value(‘register_number’); Here is what the above code is Doing: 1. We’re using the find() method to find the record with an id of 3. 2. We’re then using the value() method to return the value of the register_number column.
$data = Subcategory::with([“category”]) ->where(‘name’,’like’, ‘%’.$this->searchData.’%’) ->orWhereHas(‘category’, function($query){$query->where(‘name’, ‘like’, ‘%’.$this->searchData.’%’);}) ->orderBy($this->orderByData, $this->orderByAsc ? ‘asc’ : ‘desc’) ->paginate($this->showData); Here is what the above code is Doing: 1. We are using the `with` method to eager load the `category` relationship. 2. We are using the `where` method to search for the `name` column. 3. We are using the…
cd /usr/local/webuzo/conf/webuzo/emps nano php.ini #change this line upload_max_size = 100M upload_max_filesize = 100M post_max_size = 100M #restart server systemctl restart webuzo Here is what the above code is Doing: 1. We are changing the directory to the php.ini file. 2. We are opening the php.ini file in nano. 3. We are changing the upload_max_size, upload_max_filesize,…
//Safe as: index.html number.php //HTML: Home Phone Number //PHP: Here is what the above code is Doing: 1. The PHP code is executed on the server. 2. The result is sent to the browser as plain HTML. 3. The browser receives the HTML and displays it.
Here is what the above code is Doing: 1. The strpos() function searches for a specific text within a string. 2. If a match is found, the function returns the character position of the first match. If no match is found, it will return FALSE. 3. In the example above, we searched for the text…
// Retrieve a model by its primary key… $flight = App\Flight::find(1); // Retrieve the first model matching the query constraints… $flight = App\Flight::where(‘active’, 1)->first(); // Shorthand for retrieving the first model matching the query constraints… $flight = App\Flight::firstWhere(‘active’, 1); Here is what the above code is Doing: 1. Retrieve all of the flights. 2. Retrieve…