amrsoft

amrsoft

Member Since 1 Year Ago

Experience Points 1,570
Experience Level 1

3,430 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 1
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

03 Jul
8 months ago

amrsoft left a reply on How To Get Data From Sparkpost.com Webhook In Laravel

i found the solution

you have to use api.php , not web.php , and call it as API

Route::post('/webhook', function (Request $request) {
    
    \Log::info($request);
    return Response::json([
        'result' => true
    ], 200); // Status code here
});

and call it like this


website.com/api/webhook

20 Mar
1 year ago

amrsoft started a new conversation Change Laravel Mail Driver At Run Time For Queued Jobs

Hello all ,

i have diffract mail driver on my app

ses , and , sparkpost

sparkpost is default

i use queue to send emails so when i use

 \Config::set('mail.driver', 'ses');
 (new MailServiceProvider(app()))->register();  

queue stil send from sparkpost

i hace found this package

https://github.com/ElfSundae/laravel-multi-mail

but also developer leave this note

Changing the mail driver at runtime will not affect the driver of a queueing sending job, it is only effectual during the current app lifetime.

any help , thanks

17 Nov
1 year ago

amrsoft started a new conversation Laravel Send Emails Only From Controller On Smtp Driver

HELLO all

i have string problem ,

i have 2 mail driver on mt project , sparkpost and smtp

i use job & mail & to queue emails

if my driver = MAIL_DRIVER=sparkpost everything work fine

but if i change MAIL_DRIVER=smtp

emails only sent successful from controller ,, but other ways like queue or or even send directly from command schedule mails not arrived , so smtp conflagration 100% work

so what the problem ?

13 Nov
1 year ago

amrsoft started a new conversation How To Get Data From Sparkpost.com Webhook In Laravel

Hi gays ,

my application send emails via sparkpost smtp service ,

i need to register webhook to get message event on my application

and one can let me know how to do this in laravel

i have tried this , but fail


return response()->json(['message' => 'success'], 200);

but fail

11 Nov
1 year ago

amrsoft left a reply on User Required To Re-login If Accesses Web Site With Www

thanks for your reply

but this very strange i event try it here on laracasts.com

https://www.laracasts.com/discuss/channels/laravel/user-required-to-re-login-if-accesses-web-site-with-www

you will find the same issues

trurn back to

https://laracasts.com/discuss/channels/laravel/user-required-to-re-login-if-accesses-web-site-with-www

you're logged in back

amrsoft started a new conversation User Required To Re-login If Accesses Web Site With Www

hello all ,

i have problem i don't know normal or no ,

i have website , i user have to login before accesses content

but id user accesses my website from www.domian.com and login , everything if okay ,and session work ,

