Buy your loved one the ultimate gift. Lifetime gift certificates are $100 off.

nizam0786

Experience

13,830

0 Best Reply Awards

  • Member Since 1 Year Ago
  • 125 Lessons Completed
  • 0 Favorites

20th November, 2017

nizam0786 left a reply on Has Many Relationships Help. • 3 weeks ago

????

nizam0786 left a reply on Has Many Relationships Help. • 3 weeks ago

apart from the foreign key in the above relationship I haven't adjusted anywhere else.... is there somewhere else where it needs adjusting?

nizam0786 left a reply on Has Many Relationships Help. • 3 weeks ago

I just added gtcPasses_ID as a third parameter.

nizam0786 left a reply on Has Many Relationships Help. • 3 weeks ago

where and how would I adjust the foreign key?

nizam0786 left a reply on Has Many Relationships Help. • 3 weeks ago

Still returning the same error?

nizam0786 left a reply on Has Many Relationships Help. • 3 weeks ago

Thank you, will give it a go and let you know.

nizam0786 left a reply on Has Many Relationships Help. • 3 weeks ago

Any idea?

nizam0786 left a reply on Has Many Relationships Help. • 3 weeks ago

Here are the columns belonging to the PassProcess Model

'gtcPassesProcess_ID',
        'gtcPassesProcess_gtcPasses_ID',
        'gtcPassesProcess_Count',
        'gtcPassesProcess_DateQueued',
        'gtcPassesProcess_Reason_ID',
        'gtcPassesProcess_QueuerUsers_ID',
        'gtcPassesProcess_AuthorisorUsers_ID',
        'gtcPassesProcess_Authorised',
        'gtcPassesProcess_Status',
        'gtcPassesProcess_gtcPaymentMethods_ID',
        'gtcPassesProcess_Charge',
        'gtcPassesProcess_DateAuthorised',
        'gtcPassesProcess_PassSerialNumber',

Here are the columns belonging to the PassModel

'gtcPasses_ID',
        'gtcPasses_gtcAcademicYears_ID',
        'gtcPasses_gtcTraveler_ID',
        'gtcPasses_gtcSchools_ID',
        'gtcPasses_gtcSchoolGroups_ID',
        'gtcPasses_gtcBusRoutes_ID',
        'gtcPasses_gtcPassType_ID',
        'gtcPasses_BusPassCover',
        'gtcPasses_PassPrice',
        'gtcPasses_OptionsPrice',
        'gtcPasses_SiblingDiscount',
        'gtcPasses_Yr1113Discount',
        'gtcPasses_EarlyAppDiscount',
        'gtcPasses_OtherDiscount',
        'gtcPasses_Deleted',
        'gtcPasses_QueuedTotal',
        'gtcPasses_ProcessedTotal',
        'gtcPasses_ThirdPartyPayment',
        'gtcPasses_Photo',
        'gtcPasses_ThirdParty'

nizam0786 left a reply on Has Many Relationships Help. • 3 weeks ago

which columns would you like to see?

nizam0786 started a new conversation Has Many Relationships Help. • 3 weeks ago

Hi guys,

I am trying to setup a has many relationship but just a bit confused. Everything was working until I changed my database names and also in the model.

Before I would call the following $pass->process and I could loop through all the processes belonging to the pass now its returning an error exception 'Property [process] does not exist on this collection instance.'

Pass Model.

 protected $primaryKey = 'gtcPasses_ID';

public function process() { return $this->hasMany('App\Models\PassProcess', 'gtcPassesProcess_gtcPasses_ID'); }

PassProcess Model:

protected $primaryKey = 'gtcPassesProcess_ID';

public function pass() { return $this->belongsTo('App\Models\Pass', 'gtcPassesProcess_gtcPasses_ID'); }

the code above is the primary keys for each model and the relationship could someone please check it and help. Thanks

7th November, 2017

nizam0786 left a reply on Changing Name Of Users Table And Username. • 1 month ago

I just want to basically rename the username and password columns and still have auth login etc working.

