yafeearun

yafeearun

Member Since 3 Months Ago

Experience Points 760
Experience Level 1

4,240 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 0
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    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.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

14 Aug
1 week ago

yafeearun started a new conversation Set Up Dynamic Database Connection On Multi Tenant Application

Hi

i have configured dynamic database connection like,

$partners = Partner::where('domain',$request['partner']);
  $partners_count = $partners->count();      
  $partners = $partners->first();
  if($partners_count > 0){
    Config::set('database.connections.partner.host', $partners->db_host );
    Config::set('database.connections.partner.database', $partners->db_name );
    Config::set('database.connections.partner.username', $partners->db_username );
    Config::set('database.connections.partner.password', Crypt::decryptString($partners->db_password) );
    Config::set('database.connections.partner.prefix', '' );
    DB::reconnect('partner');
  }
    

it's work fine for me, but my doubt is , what happens if i access same api through $domain = 'domain1' and $domain = 'domain2', the doubt because of i tried to achieve it in single API call not through middle ware

what i have to try to achieve, i have multiple partners,but clients will signup through same page, but i have split it and make entry an respective partner's database. My doubt is if P1 and P2 was comes at same time to signup API then, which one connection will happen, is there any possible the data mishandling.

Hope you guys understand my question. Please clarify my doubt.

13 Jul
1 month ago

yafeearun left a reply on Update Invoice As Void

I found the code

\Stripe\Stripe::setApiKey("");

  $invoices = \Stripe\Invoice::all(["limit" => 100,"customer"=>'','status'=>'open']);
  foreach ($invoices['data'] as $key => $value) {
    $value->voidInvoice();
  }

yafeearun started a new conversation Update Invoice As Void

Hi

i'm using cashier for stripe payment,now i'm trying to make some invoices as void, there is a function for retrieve invoices from stripe, but i didn't find out, how to update a invoice after scheduled.

kindly help me to solve this

05 Jul
1 month ago

yafeearun started a new conversation Point Sub Domain And Allow Limited Controllers Only

hi

i tried to achieve, to point some controllers under pay.domain.com and allow only payment controllers under this url.

actually i tried like

domain.com => access all url's pay.domain.com => access only payment controller and block other url's

02 Jul
1 month ago

yafeearun left a reply on How To Get Module Url From App\Models\Account Laravel

@SNAPEY - Sorry, i tried to generate URL like

domain.com/leads/lead_id/lead_uuid
domain.com/account/account_id/account_uuid

from activities, in my DB i have

module_type : App\Models\Account   module_id : 98883
module_type : App\Models\Lead         module_id : 45232

is there any possible to generate URL by using module_type??

01 Jul
1 month ago

yafeearun started a new conversation How To Get Module Url From App\Models\Account Laravel

guys i have store class type in database i need to generate a URL from this

module_type : App\Models\Account module_id : 98883

i have stored these details in DB. is there any possible to generate account module URL from these details.

27 Jun
1 month ago

yafeearun started a new conversation Stripe Invoice Always Placed As A Draft

Hi

i tried to take payment instantly but the invoice always saved as a draft. and when i'm hiding the following condition

