I want to open payment gateway page in new window page and after completing of payment redirect back to parent window with redirect URL.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/30BI6aZ
via IFTTT
New version 5.1 Laravel! You practice and you know PHP create sites I propose today to discover all the Laravel PHP framework. Find a concentrate of the web around the world of web development and graphic design ... Train yourself and improve your skills
I want to open payment gateway page in new window page and after completing of payment redirect back to parent window with redirect URL.
I am beginner in Laravel. In use in my project Laravel 5.8. I have this array:
array:4 [
0 => 1
1 => 3
2 => 4
3 => 5
]
and function:
public function getPaymentMethods(array $paymentId)
{
dd($paymentId);
return PaymentSettings::where('id', '=', $paymentId)->get();
}
It's not working because in $paymentId I have array. How can I change my code function to use with array (many where/orWhere)?
I need something like this (but in laravel eloquent):
SELECT * from payment_settings where id = 1 or id = 3 or id = 4 or id = 5.
Good morning guys, I'm working on a vue project which makes a get request to an api on a different website using axios. Well, I encountered an error which reads, "No Access-control-allow-origin header" , so I did some research and I understand the browser is only blocking the request due to the Same origin policy implementation (which I understand now). So I got a quick fix which was to add a chrome extension which I think is cool for dev purposes, but my concern is when it gets to production, How I'm I going to fix this so that my clients wouldn't have to install this chrome extension.? Would i have to route the request through a proxy? If so kindly suggest some useful resources to help me out. And If my understanding of cors Is wrong, kindly help with some clarification, thanks. Using vue n laravel
I am beginner in Laravel. I use in my project Laravel 5.8.
I have this code:
$userPromotionDays = $user->premiumDate; // 2019.08.28
$daysToAdd = 5
How can I add $userPromotionDays to $daysToAdd (in Laravel/Carbon)?
"I am using laravel 5.5 version and my php version is 7.0 when my project setup on ubuntu server and open my project on browser showing these error Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_PARSE) Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE)"
Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_PARSE) Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE)
I want to allow only authenticated users to access some API routes. I use the default Laravel authentication system. After the default login, I want to be able to access a route, but I get the "Unauthenticated" message.
So, after login, I am redirect to the home route which uses the HomeComponent file. Here, using axios, I am making a call to the step API route where I am trying to get the id of the authenticated user, but instead I receive an error message. What am I doing wrong?
api.php
Route::middleware('auth:api')->group(function () {
Route::get('application/step', ['as' => 'application.step', 'uses' => 'ApplicationController@step']);
});
ApplicationController.php
public function step() {
print_r(auth()->user());
die('---');
// code to get authenticated user step
return json_encode(array('step' => 7));
}
LoginController.php
public function login(Request $request)
{
$this->validate($request, [
'email' => 'required|email',
'password' => 'required|min:6'
]);
$user = User::where('email', $request->email)->firstOrFail();
if ($user && !$user->isAdmin()) {
if (Auth::attempt(['email' => $request->email, 'password' => $request->password], true)) {
$token = $user->createToken('TokenName')->token;
$token->save();
return redirect()->route('home');
}
else {
return back()->withInput($request->only('email'));
}
}
return back()->withInput($request->only('email'))->withErrors(['denied' => 'You are not allowed to access this page.']);
}
HomeComponent.vue
...
getStep() {
axios.get("/api/application/step")
.then((response) => {
this.step = response.data.step;
})
.catch((err) => {
console.log('Cannot get step', err);
});
}
Every time I run the test, I'm getting a 403 response status, what am I doing wrong in here? I have tried to remove Passport authorization from the test, but then I'm getting a redirect to a login page, 302 status response.
//PostTest:
public function test_can_update_post()
{
//creating a user
$user = factory(User::class)->create();
//creating an author for post
$author = factory(Author::class)->create([
'user_id' => $user->id,
]);
//creating a post
$post = factory(Post::class)->create([
'author_id' => $author->id,
]);
$data = [
'title' => $this->faker->title,
'content' => $this->faker->paragraph,
];
//authorizing user
//I have tried to remove this line, then I'm gettig a redirect to login page 302
$user = Passport::actingAs($user, ['posts/' . $post->id]);
$this->actingAs($user)
->patch(route('posts.update', $post->id), $data)
->assertStatus(200);// why I'm getting 403???
}
//API route:
Route::patch('posts/{post}')
->uses('PostController@update')
->middleware('auth:api')
->name('posts.update');
//PostController update method:
public function update(PostUpdateRequest $request, Post $post)
{
$this->authorize('update', $post);
$post->title = $request->input('title');
$post->content = $request->input('content');
$post->save();
return new PostResource($post);
}
//PostPolocy
public function update(User $user, Post $post)
{
return Author::where('user_id', $user->id)->first()->id === $post->author_id;
}
I expect response status 200