nizam0786 left a reply on Changing Name Of Users Table And Username. • 1 month ago

I changed the username its working now but don't know how to tell the loginController to validate gtPassword instead of password.

nizam0786 started a new conversation Changing Name Of Users Table And Username. • 1 month ago

Hi guys,

I am trying to login after changing the name of the users table etc... and it cannot find the username column. (I had it working so that the username was used instead of email when logging in)

I changed the users table name to ApplicationUsers and the username column to gtUsername.

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'username'

I have added the following accessor:

public function getUsernameAttribute() { return $this->attributes['gtUsername']; }

still no luck any suggestions?

Thanks

31st October, 2017

nizam0786 left a reply on Model 'Fillable Fields' Can They Be Named Something Other Than Whats In The Database. • 1 month ago

Thank you @mushood will let you know if it works.

nizam0786 left a reply on Model 'Fillable Fields' Can They Be Named Something Other Than Whats In The Database. • 1 month ago

No, it doesn't seem to work any way i can do something like that?

nizam0786 left a reply on Model 'Fillable Fields' Can They Be Named Something Other Than Whats In The Database. • 1 month ago

@matt_panton thanks for the reply I will just have to test it I suppose.

nizam0786 left a reply on Model 'Fillable Fields' Can They Be Named Something Other Than Whats In The Database. • 1 month ago

@tisuchi thanks for your reply, I mean I want it to remian the same in the database but different in the models and code etc...

nizam0786 started a new conversation Model 'Fillable Fields' Can They Be Named Something Other Than Whats In The Database. • 1 month ago

Hi guys,

I want to know if I can rename fillabable fields to something more easier to read than the column name e.g. I want to change gtcAreas to areas.

would this work?

<code class"hjls php">

protected $fillable = [

'gtcAreas' => 'areas',

]

nizam0786 left a reply on Mattwebsite Excel Csv Import Was Working But Not Anymore? • 1 month ago

@36864 and @mushood I figured out what the issue was I had implemented a queue driver (database) that is why it was return successful all the time it was just queuing it up and not actually doing it as the queue worked was not running.

Thanks for your help much appreciated.

nizam0786 left a reply on Mattwebsite Excel Csv Import Was Working But Not Anymore? • 1 month ago

Below is the form I use.

<form action="{{ URL::to('importAreas') }}" class="form-horizontal" method="POST"
      enctype="multipart/form-data">
    {{ csrf_field() }}
    <h4>Import areas table</h4>

    <input type="file" name="import_file"/>
    <br>
    <button  class="btn btn-primary">Import File</button>
</form>

nizam0786 left a reply on Mattwebsite Excel Csv Import Was Working But Not Anymore? • 1 month ago

Its nothing to do with the database is it? I am using sql and copied of the tables etc...

nizam0786 left a reply on Mattwebsite Excel Csv Import Was Working But Not Anymore? • 1 month ago

its detects the file but just not reading or righting it which is very annoying especially when it was working before.

All I remember doing was reinstall wamp.

I have uninstalled and reinstalled mattwebsite/excel and looked at the code everything seems fine but not sure which its not working on local or live.

nizam0786 left a reply on Mattwebsite Excel Csv Import Was Working But Not Anymore? • 1 month ago

its detects the file but just not reading or righting it which is very annoying especially when it was working before.

All I remember doing was reinstall wamp.

nizam0786 left a reply on Mattwebsite Excel Csv Import Was Working But Not Anymore? • 1 month ago

