Call to undefined function getClientOriginalName() in Laravel 8 [closed] - laravel

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed last year.
Improve this question
I want to use the function getClientOriginalName() for making a new name for the photo I take from the user. But as I said before, it displays an error that says that this function is undefined.
$pic = $request->photo;
$newPic = time().$pic.getClientOriginalName();

The method getClientOriginal name exists on the UploadedFile instance. To get the instance you should get by the file() method from $request object
$pic = $request->file('photo');
$newPic = time().$pic->getClientOriginalName();

Related

r.PostForm() works only if I call before r.PostFormValue() [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 days ago.
Improve this question
As the title say, I have a code like this:
//if i don't use this line r.postform() don't works and return absolute nothing.
//html form works correctly
// I don't need to call r.PostFormValue for every key, just one
fmt.Println(r.PostFormValue("oldpass"))
if r.PostForm.Has("oldpass") && r.PostForm.Has("newpass1") && r.PostForm.Has("newpass2")
{ //if i don't call r.PostFormValue() the program stop before the if }
}
Make no sense to me... Also I remember to have used it without in the past, so I don't think it depend on parsing the value... What could be?

laravel syntax error, enexpected ',' , expecting ';' [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I tried to fix this but don't know how
public function render()
{
return view('livewire.home')->extends('layouts.app')->section('content'),[
'products' => Product::take(3)->get()
];
It said that the syntax is error,
unexpected ',', expecting ';'
I'm newbie to Laravel so I couldn't write the correct syntax. Please let me know.
As you can see in the docs, to pass variables to the view, you need to set the second parameter in the method view() as the array of data.
public function render()
{
return view('livewire.home', [
'products' => Product::take(3)->get()
])->extends('layouts.app')->section('content');
}

Method cannot be called inside of a class [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
This program runs as intended if outside a class, how could this be run inside of one?
class Pointester
$points = 0
def point_tracker()
puts $points
end
point_tracker()
end
Here's the error: undefined method `point_tracker' for Pointester:Class (NoMethodError)
Change it to:
class Pointester
$points = 0
def point_tracker
puts $points
end
end
Pointester.new.point_tracker
And you might want to consider using an instance instead of a global variable – depending on your use-case.

Trying to access array within a hash in ruby [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I am trying to parse a hash in ruby. I have an array an array of 'entries'. I want to take each entity and get array of runs within it (I want to store the runs in a different variable as seen below). My problem is that runs always turns out nil. Below is my code:
entries = test_plan['entries']
entries.each do |ent|
puts "in entries"
puts ent
runs = ent['runs]']
runs.each do |run|
and what an 'entries' hash looks like.
{"id"=>"7", "suite_id"=>729, "name"=>"Regression", "runs"=>[{"id"=>2588, "suite_id"=>729}]}
There is a simple typo. Change
runs = ent['runs]']
to
runs = ent['runs']

Public ObservableCollection causing crashes [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
Whenever I make an ObservableCollection a public variable, as soon as the page is called with it on it the app crashes. What I'm trying to do is Add items to the public ObservableCollection from another class... I'll try to represent the structure below
Dir: Project/Class/PrepareSpells.xaml
public ObservableCollection<PublicVariables.Spell> level0 = new ObservableCollection<PublicVariables.Spell>();
Dir: Project/SpellLists/PopulateList.cs
Class.PrepareSpells prepare = new Class.PrepareSpells();
PublicVariables.Spell newSpell = new PublicVariables.Spell();
newSpell.spellLevel = 0;
newSpell.spellName = zeroName[i];
prepare.level0.Add(newSpell);
Please note that PopulateList is contained within a valid 'for' loop. I have also created an object for the PrepareSpells.xaml (prepare, above).
Is there a different way to do this or is it impossible? If I simply have an OC in the PopulateList whenever I manipulate it further (ie, to populate a higher spell level list) it modifies ALL the OC's in the PrepareSpells.xaml domain to reflect the new changes.
Please let me know if this is far too ambiguous and I will provide more code.
This is not an issue: I was inputting invalid data... I feel sheepish....

Resources