Member Since 1 Year Ago
1,280 experience to go until the next level!
In case you were wondering, you earn Laracasts experience when you:
Earned once you have completed your first Laracasts lesson.
Earned once you have earned your first 1000 experience points.
Earned when you have been with Laracasts for 1 year.
Earned when you have been with Laracasts for 2 years.
Earned when you have been with Laracasts for 3 years.
Earned when you have been with Laracasts for 4 years.
Earned when you have been with Laracasts for 5 years.
Earned when at least one Laracasts series has been fully completed.
Earned after your first post on the Laracasts forum.
Earned once 100 Laracasts lessons have been completed.
Earned once you receive your first "Best Reply" award on the Laracasts forum.
Earned if you are a paying Laracasts subscriber.
Earned if you have a lifetime subscription to Laracasts.
Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.
Earned once you have achieved 500 forum replies.
Earned once your experience points passes 100,000.
Earned once your experience points hits 10,000.
Earned once 1000 Laracasts lessons have been completed.
Earned once your "Best Reply" award count is 100 or more.
Earned once your experience points passes 1 million.
Earned once your experience points ranks in the top 50 of all Laracasts users.
Earned once your experience points ranks in the top 10 of all Laracasts users.
Replied to Laravel Addselect Where Column Is Not Found
@tykus why is using Laravel addSelect
subquery function will not work? even though when I run the raw mysql query I can see that there is column branch_name
in the table?
Started a new Conversation Laravel Addselect Where Column Is Not Found
Hi guys,
I have a query to query out categories
and \App\Models\Category
has a relationship category belongsTo branch
.
Category::addSelect(['branch_name' => Branch::select('name')
->whereColumn('id', 'categories.branch_id')
->take(1)
])
->where('branch_name', 'ABC Branch')
->get()
and I am getting this error message
Column not found: 1054 Unknown column 'branch_name' in 'where clause' (SQL: select `categories`.*, (select `name` from `branches` where `categories`.`branch_id` = `id` limit 1) as `branch_name` from `categories` where `branch_name` = ABC Branch)
Thanks in advance!
Replied to Eloquent Make Exists Return True
So this is why it return true
? Hmm, I always thought that exists()
will if there is a record in the database..
Replied to Eloquent Make Exists Return True
So to check if the model is exists in the database or not, we can use $post->exists
or $post->getKey()
right?
Started a new Conversation Eloquent Make Exists Return True
Hi guys I have the code below
$post = Post::make();
dd($post->exists()); // true
Is this the correct behaviour for exists
method?
I thought exists
is to check whether the record exists in database?
Thanks in advance.
Awarded Best Reply on Tailwind CSS
Thanks @sinnbeck
I have managed to find the way to align the dropdown div with the button by looking through the components in TailwindUI.
I just changed the right-0
to -right-1/2
in the second wrapper div.
Replied to Tailwind CSS
Thanks @sinnbeck
I have managed to find the way to align the dropdown div with the button by looking through the components in TailwindUI.
I just changed the right-0
to -right-1/2
in the second wrapper div.
Started a new Conversation Tailwind CSS
Is there a way I can align the dropdown box vertically center with the button in the image below?
Here is the code of the dropdown from tailwind ui, this is the free sample
<!-- This example requires Tailwind CSS v2.0+ -->
<div class="relative inline-block text-left">
<div>
<button type="button" class="inline-flex justify-center w-full rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-indigo-500" id="options-menu" aria-haspopup="true" aria-expanded="true">
Options
<!-- Heroicon name: chevron-down -->
<svg class="-mr-1 ml-2 h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
</svg>
</button>
</div>
<!--
Dropdown panel, show/hide based on dropdown state.
Entering: "transition ease-out duration-100"
From: "transform opacity-0 scale-95"
To: "transform opacity-100 scale-100"
Leaving: "transition ease-in duration-75"
From: "transform opacity-100 scale-100"
To: "transform opacity-0 scale-95"
-->
<div class="origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5">
<div class="py-1" role="menu" aria-orientation="vertical" aria-labelledby="options-menu">
<a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900" role="menuitem">Account settings</a>
<a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900" role="menuitem">Support</a>
<a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900" role="menuitem">License</a>
<form method="POST" action="#">
<button type="submit" class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900" role="menuitem">
Sign out
</button>
</form>
</div>
</div>
</div>
I wanted to made the button and the dropdown is vertically center.
Thanks in advance!
Replied to Error After Upgrading To Tailwindcss 2
Hi Paul,
I have managed to find a temporary solution for this. Just comment this @import 'tailwindcss/components';
code in app.css
in your resource folder. But please bear in mind if you are using tailwindcss/components
then it is best to wait for official fix.
Ps. form-input
is now changed too in tailwind, check here https://tailwindui.com/changes-for-v2
Please tell if it works for you.
Replied to Livewire Weird Behavior When Toggling Public Property From Blade
@uniqueginun in your file-browser Livewire component class, can you add this
public function mount($object, $ancestors)
{
$this->object = $object;
$this->ancestors = $ancestors;
}
Started a new Conversation Laravel Jetstream With Laravel Sanctum
Hey guys,
I have installed the latest Laravel with Laravel Jetstream and I noticed that the web.php
routes is protected by auth:sanctum
, why was the web.php
routes is protected by auth:sanctum
?
When I ran the code below it gave the output
auth()->check(); // true
auth('sanctum')->check(); // true
auth('web')->check(); // true
auth()->getDefaultDriver(); // 'sanctum'
This made me unable to run auth()->loginUsingId($user_id)
in my controller as the default guard is sanctum
, the error message is
Method Illuminate\Auth\RequestGuard::loginUsingId does not exist.
Thanks in advance!
Started a new Conversation Method Illuminate\Auth\RequestGuard::loginUsingId Does Not Exist
Hey guys,
I am using the latest version of Laravel and using Jetstream with Livewire.
When I call auth()->loginUsingId()
in Livewire components it works
Livewire component
public function switch($user_id)
{
...
auth()->loginUsingId($user_id);
}
but when I call auth()->loginUsingId()
in controller it does not work
Controller
public function store($user_id)
{
...
auth()->loginUsingId($user_id)
}
It shows me the error Method Illuminate\Auth\RequestGuard::loginUsingId does not exist
.
Why does this happen?
Thanks in advance!
Commented on User Impersonation
Hey, I am currently using Laravel Jetstream and my web.php
middleware is using auth:sanctum
and when I run auth()->loginUsingId()
in Livewire it is fine, but when I run in on controller I got Method Illuminate\Auth\RequestGuard::loginUsingId does not exist.
, why does this error occurred?
Started a new Conversation One Page Website
Hi guys,
What stack/technology would guys recommend for build a website with one page only? or just use Laravel for it because i am experienced with it?
Thanks in advance
Replied to How To Call The Input Type According To The Column Type In The Database
@foreach ($metadata as $metadatas)
{!! Form::label($metadatas->$metadata_key, $metadatas->metadata_key) !!}
{!! Form::$metadatas->metadata_type($metadatas->metadata_id, null, ['class' => 'form-control', 'name' => ''] !!}
@endforeach
Can you try this code and perhaps show some errors messages next time.
Replied to Why First() Is Not Using LIMIT In It's Query?
first()
method is to get only the first
one in the record. If you want to have other records, you should use get()
which will return an amount set by LIMIT
Replied to Get Array Inside Array
What is the returned response from the api you called when clicked getRelatos()
?
Replied to Laravel Paypal Multi User Account Setup
As you say each user can have their own PayPal account right? Then you put the client_id
and secret
in the users
table.
Then just use the client_id
and secret
for the users when using PayPal.
You may want to read the documentation for your PayPal package.
Replied to Delete Data
Is it because you have a typo in your javascript ?
@section('script')
<script>
$('#delete').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget);
var category = button.data('category');
var modal = $(this);
modal.find('.modal-body #categoey').val(category);
});
</script>
@endsection
modal.find('.modal-body #categoey').val(category);
I did not see any element with id categoey
, do you mean category
?
Replied to Variable Constant
Don't know whether this is the best practice way to do it.
In your model file
Finance.php
public static function getConstantField($variable)
{
return constant('self::' . $variable);
}
add this function and when you want to get the constant field just call the function
dd(Finance::getConstantField('SETUP_FIELD'));
Replied to Npm Run Dev Not Working
What laravel version are you using?
You can check your laravel version by running the code php artisan --version
Wow! How do you found out the bug? But currently it doesn't appear in my Log file anymore, if it appear again, I will try to disabled Laravel Intellisense extension in my Visual Studio code, to check whether this works. Thanks @xiaohuilam !
Im sorry for the late reply.
I have checked that there is no schedule job/command is running in my local. And if there is any job that is queued that could make this error to occur, I still need to run php artisan queue:listen
to make that happen, but I did not run any command at all.
It will keep spamming my laravel.log file. The only way I can stop this spam is comment out return parent:report($e)
in my App\Exceptions\Handler.php
I only found getBaseName
in Illuminate vendor file vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php
, vendor/symfony/http-foundation/File/File.php
and vendor/symfony/routing/Loader/AnnotationDirectoryLoader.php
My guess that the error is originates from some of the background code that is running for Laravel 5.1.
It is quiet annoying as I need to switch PHP version so that the project will not continue to produce the error, this is because the project only runs in PHP 7.1
I wanted to check where the error originates from but all I got from the error log is
[2020-08-25 13:59:09] local.ERROR: Symfony\Component\Debug\Exception\FatalErrorException: Uncaught Error: Call to a member function getBaseName() on string in Command line code:38 Stack trace: #0 Command line code(61): getViews('/Users/rezuanka...', Object(Illuminate\Filesystem\Filesystem)) #1 {main} thrown in Command line code:38 Stack trace: #0 {main} [] []
Is there anyway I can check where the error originates from?
Started a new Conversation Symfony\Component\Debug\Exception\FatalErrorException: Uncaught Error: Call To A Member Function GetBaseName() On String In Command Line Code:38
Hi,
I have a laravel project which is running version 5.1, I am keep having this error message in my laravel.log file, it is keep spamming non-stop.
[2020-08-25 10:26:32] local.ERROR: Symfony\Component\Debug\Exception\FatalErrorException: Uncaught Error: Call to a member function getBaseName() on string in Command line code:38 Stack trace: #0 Command line code(61): getViews('/Users/rezuanka...', Object(Illuminate\Filesystem\Filesystem)) #1 {main} thrown in Command line code:38 Stack trace: #0 {main} [] []
Can anyone help me?
Replied to From Blade To Vue
you can pass the question from blade to vue by passing props from blade to vue.
index.blade.php
...
<question-list :questions="{{ $questions }}"/>
or just use Ajax to call it, make sure you call the correct routes.
Replied to Regex
Sorry I think I messed up the requirements. I wanted to get the words that is only made of the character I have given in the input.
How can I get the results below?
input:
boy
results:
boy, oy
Started a new Conversation Regex
Hi,
Does anyone know how to find a word that contains given characters?
Input:
abc
Output:
back, batch, ...
Thanks in advance! 😋