same user may redirected to via non-www request [http://domian.com] laravel request user to relogin

and if user logout from www.domian.com still login at http://domian.com

this is normal ?

thanks

09 Nov
1 year ago

amrsoft left a reply on How To Specify Mail Driver For Queued Mails ?

thanks so much for your help , but uniformly not working with queue emails , get ignored

only if emails sent directly

amrsoft started a new conversation How To Specify Mail Driver For Queued Mails ?

hello all ,

i have online application have 2 mail subscription level , free and paid ,

i need so queue all emails , but free users sent email via smtp and paid users via sparkpost

the problem that queue only send from default mail driver

any ideas

i try

\Config::set('mail.driver', $user->mail_driver);

 Mail::to($emails)->send(new GeneralMail($send,$user,$tenders,$cats,$exire_msg));

not working

27 Oct
1 year ago

amrsoft left a reply on Laravel Queue Emails In Job Table But Fail To Send

thanks for you reply

if send email directly - work fine

Mail::to($emails)->send(new CustomlMail($send,$user,$tenders,$cats));

if later , email queued , but when queue:work run , all job filed

Mail::to($emails)->later(rand(5,10),(new CustomlMail($send,$user,$tenders,$cats));

amrsoft started a new conversation Laravel Queue Emails But Attempt In Sending Them

Hello

i have schedule command works and no errors , queue emails fine

my code to send the email below

Mail::to($emails)->later(rand(5,10),(new CustomlMail($send,$user,$tenders,$cats));

CustomlMail is Mailable

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\helper;

class CustomlMail extends Mailable implements ShouldQueue
{
    use Queueable, SerializesModels;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public $send;
    public $cats;
    public $user;
    public $tenders;
    public function __construct($send,$user,$tenders,$cats)
    {
        $this->cats = $cats;
        $this->user = $user;
        $this->send = $send;
        $this->tenders = $tenders;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->view('mails.CustomMail')
                ->from('[email protected]', 'Tender Egypt')
                ->subject('subject');
    }
}

all this methods works prefect if is use

Mail::to($emails)->send(new CustomlMail($send,$user,$tenders,$cats));

to send the email directly not to queue

Mail::to($emails)->later(rand(5,10),(new CustomlMail($send,$user,$tenders,$cats));

any ideas ?

24 Jul
1 year ago

amrsoft started a new conversation How To Pass Parameter From Command To Mail And Then To View

Hello dears ,

i have to send emails by scheduled task in Larave

theres my code example

file : App\console\Command\test

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Mail;
use App\Mail\NewAccount;

class test extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'email:test';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $total = 'thisIsTotal';
        Mail::to('[email protected]', 'amr')->later(2,new NewAccount($total));
    }
}

file : App\Mail\NewAccount

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;

class NewAccount extends Mailable
{
    use Queueable, SerializesModels;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct()
    {
       //
    }

    /**
     * Build the message.
     *
     * @return $this
     */

    public function build()
    {

        return $this->view('mails.newaccount')
                ->from('[email protected]', 'tender egypt')
                -to('[email protected]', 'amr')
                ->subject("test");
    }
}

view

<h1>Woot Woot!!</h1>

<p>Alfred just found <strong>{{ $total }}lbs</strong> of kryptonite</p> 

what i need to pass $total from command to NewAccount then to view

any help

17 Jul
1 year ago

amrsoft started a new conversation How To Manage Google Contacts Via Laravel

Hello dears ,

i'm trying to manage google contacts from laravel , my own contacts not others

i have checked this package

but i can use it in laravel

can anyone assest me how to start or from where

thanks

03 Jul
1 year ago

amrsoft started a new conversation Turn Mysql Query To Laravel

Hello , i have this query , can anyone help me to make same using laravel way

thanks

SELECT `categories`.`id`,`categories`.`cat_name`,COUNT(`tenders`.`cat_id`)

FROM `categories`

left JOIN `tenders` ON `tenders`.`cat_id` = `categories`.`id`

WHERE `categories`.`active`=1

GROUP BY `categories`.`id`

06 Jun
1 year ago

amrsoft started a new conversation How To Get Sum And Count Per Page While Paginate In Laravel

Hi dears ,

i have query result 190 records from DB

so normally i use

items table

id | item | price | qty



$items = App\item::paginate(30);

return  view('items', compact('items ');


so every page have 30 rec

i need to know

sum('qty') in all pages

$items->sum('qty') -- return currant page only

in blade

@foreach ($items as $item)

 // foo

@endforeach 


$item->sum('qty')  -- return all table sum , not query 

and ideas

thanks

03 Jun
1 year ago

amrsoft started a new conversation Building Laravel Subscription System With Online And Offline Payment

Hello Dears ,

i'm working on site have free and premium subscription options ,

i need something like Laravel Casher but need to have more potion on payment like , cash , paypal , bank deposit

and account activation will be after admin review except online payment

there's any redye package can be close to this options , or i must to build it fro scratch

amrsoft left a reply on Laravel How To Select From 3 Different Tables

it work's bro , thanks so much

31 May
1 year ago

amrsoft left a reply on Laravel How To Select From 3 Different Tables

@abusalameh thank you so much for you help ,

will give it try the back to you ,,,

thanks pro,

amrsoft started a new conversation Laravel How To Select From 3 Different Tables

Hello , actually i don't know how to explain my problem but i have 3 tables

invoices , banks , currencies

invoice table fields

- id - bank_id - cash


banks table fields

- id - bank_name - currency_id


currencies table fields

- id - bank_id - currency_symbols


```

what i need to select 

invoice.id , banks.bank_name , currencies.currency_symbols

any way to join this 3 tables in one query ?

thanks 
24 May
1 year ago

amrsoft left a reply on How Select Sum From 2 Tables Group By Another Table

this works only on live server , maybe because mysql version

amrsoft left a reply on How Select Sum From 2 Tables Group By Another Table

@tekmi

thanks so much fiend you drive me where to find the solution

query actually act diffract on live server

but generally i made change on "config/database.php"

'strict' => false,

did you know if this effect the security ?

this the final query

$cash_flows = DB::select('select id,sv_name, SUM(cash_in) as cash_in_sum,SUM(cash_out) as cash_out_sum,SUM(price) as sum_price
                            from (
                               
                                select id,sv_name,0 as cash_in,0 as cash_out,0 as price
                                from supervisors
                
                                union 
                                select person_id,0 as sv_name, cash_in,cash_out,0 as price 
                                from cash_flows ts

                                union 
                                select supervisor_id,0 as sv_name,  0 as cash_in,0 as cash_out, price
                                from spduties
                            ) sc
                            where id != 0
                            group by id');

thanks so much again

amrsoft left a reply on How Select Sum From 2 Tables Group By Another Table

thanks @tekmi

but this give me duplicate result

[
{
"id": 1,
"sv_name": "0",
"cash_in_sum": 87936.15,
"cash_out_sum": 71845,
"sum_price": 3150
},
{
"id": 1,
"sv_name": "user1",
"cash_in_sum": 0,
"cash_out_sum": 0,
"sum_price": 0
},
{
"id": 2,
"sv_name": "0",
"cash_in_sum": 68740,
"cash_out_sum": 239120,
"sum_price": 0
},
{
"id": 2,
"sv_name": "user2",
"cash_in_sum": 0,
"cash_out_sum": 0,
"sum_price": 0
},
{
"id": 3,
"sv_name": "user3",
"cash_in_sum": 0,
"cash_out_sum": 0,
"sum_price": 0
},
{
"id": 4,
"sv_name": "user4",
"cash_in_sum": 0,
"cash_out_sum": 0,
"sum_price": 0
}
]

amrsoft left a reply on ID Is Displayed In Html Table As "2017" Only Instead Of "2017-1", "2017-2", Etc...

also maybe if filed id type is int maybe effect the result

amrsoft left a reply on ID Is Displayed In Html Table As "2017" Only Instead Of "2017-1", "2017-2", Etc...

i can see your code now , thanks

to be sure no mutator efect the reult user

{!! $contribution->getOriginal('id) !!}

amrsoft left a reply on ID Is Displayed In Html Table As "2017" Only Instead Of "2017-1", "2017-2", Etc...

hi , can you share your code , to be clear for us

but generally if you use {{ }} to echo try use {!! !!}

if not help try to check the model maybe mutator effect the result

hope is help

amrsoft left a reply on How Select Sum From 2 Tables Group By Another Table

thanks for your help

but what i need get result as one array

i have done this


$spduties = DB::select('select id, SUM(cash_in) as cash_in_sum,SUM(cash_out) as cash_out_sum,SUM(price) as sum_price
                            from (
                               
                                select id ,0 as cash_in,0 as cash_out,0 as price
                                from supervisors

                                union
                                select person_id,cash_in,cash_out,0 as price 
                                from cash_flows ts

                                union all
                                select supervisor_id, 0 as cash_in,0 as cash_out, price
                                from spduties
                            ) sc
                            where id != 0
                            group by id');


and get this result

[
{
"id": 1,
"cash_in_sum": 87936.15,
"cash_out_sum": 71845,
"sum_price": 3150
},
{
"id": 2,
"cash_in_sum": 68740,
"cash_out_sum": 239120,
"sum_price": 0
},
{
"id": 3,
"cash_in_sum": 0,
"cash_out_sum": 0,
"sum_price": 0
},
{
"id": 4,
"cash_in_sum": 0,
"cash_out_sum": 0,
"sum_price": 0
}
]

but the problem that i need to get user name witch call "sv_name" in supervisors table

the query have to be like this

$spduties = DB::select('select id,sv_name, SUM(cash_in) as cash_in_sum,SUM(cash_out) as cash_out_sum,SUM(price) as sum_price
                            from (
                               
                                select id ,sv_name,0 as cash_in,0 as cash_out,0 as price
                                from supervisors

                                union
                                select person_id,0 as sv_name, cash_in,cash_out,0 as price 
                                from cash_flows ts

                                union all
                                select supervisor_id,0 as sv_name,  0 as cash_in,0 as   cash_out, price
                                from spduties
                            ) sc
                            where id != 0
                            group by id');

this query run without any problem in phpmyadmin

but in query bullder i get this error


SQLSTATE[42000]: Syntax error or access violation: 1055 'sc.sv_name' isn't in GROUP BY (SQL: select id,sv_name, SUM(cash_in) as cash_in_sum,SUM(cash_out) as cash_out_sum,SUM(price) as sum_price
from (

select id ,sv_name,0 as cash_in,0 as cash_out,0 as price
from supervisors

union
select person_id,0 as sv_name, cash_in,cash_out,0 as price 
from cash_flows ts

union all
select supervisor_id,0 as sv_name, 0 as cash_in,0 as cash_out, price
from spduties
) sc
where id != 0
group by id)

any idea ?

thanks

23 May
1 year ago

amrsoft started a new conversation How Select Sum From 2 Tables Group By Another Table

Hi all

i have 3 tables

No 1 (supervises)

id| name                     
1  | user1
2 | user2       


No 1 (cash_in_out)

supervises_id | item                | cash_in       | cash_out
1           | item  1           | 40            |0
2           | item  2               | 0         |80
1           |item  3            | 10            |0


No 1 (sepnd_info)

supervises_id|  iitem_info                      | price     
1               | item info 1               | 12            
1               | item info 2           | 7         
2               | item info 3           | 22            

what is need to know

sum(cash_in_out.cash_in) sum(cash_in_out.cash_out) sum(sepnd_info.price)

gorup by supervises.id using laravel 5.4

thanks for all

18 Apr
1 year ago

amrsoft left a reply on Laravel Ajax Validation Localization - Custom Error Messages

thank you so much @AhimbisibweRoland

i'ts maybe sounds strange , i know that i have to define the key with value and i do it all the time

but i was playing around 1 hour to fix this , but i fill :D

thanks so much brother

amrsoft left a reply on Use While And Fetch_array In Laravel 5.4

do you have you'r application ready , in Laravel not only the select the problem it`s totally defiant

your main query will be

if you use DB

 $select_consoles = DB::table($INFO_GAME)->where('id_game', $id);

foreach ($select_consoles as console) {

$select_game = DB::table($console)->where('id', $console->id);
}



will be something like that , i mean you must know what is Laravel is and how MVC platform works

amrsoft started a new conversation Laravel Ajax Validation Localization - Custom Error Messages

hi every one

i just have from with two input , post request done by ajax , but my problem validation return default error messages and ignore my custom messages

here's my code , //controller

$this->validate($request,[ 'item'=>'required|max:255', 'cash'=>'required|Numeric',

    ],
    [
    'item'=>'my custom messages 1',
    'cash'=>'my custom messages 2',

    ]);

// request

$("#add_item_out").click(function() {

$('#add_out_form').ajaxSubmit({
    type: "POST",
    url: "{{ route('addnew')}}",
    data: $('#add_out_form').serialize(),
    cache: false,
    success: function(html)
  {
   // do e.g
  } ,
  error: function (jqXhr) {
    $errors = jqXhr.responseJSON; //this will get the errors response data.
    //show them somewhere in the markup
    //e.g
    errorsHtml = '<div class="alert alert-danger"><ul>';

    $.each( $errors, function( key, value ) {
        errorsHtml += '<li>' + value[0] + '</li>'; //showing only the first error.
    });
    errorsHtml += '</ul></di>';
        
    $( '.msg-div' ).html( errorsHtml ); 

        }
});

});

output error The item field is required. The cash field is required.

have to be my custom messages 1 my custom messages 2

any advice ?