muazzamazaz

Experience

2,070

0 Best Reply Awards

  • Member Since 5 Months Ago
  • 0 Lessons Completed
  • 0 Favorites

9th January, 2018

muazzamazaz started a new conversation MethodNotAllowedHttpException • 1 month ago

  {!! Form::open(['url' => 'ContractUpdate', 'files' => true, 'class' => 'form-horizontal']) !!}

Route::get('ContractUpdate','[email protected]');

what could be wrong with form URL?

20th December, 2017

muazzamazaz left a reply on Undefined Variable: Newsletter • 2 months ago

@Robstar I am not using Snapey code because of this error above. I am following @bobbybouwmann code

muazzamazaz left a reply on Undefined Variable: Newsletter • 2 months ago

@bobbybouwmann error comes when I insert form without checkbox marked

muazzamazaz left a reply on Undefined Variable: Newsletter • 2 months ago

@snapy

it gives me error when I put your code

Type error: Argument 1 passed to App\Http\Controllers\Auth\RegisterController::create() must be an instance of App\Http\Controllers\Auth\Request, array given, called in E:\xampp\htdocs\easyware\vendor\laravel\framework\src\Illuminate\Foundation\Auth\RegistersUsers.php on line 33

19th December, 2017

muazzamazaz left a reply on Undefined Variable: Newsletter • 2 months ago

@Robstar

The modified code is

return User::create([
        'name' => $data['name'],
        'email' => $data['email'],
        'password' => bcrypt($data['password']),
        'newsletter' => $data['newsletter'],
    ]);

it still show error > undefined variable

muazzamazaz left a reply on Undefined Variable: Newsletter • 2 months ago

@bobbybouwmann I mean when I replaced code as below it still showing

undefiend variable 'newsletter'

return User::create([
        'name' => $data['name'],
        'email' => $data['email'],
        'password' => bcrypt($data['password']),
        'newsletter' => $data['newsletter'],
    ]);

18th December, 2017

muazzamazaz left a reply on Undefined Variable: Newsletter • 2 months ago

@bobbybouwmann still same issue

17th December, 2017

muazzamazaz started a new conversation Undefined Variable: Newsletter • 2 months ago

                                <div class="form-check abc-checkbox">
<input class="form-check-input" id="checkbox2" type="checkbox" name="newsletter" {{ old('newsletter') ? 'checked' : '' }} value=1>
<label class="form-check-label" for="checkbox2">
 Email me newsletters
</label>

class User extends Authenticatable { use Notifiable;

/**
 * The attributes that are mass assignable.
 *
 * @var array
 */
protected $fillable = [
   // 'name', 'email', 'password',
   'name', 'email', 'password', 'provider', 'provider_id','newsletter'
]

class RegisterController extends Controller { ...... protected function validator(array $data) { return Validator::make($data, [ 'name' => 'required|string|max:255', 'email' => 'required|string|email|max:255|unique:users', 'password' => 'required|string|min:6|confirmed', 'newsletter' => 'required', ]); }

/**
 * Create a new user instance after a valid registration.
 *
 * @param  array  $data
 * @return \App\User
 */
protected function create(array $data)
{   
    
    return User::create([
        'name' => $data['name'],
        'email' => $data['email'],
        'password' => bcrypt($data['password']),
        'newsletter' => $newsletter 
    ]);
    
$user = User::create($request->all());
    $mailer->sendEmailConfirmationTo($user);
    flash('Please confirm your email address.');
    return redirect()->back();
}

25th November, 2017

muazzamazaz left a reply on Undefined Variable Template2 V5.2 • 2 months ago

@tisuchi I have tried both but not working while same is working on laravel 5.4

22nd November, 2017

muazzamazaz left a reply on Undefined Variable Template2 V5.2 • 3 months ago

muazzamazaz left a reply on Undefined Variable Template2 V5.2 • 3 months ago

@tisuchi I have tried both but not working while same is working on laravel 5.4

21st November, 2017

muazzamazaz started a new conversation Undefined Variable Template2 V5.2 • 3 months ago

$result = User::where("device_token", "!=", "")->where("device_type", "!=", "")->get();
        $template2 = DB::table('notification_templates')->get();
        return view('admin.push_notifications', compact('result','template2'))->withPage('push_notifications')->with('sub_page', 'view-push_notifications');

view

@if(($template2))
                            @foreach($template2 as $taken)
                              
                     {{ $taken->title }}
                             