I uploaded and hosted the website on plesk and same problem so I assume its not wamp then. :(

nizam0786 left a reply on Mattwebsite Excel Csv Import Was Working But Not Anymore? • 1 month ago

No I didn't copy them over, I still have the old wamp files and can try that.

C:\wamp64\bin\apache\apache2.4.27\bin

this is the path right for the php.ini file?

there is a symlink file called php is that it?

nizam0786 left a reply on Mattwebsite Excel Csv Import Was Working But Not Anymore? • 1 month ago

@mushood actually I don't have php_xml and php_zip they aren't even in the list.

nizam0786 left a reply on Mattwebsite Excel Csv Import Was Working But Not Anymore? • 1 month ago

@mushood I seem to have all the requirements but I think @36864 has a point but not sure where to look as I am not the most experienced when it comes to wamp etc...

nizam0786 left a reply on Mattwebsite Excel Csv Import Was Working But Not Anymore? • 1 month ago

@36864 thanks for the reply.

the required modules are selected but not sure where to check the directory permissions etc...

nizam0786 left a reply on Mattwebsite Excel Csv Import Was Working But Not Anymore? • 1 month ago

thank you will check it out and let you know.

nizam0786 left a reply on Mattwebsite Excel Csv Import Was Working But Not Anymore? • 1 month ago

I already have:

in composer.json require:

"maatwebsite/excel": "~2.1.0",

application service provider:

Maatwebsite\Excel\ExcelServiceProvider::class,

aliases:

'Excel' => Maatwebsite\Excel\Facades\Excel::class,

nizam0786 left a reply on Mattwebsite Excel Csv Import Was Working But Not Anymore? • 1 month ago

@mushood how will I know if there any libraries missing? do you mean the composer.json file etc...

nizam0786 left a reply on Mattwebsite Excel Csv Import Was Working But Not Anymore? • 1 month ago

Hi @mushood thanks for the reply, no I don't get any error messages, ok I will have a look in the php.ini

nizam0786 started a new conversation Mattwebsite Excel Csv Import Was Working But Not Anymore? • 1 month ago

Hi guys,

I am very confused at the moment, I had code which was working fine which allowed me to import csv file to the database.

But it does not seem to work anymore and I am not sure why.

This is the the method in the controller

if (Input::hasFile('import_file'))
    {
        $path = Input::file('import_file')->getRealPath();

        Excel::filter('chunk')->load($path)->chunk(250,
            function ($results)
            {
                foreach ($results as $row)
                {
                    //column names have to be lower case to work.
                    DB::table('areas')->insert([
                        'id' => $row->gtcareas_id,
                        'name' => $row->gtcareas_name,
                    ]);
                }
            });

I reinstalled wamp would that have caused any issues?

26th October, 2017

nizam0786 left a reply on Emailing In Bulk • 1 month ago

I decided to use Queues and just used the database version as there are not many emails being sent, works fine.

Thanks guys.

23rd October, 2017

nizam0786 left a reply on Emailing In Bulk • 1 month ago

@Thyrosis @Nash thanks for your advice and help i will look into both and will let you know which I go for.

thanks.

19th October, 2017

nizam0786 left a reply on How Can I Modify The Selected Data. (ModelName::Select) • 1 month ago

@ftrillo thank you for you reply I managed to do it another way. I looped through each object and set the fields as how I wanted them and then merged them with a new collection which I then outputted in the excel sheet.

nizam0786 started a new conversation Emailing In Bulk • 1 month ago

Just want to know the advantages and disadvantages of using something like mailchimp, mandrill etc... rather than doing the following below.


$emails = ['email1@test.com', 'email2@test.com', 'email3@test.com'];

    $subject = 'This is just a test';
    $message = 'This is an email send form communication center';

    
    foreach ($emails as $email){
        Mail::to($email)
            ->send(new CommunicationEmail($subject, $message));
    }

The variable $emails will have more than a thousand emails to loop through at times, is this the way to do it, or is there a better way.

Thanks in advance.

5th October, 2017

nizam0786 left a reply on Where In Pivot The Boolean Field Is Set To True. • 2 months ago

Do you know anyway of checking the pivot in a query? so if I was to add the check in the actual code I have included in my question how would I do it?

thanks,

nizam0786 left a reply on Where In Pivot The Boolean Field Is Set To True. • 2 months ago

@Parasoul Thanks that is what I was missing.

nizam0786 left a reply on Where In Pivot The Boolean Field Is Set To True. • 2 months ago

there is a table called 'travellers_contacts' a traveller can have a primary contact or a secondary contact therefore, the filed 'is_primary_contact' exists.

I need to get all the emails address of the primary contacts.

then in future I would also get all the email address of the secondary contacts.

So I can bulk email them separately.

nizam0786 left a reply on Where In Pivot The Boolean Field Is Set To True. • 2 months ago

Email is just a field where the email address is stored.

what I am trying to do is get all the emails address of the contacts who have an email address.

but only the contacts who are a primary contact, I hope that makes sense.

appreciate your help.

nizam0786 started a new conversation Where In Pivot The Boolean Field Is Set To True. • 2 months ago

Hi guys,

I am trying to get a emails from a collection of contacts but I only want to get the emails of the contacts who are primary contacts which is a Boolean field set in a pivot table.

the code below is what I have been trying to do but I am stuck and need help. any ideas?


$primaryContactEmails = Contact::where('email', '!=', null)->wherePivot('is_primary_contact', true)->pluck('email');

thanks in advance.

4th October, 2017

nizam0786 started a new conversation How Can I Modify The Selected Data. (ModelName::Select) • 2 months ago

What I am trying to achieve is output the data in the correct format so I can create an excel sheet showing the correct format of data using phpoffice/excel.

at the moment the data is being outputted exactly as it is in the database which is not what I want.

below is the select statement, please could someone show me the best way of modifying the data.


$travellers = Traveller::select([
            'id',
            'traveller_id',
            'firstName',
            'surname',
            'dateOfBirth',
            'homePhone',
            'mobileNumber',
            'updated_at'
        ])->when($request->old('year'), function ($query) use ($request)
        {
            return $query->where('academicYear_id', $request->old('year'));
        })
            ->when($request->old('gender'), function ($query) use ($request)
            {
                return $query->where('sex', $request->old('gender'));
            })
            ->when($request->old('school'), function ($query) use ($request)
            {
                $query->has('passes.school')->whereHas('passes.school', function ($query) use ($request)
                {
                    $query->where('id', $request->old('school'));
                });
            })->get();

I am trying to modify the date so it can be outputted in the carbon format ('d/m/Y').

3rd October, 2017

nizam0786 left a reply on Best Way Of Performing Eloquent Query When Request Exists And Has A Relationship Matching The Request. • 2 months ago

I have speeded it up by modifying it to:


$users = Travellers::select([ 'id', 'firstname', 'surname', 'updated_at' ])->when($request->has('school'), function ($query) use ($request) { $query->has('passes.school')->whereHas('passes.school', function ($query) use ($request) { $query->where('id', $request->get('school')); } }); });

nizam0786 started a new conversation Eloquent Query With ->when($request->has('')) And ->has('') • 2 months ago

Hi guys,

I am trying to perform a query when a request exists but its quite slow to load so wanted to know if there was a better and quicker way of doing it.


$users = Travellers::select([ 'id', 'firstname', 'surname', 'updated_at' ])->when($request->has('school'), function ($query) use ($request) { $query->has('passes.school')->whereHas('passes', function ($query) use ($request) { $query->where('school_id', $request->get('school')); } }); });

Thanks in advance.

nizam0786 left a reply on Laravel Fastsms.co.uk Integration? • 2 months ago

@m165437 Thank you.

28th September, 2017

nizam0786 started a new conversation Fastsms Integration? • 2 months ago

Hi guys,

has anyone integrated fastsms with laravel if yes could you please help and guide me.

Thanks in advance.

nizam0786 left a reply on Laravel Model Permanently Deleting Model(Events) • 2 months ago

Found a solution, All working now. :)


static::deleted(function($passes){

if($passes->isForceDeleting()) { $passes->process()->forceDelete(); } });

nizam0786 started a new conversation Laravel Model Soft Deleting, Restoring And Permanently Deleting Models. • 2 months ago

Hi,

I am trying to add some code when soft deleting a model it also soft deletes all related models. I have managed to do that using:


public static function boot()

staic::deleting(function($passes)) {

However, I don't know how to do the restoring and permanently delete functions.

Thanks in advance.

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.