if($this->defaultCard()->chargeable){

payment made successfully but this condition inside library file vendor/laravel/cashier/src/Billable.php

here i add the entire function and i tried in test mode

public function invoice(array $options = [])
{
    
    if ($this->stripe_id) {
        
        $parameters = array_merge($options, ['customer' => $this->stripe_id]);

        try {
            // echo ($this->defaultCard()->chargeable) ? 'chargeable' : 'non chargeable';
            // print_r($this->defaultCard());die();
            $invoice = StripeInvoice::create($parameters, $this->getStripeKey());
            if($this->defaultCard()->chargeable){
                $invoice->pay();
            }
                // print_r($invoice);exit();
            return $invoice;         
        } catch (StripeErrorInvalidRequest $e) {
            // dd($e);
            return false;
        }
    }
    return true;
}

my stripe charge function

$account->invoiceFor($this->invoice->description, ($amount * 100), [
                //'quantity' => 50,
                //'unit_amount' => 50,
            ], [
                'tax_percent' => $this->invoice->tax_percentage,
                'billing' => 'charge_automatically',
                // 'billing' => 'send_invoice',
                // 'days_until_due' => today()->diffInDays($this->invoice->due_date),
                'auto_advance' => true,
            ]);

have to enable any option in stripe for default card ??

guys kindly help me to solve this

11 Jun
2 months ago

yafeearun started a new conversation Notify Multiple Users Or Group In Application

Hi

i have tried to notify the group of people, but i can't made it, here i shared my code ,kindly help me to short out this

namespace App\Notifications;

use Illuminate\Bus\Queueable; use Illuminate\Notifications\Notification; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage;

use App\Models\Ticket;

class TicketAssignedNotification extends Notification { use Queueable;

protected $ticket;

/**
 * Create a new notification instance.
 *
 * @return void
 */
public function __construct(Ticket $ticket)
{
    $this->ticket = $ticket;
}

/**
 * Get the notification's delivery channels.
 *
 * @param  mixed  $notifiable
 * @return array
 */
public function via($notifiable)
{
    return ['database'];
}

/**
 * Get the mail representation of the notification.
 *
 * @param  mixed  $notifiable
 * @return \Illuminate\Notifications\Messages\MailMessage
 */
public function toMail($notifiable)
{

    return (new MailMessage)
                 ->line('The introduction to the notification.')
                 ->action('Notification Action', url('/'))
                 ->line('Thank you for using our application!');
}

/**
 * Get the msg representation of the notification.
 *
 * @param  mixed  $notifiable
 * @return string
 */
public function toDatabase($notifiable)
{
    // print_r($this->ticket);die();
    return [
        'module' => 'tickets',
        'module_id' => $this->ticket->id,
        'module_uuid' => $this->ticket->uuid,
        //'message' => "Hi there, a new ticket <a routerLink=\"/tickets/{$this->ticket->id}\">#{$this->ticket->reference_no}</a> has been created",
        'message' => "Hi there, a ticket #{$this->ticket->reference_no} has been assigned to you",
    ];
}

}

it stores only one user (the assigned one ) but i have to notify the entire team

and my table structure

id char(36) COLLATE utf8mb4_unicode_ci NOT NULL, type varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, notifiable_type varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, notifiable_id bigint(20) UNSIGNED NOT NULL, data text COLLATE utf8mb4_unicode_ci NOT NULL, read_at timestamp NULL DEFAULT NULL, created_at timestamp NULL DEFAULT NULL, updated_at timestamp NULL DEFAULT NULL

21 May
3 months ago

yafeearun left a reply on Page Not Found - Except Route Proplem

@snapey @munazzil thanks guys now works fine

yafeearun left a reply on Page Not Found - Except Route Proplem

@MUNAZZIL - i have done it but it doesn't return my newly added URL's

product/getCompanyDetails
login/fb

how to fix this

yafeearun left a reply on Page Not Found - Except Route Proplem

@MUNAZZIL - i got a error

ReflectionException  : Class App\Http\Controllers\Api\BusinessModelsController does not exist

while run the command in CMD

yafeearun left a reply on Page Not Found - Except Route Proplem

@YEZAWHEIN - Hi

i have changed like

Route::post('product/getCompanyDetails', '[email protected]');

but still get same 404 status

yafeearun started a new conversation Page Not Found - Except Route Proplem

Hi

i have tried to add a url product/test without csrf token verification and i done the following steps

added route in routes

Route::post('product/test', '[email protected]');

and also added a url in app/Http/Middleware/VerifyCsrfToken.php

protected $except = [
    'webhook/stripe',  // this url works fine
         'product/test' // but this one returns 404
    ];

ProductController

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\companyDomain;
use App\Models\Lead;

class ProductsController extends Controller
{

    public function getCompanyDetails(Request $request,$id){
        $companyDomain = companyDomain::with(['lead.contact','lead.account',        'assigned_to','product','billing_account','billing_branch'])->where('id', $id)->firstOrFail();

    return $companyDomain;
}

but while i tried to call the URL i got 404 status. guys help me to solve this.. and my old URL works fine

10 May
3 months ago

yafeearun started a new conversation How To Get Accounts Which Are Have Projects

Hi

i have tried to get back the accounts which are have the projects,but accounts doesn't have the project id but invoice have account id and project id. so i mentioned the relationship like

public function invoices()
{
        return $this->hasManyThrough('App\Models\Invoice', 'App\Models\Project')->latest('due_date');
}

and i know we can get the result if we know the account id like

$account = 123
$result->with(['invoices.project'=> function($q) use ($account){
            $q->where('account_id',$account);
    }])->get()->toArray();

but i need to fetch only accounts which are have projects. let me help to short out it...

08 May
3 months ago

yafeearun left a reply on Allowed Memory Size Of 138412032 Bytes Exhausted (tried To Allocate 20480 Bytes)

@MUSHOOD - this trick not works in server.kindly suggest something to solve this issue. i'm always getting 500 error code while call the API to reassign the roles.

07 May
3 months ago
06 May
3 months ago

yafeearun started a new conversation Allowed Memory Size Of 138412032 Bytes Exhausted (tried To Allocate 20480 Bytes)

i tried to update my role permissions and i have 73 permissions and i have used https://github.com/spatie/laravel-permission#extending for role and permission .

when i try to update a role with all permissions, got Allowed memory size of 138412032 bytes exhausted (tried to allocate 20480 bytes) most of the times and some times it works well.

public function update(Request $request, $id)
{
        $this->validate($request, [
                'name' => ['required', 'string', 'max:255'],
    ]);
        $role = Role::findOrFail($id);
        $role->update($request->except(['permissions']));
        $role->syncPermissions($request->permissions);
        //event(new RoleSaved($role));
        return response()->json($role, 200);
}
29 Apr
3 months ago

yafeearun left a reply on Htmlspecialchars() Expects Parameter 1 To Be String, Object Given

@VAN1310 - i tried that sample only. without message it's works but when i pass the message it not works .

yafeearun left a reply on Htmlspecialchars() Expects Parameter 1 To Be String, Object Given

@SNAPEY - email blade

Test Email

{{ $message }}

and controller action

use App\Mail\Email;

public function TestEmail(){
      $data = ['message' => 'This is a test!'];

      \Mail::to('mail')->send(new Email($data));
}

yafeearun left a reply on Htmlspecialchars() Expects Parameter 1 To Be String, Object Given

@FORAM - thanks for your reply, but not working for me.

yafeearun started a new conversation Htmlspecialchars() Expects Parameter 1 To Be String, Object Given

Hi guys i have tried to send a mail and i write a mailable like

public function build()
    {
        $address = '[email protected]';
        $subject = 'This is a demo!';
        $name = 'Jane Doe';

        // print_r($this->data['message']);die();
        return $this->view('emails.test')
                    ->from($address, $name)
                 ->cc($address, $name)
                 ->bcc($address, $name)
                    ->replyTo($address, $name)
                 ->subject($subject)
                 ->with([ "message" => $this->data['message'] ]);
    }

even i have passed as string like ->with([ "message" => "test message"]);

but i got htmlspecialchars() expects parameter 1 to be string, object given, i tried to solve but i can't find out the exact solution. help me to solve this issue

when i tried load as a view

public function index(){
      return view('emails.test',['message' => 'This is a test!']);
}

works fine

<html lang="en-US">
    <head>
        <meta charset="utf-8">
    </head>
    <body>
        <h2>Test Email</h2>
        <p>This is a test!</p>
    </body>

yafeearun left a reply on View [emails.test] Not Found

@NAKOV - thanks for your help. and i have fixed the issue. resource folder misplaced inside the app,now placed in root and now works fine.

yafeearun left a reply on View [emails.test] Not Found

thanks for your suggestion but still i got the same error..

yafeearun left a reply on View [emails.test] Not Found

@NAKOV - Hi Nakov

i have cleared the cache and still facing the same issue

and i have stored my controller in controller/api folder.

yafeearun started a new conversation View [emails.test] Not Found

I have to tried to send a mail from API controller and i got the error "View [\emails.test] not found"

API controller

use App\Mail\Email;

public function TestEmail(){
      $data = ['message' => 'This is a test!'];
      \Mail::to('[email protected]')->send(new Email($data));
 }

Email class

return $this->view('emails.test') ->from($address, $name) ->cc($address, $name) ->bcc($address, $name) ->replyTo($address, $name) ->subject($subject) ->with([ 'message' => $this->data['message'] ]);

View location

app/resources/views/emails/test.blade.php