mvd

Hire Me

Experience

26,350

11 Best Reply Awards

  • Member Since 2 Years Ago
  • 187 Lessons Completed
  • 2 Favorites

8th August, 2018

mvd left a reply on Laravel 5.6 Runtime Database Connection • 1 week ago

What is the output if you run?

 dd($refund->setConnection('app')->getTable());

before '$show = $refund->all();'

mvd left a reply on Laravel 5.6 Runtime Database Connection • 1 week ago

Did you add this to the top of your controller?

use Illuminate\Support\Facades\Config;

And use Config::set (see my first post).

$refund = new Refund();

Config::set("database.connections.app", [
      'driver' => 'mysql',
      'host' => $host,
      'port' => env('DB_PORT', '3306'),
      'database' => $database,
      'username' => $username,
      'password' => $password,
      'charset' => 'utf8mb4',
      'collation' => 'utf8mb4_unicode_ci',
      'prefix' => '',
      'strict' => true,
      'engine' => null,
]);

$refund->setConnection('app');
$show = $refund->all();

mvd left a reply on Hash::check Not Matching Password • 1 week ago

@Kavyajain yes Hash::make generates a new hash but an older does still work.

dd(Hash::make('selena123'), Hash::make('selena123'))

And

dd(Hash::check('selena123', 'hash_output_1_or_2'));

both are true.

So what i already wrote, the $master->password or $request->password is wrong.

mvd left a reply on Laravel 5.6 Runtime Database Connection • 1 week ago

And the code from Refund?

mvd left a reply on Laravel 5.6 Runtime Database Connection • 1 week ago

Config::set works fine in Laravel 5.6

Where do you add the code (controller, model, route file) etc? Do you get an error?

Can you give us the code?

mvd left a reply on Hash::check Not Matching Password • 1 week ago

@Kavyajain 'y$CMreJ6mPZX4u/5YtA1eg1uVzfhusD5Pgt4hDBmd5qE0VRNy5QZT4K' is not a correct hash for 'selena123'

Try

  dd(Hash::check('selena123', 'y$CMreJ6mPZX4u/5YtA1eg1uVzfhusD5Pgt4hDBmd5qE0VRNy5QZT4K'));

// = false

Correct hash

  $correct_hash = Hash::make('selena123');
  dd($correct_hash, Hash::check('selena123', $correct_hash));

mvd left a reply on Laravel 5.6 Runtime Database Connection • 1 week ago

Hi Krack26,

Something like this?

  Config::set("database.connections.second", [
    "host" => "...",
    "database" => "...",
    "username" => "...",
    ...
]);

  $db2 = DB::connection('second');
  dd($db2->table('users')->get());

mvd left a reply on Hash::check Not Matching Password • 1 week ago

Hi Kavyajain,

Why don't u use the auth function from Laraval? https://laravel.com/docs/5.6/authentication#login-throttling

use

