mvd

Hire Me

Experience

27,220

12 Best Reply Awards

  • Member Since 3 Years Ago
  • 188 Lessons Completed
  • 2 Favorites

28th August, 2018

mvd left a reply on Table Data Filter In Laravel 5.6 • 1 month ago

No error messages (in your log) ?

21st August, 2018

mvd left a reply on Custom Login Attempts Message • 1 month ago

Do you mean something like this?

@if (count($errors))
    @if (count($errors) == 1 &&  in_array(__('auth.throttle'), $errors->get('email')))
        <p>@lang('auth.throttle')</p>
            <button>Close</button>
            <button>Contact</button>
    @else
         <ul>
                @foreach ($errors->all() as $error)
                        <li>{{ $error }}</li>
                @endforeach
            </ul>
    @endif
@endif 

mvd left a reply on Checking Database Value And Echoing A String To Screen. • 1 month ago

Hi Woxene,

You can create some kind of helper function/class, like this

<?php
$types = array('dt' => 'Duties & Taxes ', 'transport ' => 'Transport ');
?>
{{ $types[$transportDTAccount->type] ))

mvd left a reply on Custom Login Attempts Message • 1 month ago

@hades300 np, can you show us this code?

mvd left a reply on Custom Login Attempts Message • 1 month ago

@hades300 it work and it's the same as $errors->has('email') if you got too many attempts.

Did you change the variable throttle in auth.php to 'Too many login attempts' (because there is a placeholder in it) and test my code?

mvd left a reply on Custom Login Attempts Message • 1 month ago

You can change the message in resources/lang/en/auth.php, the throttle variable. Change it to 'Too many login attempts' for example.

In your blade template.

@if (in_array(__('auth.throttle'), $errors->get('email')))
<p>@lang('auth.throttle')</p>
        <button>Close</button>
        <button>Contact</button>
@endif 

mvd left a reply on Laravel Post Request Api Is Not Working. • 1 month ago

Hi Tus

Are you running Postman in preview mode?

We don't allow Javascript to run in preview mode in Postman for security reasons. And so when you are using javascript to hide this text, it is not running.

https://github.com/postmanlabs/postman-app-support/issues/3344#issuecomment-320249284

8th August, 2018

mvd left a reply on Laravel 5.6 Runtime Database Connection • 2 months 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 • 2 months 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 • 2 months 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 • 2 months ago

And the code from Refund?

mvd left a reply on Laravel 5.6 Runtime Database Connection • 2 months 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 • 2 months 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 • 2 months 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 • 2 months 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 months 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 months 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 months 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 • 3 months 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) • 3 months 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) • 3 months 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) • 3 months 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 • 3 months 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 • 3 months ago

Did you run

npm install

first?

4th July, 2018

mvd left a reply on Store Controller Setup • 3 months 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 • 3 months 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 • 3 months 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 • 3 months 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 • 3 months 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 • 3 months 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? • 3 months 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? • 3 months 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? • 3 months 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 • 3 months 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 • 3 months 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 • 3 months 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 • 3 months 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 • 3 months 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 • 3 months 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 • 3 months 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 • 3 months 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 • 3 months 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? • 3 months 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? • 4 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? • 4 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? • 4 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? • 4 months ago

Hi Frumentius,

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

Edit Your Profile
Update

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