                            @endforeach
                            @endif

20th November, 2017

muazzamazaz left a reply on Undefined Variable: Template (View:... • 3 months ago

@tisuchi view code is

@foreach($template as $taken)
                              
                            {{ $taken->title }}
                             
                            @endforeach

muazzamazaz left a reply on Undefined Variable: Template (View:... • 3 months ago

@tisuchi Can you add code here where everything with with

muazzamazaz left a reply on Undefined Variable: Template (View:... • 3 months ago

@tisuchi if I use $template2 then it also show error.

muazzamazaz started a new conversation Undefined Variable: Template (View:... • 3 months ago

$result = User::where("device_token", "!=", "")->where("device_type", "!=", "")->get();
        $template = DB::table('notification_templates')->get();
        return view('admin.push_notifications', compact('result','template'))->withPage('push_notifications')->with('sub_page', 'view-push_notifications');


 @foreach($template as $taken)
                              
                            {{ $taken->title }}
                             
                            @endforeach

15th November, 2017

muazzamazaz started a new conversation No Users Found • 3 months ago

I have table users with two records but following code not getting it

use App\Helpers\Helper;
use App\Http\Controllers\Controller;
use App\User;
use App\UserRating;
use Hash;
use Illuminate\Http\Request;
use Validator;
use App\Requests;

class UserController extends Controller
{


    public function users()
    {
        $user = User::orderBy('created_at', 'desc')->get();

        return view('admin.users')->withPage('users')->with('sub_page', 'view-user')->with('users', $user);
    }

....
<?php

namespace App;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Database\Eloquent\SoftDeletes;

class User extends Authenticatable
{
    use SoftDeletes;
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];
    
    /**
     * Fetch the list of recent users by creation date
     * 
     * @return User
     */
    private function fetchRecentUsers()
    {
       
        return $this->orderBy('created_at' , 'desc')->get();
    }
    
    /**
     * Returns a list of recent users by creation date
     * 
     * @return mixed
     */
    public static function getRecentUsers()
    {
        $user = new User();
        return $user->fetchRecentUsers();
    }
}

13th November, 2017

muazzamazaz started a new conversation Select Option Property Not Working • 3 months ago

<select name="notificationtype" required class="form-control">
    <option value="sms" @if($template->type=='sms') "selected=true" else "selected=false" @endif > SMS </option>
    <option value="email" @if($template->type=='email') "selected=true" else "selected=false" @endif > Email </option> 
</select>

11th November, 2017

muazzamazaz left a reply on Call To A Member Function GetUpdatedTemplate() On Null • 3 months ago

@Snapey after change it shows

No query results for model [App\Notification_Template].

muazzamazaz left a reply on Call To A Member Function GetUpdatedTemplate() On Null • 3 months ago

@andonovn

CREATE TABLE `notification_templates` (
  `id` int(11) NOT NULL,
  `type` varchar(20) NOT NULL,
  `title` varchar(200) NOT NULL,
  `email_subject` varchar(500) NOT NULL,
  `message` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

9th November, 2017

muazzamazaz started a new conversation Call To A Member Function Save() On Null • 3 months ago

    public function Save_Template(Request $request)
    {
        $templateValidation = new Notification_Template();
        $validator       = $templateValidation->getValidatedData($request);
        $template           = Notification_Template::find($request->id);

        if ($validator->fails()) {
            $error_messages = implode(',', $validator->messages()->all());
            return back()->with('flash_errors', $error_messages);
        } else {
            $template->getUpdatedTemplate($template, $request);
          
            $template->save();

            return back()->with('flash_success', Helper::tr('admin_not_profile'));
        }
    }

at above $template->save(); error throws:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;
use Validator;

/**
 * Responsible for the Admin user
 */
class Notification_Template extends Model
{
    /**
     * Pass the data through the Laravel validator
     * 
     * @param Request $request
     * @return mixed
     */
     public function setUp() {
    parent::setUp();
    // Your code here
}
     protected $table = 'notification_templates';
     protected $guarded = ['Id'];
    protected function passDataThroughValidator(Request $request)
    {
        
           return Validator::make($request->all(), array(
                    'type' => 'max:20',
                    'email_subject' => 'max:300',                    
                    'nessage' => 'max:1000',
                    'title' => 'max:100',                   
                        )
        );
    }
    
    /**
     * Return the updated data after validation
     * 
     * @param Request $request
     * @return mixed
     */

    public function getValidatedData(Request $request)
    {
        return $this->passDataThroughValidator($request);
    }
    
    /**
     * Update the admin profile information
     * 
     * @param \App\Admin $admin
     * @param Request $request
     * @return \App\Admin
     */
    private function updateTemplate(Notification_Template $template, Request $request)
    {
        $template->type = $request->has('type') ? $request->type : $Template->type;
        $template->title = $request->has('title') ? $request->title : $Template->title;
        $Template->email_subject = $request->has('email_subject') ? $request->email_subject : $template->email_subject;
        $Template->message = $request->has('message') ? $request->message : $template->message;
        
        return $template;
    }
  
  private function savetemplateProfile(Notification_Template $template, Request $request)
    {
         $template->type = $request->has('type') ? $request->type : $Template->type;
        $template->title = $request->has('title') ? $request->title : $Template->title;
        $Template->email_subject = $request->has('email_subject') ? $request->email_subject : $template->email_subject;
        $Template->message = $request->has('message') ? $request->message : $template->message;
        
        return $template;
    }
    
    /**
     * Return the updated template profile information
     * 
     * @param \App\template $template
     * @param Request $request
     * @return mixed
     */

     public function getUpdatedtemplate(Notification_Template $template, Request $request)
    {
        return $this->updatetemplate($template, $request);
    }
    
     public function getSavetemplate(Notification_Template $template, Request $request)
    {
        return $this->savetemplate($template, $request);
    }
}

26th October, 2017

muazzamazaz left a reply on Trying To Get Property Of Non-object Error On Db View • 3 months ago

@RamjithAp returning it as

return view('user', compact('top_revenue_users'))
                        ->withPage('user');```

muazzamazaz left a reply on Trying To Get Property Of Non-object Error On Db View • 3 months ago

@Snapey it getting rows from view

muazzamazaz started a new conversation Trying To Get Property Of Non-object Error On Db View • 3 months ago

Getting db view results but error of non-object while view contains rows

$top_revenue_users = DB::table('user_requests')->orderBy('total', 'desc')->take(3);

ody>   
    @foreach ($top_revenue_users as $rc2)
    <tr>
    <td>{{$rc2->first_name}}</td>
    <td>{{$rc2->last_name}}</td>
    <td>{{$rc2->email}}</td>
    
    @endforeach
``

> Trying to get property of non-object 

24th October, 2017

muazzamazaz started a new conversation SyntaxError: Missing : After Property Id • 3 months ago

I have write the following code

 var geocoder =  new google.maps.Geocoder();
 
     var map;
     var markers = [
         @foreach($locationList as $location)
         {
             location_id: "{{ $location->id }}",
             geocoder.geocode( { 'address': "{{ $location->city }}"}, function(results, status) {
           if (status == google.maps.GeocoderStatus.OK) { 
           lat: results[0].geometry.location.lat(),
            lng: results[0].geometry.location.lng(),
           }
         }
         });
             
             
         },
         @endforeach
     ];

But it give me error

SyntaxError: missing : after property id

21st October, 2017

muazzamazaz started a new conversation Softdeletes Not Working • 4 months ago


use Illuminate\Database\Eloquent\SoftDeletes;
class UserController extends Controller
{
use SoftDeletes;


   public function delete_user(Request $request)
    {

        if ($user = User::find($request->id)) {

            $user = User::destroy($request->id);
        }

...

deletes row from table instead of updating delete_at column that exists there.

19th October, 2017

muazzamazaz started a new conversation Method [validate] Does Not Exist. • 4 months ago

namespace App\Http\Controllers;
use App\ContactUS;
use Illuminate\Http\Request;
use App\Http\Requests;
use validator;
use Illuminate\Routing\Controller as BaseController;
class ContactUSController extends BaseController
{
public function contactUS(){
return view('CityOfWorks.ContactUS');
}
public function contactUSPost(Request $request){

$this->validate($request, ['name' => 'required','email' => 'required|email','message' => 'required']);

ContactUS::create($request->all());

return back()->with('success', 'Thanks for contacting us!');
}
}

16th October, 2017

muazzamazaz started a new conversation Class 'app\Location' Not Found • 4 months ago

calling class here in controller:

use app/Location;

....


$validator = Location::getValidatedData($request);

in app folder I have class file Location with class and above function as:

namespace App\Admin;

use Illuminate\Database\Eloquent\Model;
use Symfony\Component\HttpFoundation\Request;
use Validator;

class Location extends Model
{
    public static function getValidatedData(Request $request)
    {
        $data = new Location();
        return $data->passDataThroughValidator($request);
    }
}

2nd October, 2017

muazzamazaz left a reply on Selected Option Not Working • 4 months ago

@Snapey I have confirmed that value is there. May be some trailing spaces caused it

1st October, 2017

muazzamazaz started a new conversation Selected Option Not Working • 4 months ago

I am getting selected option from db as

@foreach($admins as $index => $admin)
                  <tr>
                   
                      <td>
                      <Select name="region" class="form-control" id="region" placeholder="Region">
                                  <Option value="AS" @if ($admin->region == 'AS')  selected = "selected" @endif >Asia</option>
                                  <option value="ME" @if ($admin->region == 'ME')  selected = "selected" @endif >Middle East</option>
                                  <option value="EU" @if ($admin->region == 'EU')  selected = "selected" @endif >Europe</option>
                                  </select>
                                  </td>
@endforeach

but not showing selected option

26th September, 2017

muazzamazaz started a new conversation Route Link Parameter Error 5.4 • 4 months ago

I have following route defined with parameter

Route::get('paywithpaypal/{amount}', array('as' => 'addmoney.paywithpaypal','uses' => '[email protected]',));

when I try to get it via

return Redirect::route('paywithpaypal/1');

it through error

Route [paywithpaypal/1] not defined.

24th September, 2017

muazzamazaz left a reply on Password Reset Link Not Working 5.2 • 4 months ago

<form class="form-layout" role="form" method="POST" action="{{ url('/admin/password/email') }}">

muazzamazaz started a new conversation Password Reset Link Not Working 5.2 • 4 months ago

Route::post('password/email', 'Auth\[email protected]');

Route is not working and throughs error:

Route [user.dashboard] not defined.

class AdminPasswordController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Password Reset Controller
    |--------------------------------------------------------------------------
    |
    | This controller is responsible for handling password reset requests
    | and uses a simple trait to include this behavior. You're free to
    | explore this trait and override any methods you wish to tweak.
    |
    */

    use ResetsPasswords;

    /**
     * Where to redirect users after successful change of password.
     *
     * @var string
     */

    protected $guard = 'admin';

    protected $broker = 'admins';

    protected $redirectTo = '/admin';

    /**
     * The password reset request view that should be used.
     *
     * @var string
     */

    protected $linkRequestView = 'admin.auth.passwords.email';

    /**
     * The password reset view that should be used.
     *
     * @var string
     */

    protected $resetView = 'admin.auth.passwords.reset';

    /**
     * Create a new password controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest');
    }
}


23rd September, 2017

muazzamazaz left a reply on Call To A Member Function SaveAdminProfile() On Null • 4 months ago

@rebirthtobi

How to encrypt password field using create method and via hash

hass::make

22nd September, 2017

muazzamazaz left a reply on Call To A Member Function SaveAdminProfile() On Null • 5 months ago

@rebirthtobi but id field is Auto increment in table

21st September, 2017

muazzamazaz left a reply on Parse Error: Syntax Error, Unexpected '<' • 5 months ago

@tykus

I am passing parameter value as url and getting values accordingly but now want to pass it as hidden element for further post into db

muazzamazaz left a reply on Parse Error: Syntax Error, Unexpected '<' • 5 months ago

@tykus

{{ Route::current()->parameter('JobId')}}

I need this value as hidden field

muazzamazaz left a reply on Parse Error: Syntax Error, Unexpected '<' • 5 months ago

Same error for

@if ({{$applied}} <= {{$limit}})
                
                {!! Form::submit('Post',['class' => 'btn btn-lg btn-info'] ) !!}
                @else
                
                {!! Form::submit('Post', array('disabled'),['class' => 'btn btn-lg btn-info'] ) !!}
                @endif```

muazzamazaz started a new conversation Parse Error: Syntax Error, Unexpected '<' • 5 months ago

How to show url parameter in form element

{!! Form::hidden('JobId', $value = {{ Route::current()->parameter('JobId')}}!!}


muazzamazaz left a reply on Route [JobApplication/1] Not Defined. 5.4 • 5 months ago

@bashy

Route::get('JobApplication/{JobId}','[email protected]');
Route::post('application/','[email protected]');

in controller value is null;

$JobId  = Input::get('JobId') ; 

muazzamazaz left a reply on Call To A Member Function SaveAdminProfile() On Null • 5 months ago

@rebirthtobi

it gives now

MassAssignmentException in Model.php line 452: id

muazzamazaz left a reply on Route [JobApplication/1] Not Defined. 5.4 • 5 months ago

But I want to know how to access this parameter value in controller

$request->input('JobId'); shows null

muazzamazaz left a reply on Route [JobApplication/1] Not Defined. 5.4 • 5 months ago

{{ URL::to('JobApplication/'.$ajobs->id) }}

resolved the issue.

20th September, 2017

muazzamazaz left a reply on Call To A Member Function SaveAdminProfile() On Null • 5 months ago

@sutherland why I need id as its inserting into table with auto increment id field

muazzamazaz started a new conversation Route [JobApplication/1] Not Defined. 5.4 • 5 months ago

Route::get('JobApplication/{id}','[email protected]');

    <a href="{{ route('JobApplication/'.$ajobs->id) }}" class="jobs_title">{{ $ajobs->jobtitle }} </a>
                    

muazzamazaz started a new conversation Call To A Member Function SaveAdminProfile() On Null • 5 months ago


public function profile_save(Request $request)
    {
        $adminValidation = new Admin();
        $validator       = $adminValidation->getValidatedData($request);
        $admin           = Admin::find($request->id);

        if ($validator->fails()) {
            $error_messages = implode(',', $validator->messages()->all());
            return back()->with('flash_errors', $error_messages);
        } else {
            $admin->saveAdminProfile($admin, $request);
            
            $admin->remember_token = Helper::generate_token();
            $admin->is_activated   = 1;
            $admin->save();

            if ($request->hasFile('picture')) {
                $admin->deleteProfilePicture($admin->picture);
                $admin->picture = $admin->updateProfilePicture($request->picture);
            }
            return back()->with('flash_success', Helper::tr('admin_not_profile'));
        }
    }

  private function saveAdminProfile(Admin $admin, Request $request)
    {
        
        $admin->email = $request->has('email') ? $request->email : $admin->email;
        $admin->mobile = $request->has('mobile') ? $request->mobile : $admin->mobile;
        $admin->region = $request->has('region') ? $request->region : $admin->region;
        $admin->country = $request->has('country') ? $request->country : $admin->country;
        $admin->reg = $request->has('reg') ? $request->reg : $admin->reg;
        $admin->incharge = $request->has('incharge') ? $request->incharge : $admin->incharge;
        
        $admin->stripe = $request->has('stripe') ? $request->stripe : $admin->stripe;
        $admin->paypal = $request->has('paypal') ? $request->paypal : $admin->paypal;
        $admin->braintree = $request->has('braintree') ? $request->braintree : $admin->braintree;
        $admin->cash = $request->has('cash') ? $request->cash : $admin->cash;
        $admin->ewallet = $request->has('ewallet') ? $request->ewallet : $admin->ewallet;
        $admin->other = $request->has('other') ? $request->other : $admin->other;
        
        var_dump ($admin);
        
        return $admin;
    }

14th September, 2017

muazzamazaz started a new conversation Inside Laravel Helper Twilio Funcion Env() Function Not Working • 5 months ago

In laravel 5.2 helper file the env() function not getting values. If I put value directly then it works. Also tried getenv() function but no success.

   public static function send_twilio_sms($phone, $message)
   {
        $sid = env('TWILIO_SID');
        $token = env('TWILIO_TOKEN');
        $client = new Client($sid, $token);

        $client->messages->create(
            $phone,
            array(
                'from' => env('TWILIO_FROM'),
                'body' => $message
            )
        );
        return true;
   }

.env

TWILIO_SID=xxx TWILIO_TOKEN=xxxx TWILIO_FROM=xxxx

muazzamazaz left a reply on Twillo Not Working • 5 months ago

OK I have figured out issue:

Credentials are required to create a Client

I have put credentials in config/twilio.php but no success.

also treid

 'twilio' => [
        'account_sid' => env('TWILIO_SID'),
        'auth_token' => env('TWILIO_TOKEN'),
        'from' => env('TWILIO_FROM'), // optional
    ],

and give .env file detail but no success.

muazzamazaz left a reply on Twillo Not Working • 5 months ago

tell me its say

muazzamazaz started a new conversation Twillow Not Working • 5 months ago

use App\Helpers\Helper;

....


Helper::send_twilio_sms($phone, $message);

not sending sms and mobile app not getting message.

Edit Your Profile
Update

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