$credentials = $request->only('email', 'password');
if (Auth::attempt($credentials)) {

instead of

if (Hash::check($request->password,$master->password)){

31st July, 2018

mvd left a reply on Middleware Except Is Not Working... • 2 weeks ago

Route [posts.index] not defined. (View: C:\xampp\htdocs\laravel_app\resources\views\layouts\app.blade.php) (View: C:\xampp\htdocs\laravel_app\resources\views\layouts\app.blade.php)

I don't know the code in this file but i guess something with the route names. Maybe add a name to the route but i'm not sure if this really works

Route::get('/post', '[email protected]')->name('posts.index');

mvd left a reply on Middleware Except Is Not Working... • 2 weeks ago

A find it, i thinks this will work

Route::group(['middleware' => ['auth'], ['except'=>'index'] ], function() {
        Route::resource('posts', 'PostsController')->except('index');
        Route::get('/dashboard', '[email protected]');
        Route::get('/logins', '[email protected]');
        Route::get('/logouts', '[email protected]');
        Route::get('/allusers', '[email protected]');  
    });
Route::get('/post', '[email protected]');

mvd left a reply on Middleware Except Is Not Working... • 2 weeks ago

Can u give us the whole code in your route file?

11th July, 2018

mvd left a reply on Install On Windows 10 Gives OpenSSL Error • 1 month ago

Hello vincej,

Did you run

composer install

or

composer update

?

10th July, 2018

mvd left a reply on Send An Email From The Auth User Email To Another Email Is Not Working Properly (from Email Address Is Not Appearing Correctly) • 1 month ago

Yes, this address is static. So you want the from email address from the current authenticated user?

->from(Auth::user()->email, Auth::user()->name)

But this could be a problem because now it lookes like the mail is comming from another server (from the authenticated user). The mail can be rejected or stored in the spam folder.

9th July, 2018

mvd left a reply on Send Mail From Email To Another Email Is Not Working Properly (from Email Address Is Not Appearing Correctly) • 1 month ago

Yes, in your from address. I updated my post.

mvd left a reply on Mail From Is Not Working Properly (from Email Address Is Not Appearing Correctly) • 1 month ago

Hi Adamjhn,

And if you use

MAIL_FROM_ADDRESS
and
MAIL_FROM_NAME

in your .env file?

You can also set the default variables in config/mail.php

mvd left a reply on Form Fields Validation In Controller • 1 month ago

Hi Scala,

Seprate the requirements white a pipe

'txtBookName' => 'required'|min:5,

See https://laravel.com/docs/5.0/validation#available-validation-rules for all the existing rules.

mvd left a reply on Npm Run Dev Error • 1 month ago

Did you run

npm install

first?

4th July, 2018

mvd left a reply on Store Controller Setup • 1 month ago

Hi Geekshu,

I think you do not know/understand 'many-to-many-relationships' You need this for your for

subject,teacher the start_time and end_time, and I will repeat the sequence from subject till end time again

Some article about this https://laraveldaily.com/pivot-tables-and-many-to-many-relationships/

For your form, you will need som repeatable elements for this. Something like this plugin, https://formfieldrepeater.com/ Demo: http://formfieldrepeater.com/#formDemo

2nd July, 2018

mvd left a reply on Multiple Select Laravel Blade • 1 month ago

Your first question

 @foreach($classroom->teachers as $teacher)
    <td>{{ $teacher->name }}</td>
 @endforeach 

Needs to be

<td>
    @foreach($classroom->teachers as $teacher)
        {{ $teacher->name }} <br />
    @endforeach 
</td>

mvd left a reply on Issue In Spittling The Json Data In Laravel • 1 month ago

$result = json_decode('{ "decksys.com": { "classkey": "domcno", "status": "available" } }');
foreach($result as $key => $item) {
    print $key . ' and status is:  ' . $item->status;
}

Or do you mean in Blade?

@foreach($result as $key => $item)
     {{ $key }} and status is: {{ $item->status }}
@endforeach

mvd left a reply on Issue In Spittling The Json Data In Laravel • 1 month ago

Hello lvsharmila,

Something like this?

 $result = json_decode('{ "decksys.com": { "classkey": "domcno", "status": "available" } }');

  // decksys.com
  $key = key($result);
  print $key;

  // status
  print $result->$key->status;

26th June, 2018

mvd left a reply on Friend Request In Laravel With Relationships • 1 month ago

Sorry i did not create this package, try to contact the creator (?) I found this on Github so i think you will need to build your own implementation

This package is useful to any project that needs users to have friends. For example in a forum app you can let your users be friends with each other and then they can see their friends activities, or they can send messages with their friends or anything else you would like to implement in your app.

https://github.com/hootlex/laravel-friendships/issues/2#issuecomment-159362691

mvd left a reply on Friend Request In Laravel With Relationships • 1 month ago

Hi Kunzilla,

Use Laravel 5 Friendships? https://github.com/hootlex/laravel-friendships

20th June, 2018

mvd left a reply on How To Downgrade Bootstrap Version To 3.3.7 In Laravel 5.6? • 1 month ago

@frumentius you can set the icon path with variable '$icon-font-path', in resources/assets/sass/_variables.scss

19th June, 2018

mvd left a reply on How To Downgrade Bootstrap Version To 3.3.7 In Laravel 5.6? • 1 month ago

@frumentius do the changes in the js/css files in the resources/assets/ directory

mvd left a reply on How To Pass Multiple Values Through Ajax In Laravel? • 1 month ago

whats wrong in this??

Can you give us all the code of method 'search_name'

another doubt my function has just one variable $request

This is an object, variables $request->search_name, $request->search_area, $request->search_booth are in it.

18th June, 2018

mvd left a reply on To Retrieve The Array Value From Database To My View Blade • 1 month ago

@Niyaz did you pass the $statusInfo array from your controller to your view? Something like

return view('view_name', ['statusInfo' => $statusInfo ....

i did as per your code used switch, case, breaks in every line Which version of Laravel do you use?

mvd left a reply on To Retrieve The Array Value From Database To My View Blade • 1 month ago

@Niyaz did you set each switch, case, breaks etc on a new line just like my code?

mvd left a reply on To Retrieve The Array Value From Database To My View Blade • 1 month ago

Hi @Niyaz ,

Try to use the code tags, it's hard to read your code. https://help.github.com/articles/basic-writing-and-formatting-syntax/#quoting-code

Use the switch statement

@foreach( $request->request_status as $status)

    @if (!$status)
        None of them is selected
    @else    

        @switch ($status)
            @case(5)
                Re-activation, Additional Access, Lost, Damaged, Replacement
                @break
            @case(4)
                Re-activation, Additional access, Lost, Damaged
                @break
            @case(3)
                Re-activation, Additional access, Lost
                @break
            @case(2)
                Re-activation, Additional access
            @case(2)
                Re-activation, Additional access
            @default
                Re-activation
        @endswitch
        
    @endif    
@endforeach 

mvd left a reply on How Can I Add A New Item In One-to-many Relation While Updating • 1 month ago

Hello @jenya ,

You could give new textarea's another field name, example 'new_textarea[]' In your update controller add another for loop

foreach($request->input('new_textarea') as $newTextarea) {
$newCard = new Card();
$newCard->control_id_here = $request->input('control_id');
$newCard->textarea_value = $newTextarea;
$newCard->save();
}

mvd left a reply on How To Update Approved From 0 To 1 In Laravel • 1 month ago

Also check the relationship, see the post from @Snapey

mvd left a reply on How To Update Approved From 0 To 1 In Laravel • 1 month ago

@irankhosravi did you realy changed $submitApplication to $submit_application in your controller function 'update' ?

If so, can you give us the output from


public function update(Request $request, SubmitApplication $submit_application)
{
dd($submit_application);
}

Other option is to use the $submitApplication as id

public function update(Request $request, $submitApplication) {

$submitApplication = SubmitApplication::findOrFail($submitApplication)
$submitApplication->approved = 1;
$submitApplication->save();
return redirect()->back();
}


mvd left a reply on How To Update Approved From 0 To 1 In Laravel • 1 month ago

@irankhosravi Did you tried my code (update your controller) ?

mvd left a reply on How To Update Approved From 0 To 1 In Laravel • 1 month ago

@mballaag his code is correct but the variable '$submitApplication' needs to be '$submit_application' for the route model binding

mvd left a reply on How To Update Approved From 0 To 1 In Laravel • 1 month ago

Hello @irankhosravi,

I think a model binding problem. Can you change your controller to

public function update(Request $request, SubmitApplication $submit_application)
{
  $submit_application->approved = 1;
  $submit_application->save();
  return redirect()->back();
}

mvd left a reply on How To Downgrade Bootstrap Version To 3.3.7 In Laravel 5.6? • 1 month ago

@frumentius 6 is 'wrong', if you make a change in your js/scss files in the asset directory, public/css/app.css will be over overwritten.

14th June, 2018

mvd left a reply on How To Downgrade Bootstrap Version To 3.3.7 In Laravel 5.6? • 2 months ago

@frumentius, yes 'npm install' needs to be enough. But what do you mean with 'did not work' ?

You can check the boostrap version in /node_modules/bootstrap/package.json

mvd left a reply on How To Pass Multiple Values Through Ajax In Laravel? • 2 months ago

Name function in your controller? I only changed your $sales query in the search_name function

public function search_name( Request $request )

{
                    $output="";

                    $sales = Sales_details::where(function ($query) use ($request->search_name, $request->search_area, $request->search_booth) {

    // Name.
    if (!empty($request->search_name)) {
      $query->orWhere('customer_name', 'LIKE', '%' . $request->search_name . '%');
    }

    // Area.
    if (!empty($request->search_area)) {
      $query->orWhere('customer_area', 'LIKE', '%' . $request->search_area . '%');
    }

    // Booth.
    if (!empty($request->search_booth)) {
      $query->orWhere('customer_booth', 'LIKE', '%' . $request->search_booth . '%');
    }

})->paginate(10);
    
    if($sales)

    { 
        //Need to return the output to the ajax
    }
    else
    {
        // Need to perform some thing
    }
}

$query is a grouping functionlity, see https://laravel.com/docs/5.6/queries Section 'Parameter Grouping'

mvd left a reply on How To Pass Multiple Values Through Ajax In Laravel? • 2 months ago

Hello AbdulBazith,

Add a onkeyup eventon all the search fields?

data:{
    'search_name':$value1
    'search_area':$value2
    'search_booth':$value3
},

In your controller something like this (not tested)

    $sales=Sales_details::where(function($query) use ($request->search_name, $request->search_area, $request->search_booth) {

      // Name.
      if (!empty($request->search_name)) {
        $query->orWhere('customer_name', 'LIKE', '%' .  $request->search_name .'%');
      }

      // Area.
      if (!empty($request->search_area)) {
        $query->orWhere('customer_area', 'LIKE', '%' .  $request->search_area .'%');
      }

      // Booth.
      if (!empty($request->search_booth)) {
        $query->orWhere('customer_booth', 'LIKE', '%' .  $request->search_booth .'%');
      }

    })->get();

mvd left a reply on How To Downgrade Bootstrap Version To 3.3.7 In Laravel 5.6? • 2 months ago

Hi Frumentius,

After you changed the package.json file, did you rebuild the packages?

9th June, 2018

mvd left a reply on Send Notification • 2 months ago

Test your smtp connection variables for production?

8th June, 2018

mvd left a reply on Passing Data From Blade To Controller Through AJAX • 2 months ago

Typo in your controller name? Other option, do you use CSRF tokens?

mvd left a reply on Default Timezone In Lumen • 2 months ago

Hi Jije,

What is every solution? Also tried a 'DB_TIMEZONE' variable in your .env file?

mvd left a reply on How To Add Column’s Values In Laravel? • 2 months ago

Hi @AbdulBazith

Does this work?

$no=20;

Overallstock::where('date', $date)->update([
    'balance_milk' => DB::raw("balance_milk - {$no}")
]);

mvd left a reply on Send Notification • 2 months ago

Hi

Are your sure the setting are good? Also no errors? Example,

/**
 *  Send Mail from Parts Specification Form
 */
public function sendMail(Request $request) {
    $data = $request->all();

    $messageBody = $this->getMessageBody($data);

    Mail::raw($messageBody, function ($message) {
        $message->from('[email protected]', 'Test mail');
        $message->to('[email protected]');
        $message->subject('Test email');
    });

$fail = Mail::failures();
if(!empty($fail)) {
 throw new \Exception('Could not send message to '.$fail[0]);
}


    // otherwise everything is okay ...
    return redirect()->back();
}

6th June, 2018

mvd left a reply on Trying To Get Property Of Non-object Eager Loading • 2 months ago

code?

mvd left a reply on Laravel: Any Route Starting With The Letter 'a' Throws Error • 2 months ago

What is the error? Can you show us the .htaccess and the route code?

Edit Your Profile
Update

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