anonymouse703

anonymouse703

Member Since 2 Years Ago

Experience Points
7,200
Total
Experience

2,800 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
3
Lessons
Completed
Best Reply Awards
2
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    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 Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

Level 2
7,200 XP
Sep
23
10 hours ago
Activity icon

Started a new Conversation Record Not Deleted In Database Using SWAL In Vue Js Even Without Error

Hello guys, newbee here. I tried to delete a record using swal thought there is no error but the record is not deleted in the database. I'm using Laravel 7 and vue.

This my controller

public function destroy(MoneyTransfer $moneyTransfer)
    {
        $moneyTransfer->delete();
        \Log::info($moneyTransfer);
    }

and this is my vue delete function with swal

deleteMoneyTransfer(id){
        // alert('Deleted');
        swal.fire({
          title: 'Are you sure?',
          text: 'You will not be able to recover this imaginary file!',
          icon: 'warning',
          showCancelButton: true,
          confirmButtonText: 'Yes, delete it!',
          cancelButtonText: 'No, keep it'
        }).then((result) => {
          if (result.value) {
             this.form.delete('api/money-trans/'+id).then(()=>{
                swal.fire(
                  'Deleted!',
                  'The record has been deleted.',
                  'success'
                )
             })
          } else if (result.dismiss === swal.DismissReason.cancel) {
            swal.fire(
              'Cancelled',
              'The record is cancelled',
              'error'
            )
          }
        })
      }
Activity icon

Replied to I Have A Request Data But Doesn't Updated In My Database

okay i will post it now it on loading the data after update. by the way thank you

Activity icon

Replied to I Have A Request Data But Doesn't Updated In My Database

It's working wow..... You save my day sir.. Is it the same way on delete? by the way I have also problem on the swal... I still learning laravel + Vue now.

Activity icon

Replied to I Have A Request Data But Doesn't Updated In My Database

Here is the error Status Code: 500 Internal Server Error

[2020-09-23 07:12:14] local.ERROR: Call to a member function where() on bool {"exception":"[object] (Error(code: 0): Call to a member function where() on bool at C:\\wamp64\\www\\bethyl-trade\\app\\Http\\Controllers\\MoneyTransferController.php:95) [stacktrace]

line 95 ->where("id", $request->get("id"));

Activity icon

Replied to I Have A Request Data But Doesn't Updated In My Database

My model

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class MoneyTransfer extends Model
{
    
    protected $primaryKey = 'id';
    
    protected $table = 'moneytrans';

    protected $fillable = ['name'];

}
My Controller
Activity icon

Replied to I Have A Request Data But Doesn't Updated In My Database

I didn't see this sorry... the error of this is here:

app.js:285 PUT http://www.bethyl-trade.test/api/money-trans/13 500 (Internal Server Error)

[2020-09-23 06:54:02] local.ERROR: Call to a member function where() on bool {"exception":"[object] (Error(code: 0): Call to a member function where() on bool at C:\\wamp64\\www\\bethyl-trade\\app\\Http\\Controllers\\MoneyTransferController.php:95) [stacktrace]

Activity icon

Replied to I Have A Request Data But Doesn't Updated In My Database

what class? you mean my model?

Activity icon

Replied to I Have A Request Data But Doesn't Updated In My Database

I don't know... that's the new thing in Laravel 7. here is the update

public function update(Request $request, MoneyTransfer $moneyTransfer)
    {
        $this->validate($request, [
            'name' => 'required'
        ]);

        $moneyTransfer->update($request->all());
        return ['message' => 'Updated the user info'];
        
    }

But in my other project a pure Laravel that code is working... but when I use Vue it doesn't work.

Activity icon

Replied to I Have A Request Data But Doesn't Updated In My Database

sir Laracoft suggestion $data = $moneyTransfer->update($request->all())->where("id", $request->get("id"));

Activity icon

Replied to I Have A Request Data But Doesn't Updated In My Database

I tried your code but it's still not working... do I need to check my route?

Activity icon

Replied to I Have A Request Data But Doesn't Updated In My Database

I got error 500 Internal Server Error

in the log local.ERROR: Call to a member function where() on bool {"exception":"[object] (Error(code: 0): Call to a member function where() on bool at C:\\wamp64\\www\\bethyl-trade\\app\\Http\\Controllers\\MoneyTransferController.php:88) [stacktrace]

Activity icon

Started a new Conversation I Have A Request Data But Doesn't Updated In My Database

Hello everyone newbee here... I used Laravel 7 and Vue JS.

I tried to update a record using vue js. When I log the request I have this data

[2020-09-23 04:32:47] local.INFO: array (
  'id' => 9,
  'name' => 'PS Bank',
)  

but my update is not working... this is my controller

public function update(Request $request, MoneyTransfer $moneyTransfer)
    {
        $this->validate($request, [
            'name' => 'required'
        ]);
        
        $data = $moneyTransfer->update($request->all());
        \Log::info($request->all());
    }

Do I need to include id in my fillable in the model? this is the model. protected $fillable = ['name'];

Thank you and God bless

Sep
22
1 day ago
Activity icon

Started a new Conversation How To Update Record Using Api Resource Controller And Vue Form?

Hello guys, newbee here.

I want to update a record using vue-form and api resource controller. I have request payload and the status in the network was 200 but it doesn't updated in my database.

this how I called my update.

updateMoneyTrans(){
        this.form.put('/api/money-trans/'+this.form.id)
        .then(({data})=>{
          console.log(data);
          $('#add_moneytrans').modal('hide');
          this.mounted();
        })
        .catch(()=>{
        })
      },

and this is my api link route::resource('money-trans','MoneyTransferController');

and this is my controller

public function update(Request $request, MoneyTransfer $moneyTransfer)
    {
        try {
            $this->validate($request, [
                'name' => 'required'
            ]);
            dd($request->all());
            $moneyTransfer->update($request->all());

        } catch(Exception $e) {
            session()->flush('error', $e->getMessage());
            return redirect()->back()->withInput();
        }
        return $moneyTransfer;
        session()->flash('edit', 'Plan content updated');
    }

Note: I'm using Laravel 7

Activity icon

Replied to Request Method: PUT - Status:405 Method Not Allowed In Vue Updata

I updated the function to this

 updateMoneyTrans(){
        this.form.put('/api/money-trans/'+this.form.id)
        .then(()=>{
          $('#add_moneytrans').modal('hide');
          this.mounted();
        })
        .catch(()=>{
        })
      },

I got now status 200 but It doesn't change the value in my database

This is my controller

public function update(Request $request, MoneyTransfer $moneyTransfer)
    {
        try {
            $this->validate($request, [
                'name' => 'required'
            ]);
            dd($request->all());
            $moneyTransfer->update($request->all());

        } catch(Exception $e) {
            session()->flush('error', $e->getMessage());
        }
        return $moneyTransfer;
        session()->flash('edit', 'Plan content updated');
    }
Activity icon

Replied to Request Method: PUT - Status:405 Method Not Allowed In Vue Updata

this is in the route:list api/money-trans/{money_tran}

but how to get the {id} when I'm using Laravel 7 and this is my vue JS function

data(){
      return {
        editmode: false,
        moneytranslist: {},
        form: new Form({
          id : '',  
          name: ''
        }),
       
      }
    },
updateMoneyTrans(){
        this.form.put('/api/money-trans')
        .then(()=>{

        })
        .catch(()=>{
        })
      },

and I'm using this.form.put() so it means I pass the request data

Activity icon

Started a new Conversation Request Method: PUT - Status:405 Method Not Allowed In Vue Updata

Hello guys, newbee here in laravel + vue.

I tried to update an item but when I click update I got this error 405 Method Not Allowed

this is my api route: route::resource('moneytrans','MoneyTransferController');

and this my update function:

this.form.put('/api/moneytrans')
        .then(()=>{

        })
        .catch(()=>{
        })

What do I lack?

Sep
21
2 days ago
Activity icon

Replied to Modal Is Closing (3 Seconds) When I'm In Edit Form

I don't know that happened but it seem it's okay now... is cache and view is need to be cleared? as in always?

Activity icon

Replied to Modal Is Closing (3 Seconds) When I'm In Edit Form

 <div class="modal fade" id="add_moneytrans">
      <div class="modal-dialog">
        <div class="modal-content">
        
          <!-- Modal Header -->
          <div class="modal-header">
            <h4 class="modal-title">Add Money Transfer Agent</h4>
            <button type="button" class="close" data-dismiss="modal">&times;</button>
          </div>
          
          <!-- Modal body -->
          <div class="modal-body">
            
            <form @submit.prevent="addMoneytrans" @keydown="form.onKeydown($event)">

              <div class="form-group">
                <label>Name</label>
                <input v-model="form.name" type="text" name="name"
                  class="form-control" :class="{ 'is-invalid': form.errors.has('name') }" required>
                <has-error :form="form" field="name"></has-error>
              </div>

              <button :disabled="form.busy" type="submit" class="btn btn-primary">Add Money Trans Agent</button>
            </form>
          </div>
          
          <!-- Modal footer -->
          <div class="modal-footer">
          </div>

        </div>
      </div>
    </div>

this is my modal. When I add new item the modal is okay but when I edit the item the modal is close in just 3 just 3 seconds

Activity icon

Replied to Modal Is Closing (3 Seconds) When I'm In Edit Form

Thank you sir Frankie Lee :)

But still it closes for about a seconds..

Activity icon

Started a new Conversation Modal Is Closing (3 Seconds) When I'm In Edit Form

Hello guys, I am a newbee in Laravel + Vue.

I tried to edit specif item in the table using the same modal of how I add the items but when I click the edit the button the modal is showing with the populated data but it will close suddenly for about 2 or 3 seconds.

This is my button in edit.

<a href="" class="btn btn-primary " @click="editMoneyTransfer(moneytrans)" >
            <i class="fa fa-edit"></i>
            &nbsp;Edit
 </a>

and this how call my function

editMoneyTransfer(moneytrans){
	this.editmode = true;
	this.form.reset();
	this.form.fill(moneytrans);
	$('#add_moneytrans').modal('show');
 },

What make's my modal closing immediately without clicking anything?

Activity icon

Awarded Best Reply on Get 500 Internal Error In Submit

SOLVED!!!!

I tried to read the log and what I did are:

  1. re-initialize key php artisan key:generate
  2. run php artisan config:cache
  3. run php artisan cache:clear
  4. run php artisan view:clear
  5. run npm run dev

I think we should clear cache after many changes. By the ways thank you guys for your reply.

Activity icon

Replied to Get 500 Internal Error In Submit

SOLVED!!!!

I tried to read the log and what I did are:

  1. re-initialize key php artisan key:generate
  2. run php artisan config:cache
  3. run php artisan cache:clear
  4. run php artisan view:clear
  5. run npm run dev

I think we should clear cache after many changes. By the ways thank you guys for your reply.

Activity icon

Replied to Get 500 Internal Error In Submit

Here is my controller

public function store(Request $request)
    {
    
        try {
            $this->validate($request, [
                'name' => 'required'
            ]);
            // dd($request);
            $moneytrans = MoneyTransfer::create($request->all());
        } catch(Exception $e) {
            session()->flush('error', $e->getMessage());
        }
        return $moneytrans;
        session()->flash('save', 'Money transfer added.');
    }
Sep
20
3 days ago
Activity icon

Started a new Conversation Get 500 Internal Error In Submit

Hello guys, I'm just new in Laravel + Vue..

I tried to post a data from my modal but when I click the submit I got this error http://www.bethyl.test/api/moneytrans-store 500 (Internal Server Error)

This is my route in API Route::post('moneytrans-store','[email protected]');

and this is my code in submitting

<script>
  export default {
    data(){
      return {
        form: new Form({
          name: ''
      }),
        moneytranslist: {},
      }
    },
    mounted(){
      this.getMoneyTransList();
    },
    methods:{
      getMoneyTransList(){
      },
      addMoneytrans(){
       this.form.post('/api/moneytrans-store')
        .then(({ data }) => { 
            console.log(data);
            $('#add_moneytrans').modal('hide'); 
          })
      },
      deleteMoneyTransfer(){
        alert('Deleted');
      }
    }
  };
</script>

Note: my csrf was place under the meta tag
`<meta name="csrf-token" content="{{ csrf_token() }}">  `
Aug
09
1 month ago
Activity icon

Replied to DataTable In Laravel Mix Not Working

already solved.... my co contributor did not included the js and cs file... thank you guys

Activity icon

Replied to DataTable In Laravel Mix Not Working

I got new error home_header:245 Uncaught TypeError: $(...).DataTable is not a function should I re-declare the data table?

Aug
07
1 month ago
Activity icon

Replied to DataTable In Laravel Mix Not Working

Thank you I will message you.

Activity icon

Replied to DataTable In Laravel Mix Not Working

I don't see any error in my console but the dataTable is not working.... Is registering datatable.net-bs4 in bootstrap,js is necessary? I used template and I included dataTable JS and CS in compiling.

Activity icon

Started a new Conversation DataTable In Laravel Mix Not Working

Hello everyone I used laravel mix to compile all the JS files including dataTable but when I used it it's not working.

<script type="text/javascript">
    $(document).ready(function(){
        $('#home_header').DataTable({
            responsive: true,
            'dom': 'ftp',
            'pageLength': 10
        })

    });
</script>

What I'm lacking?

Jul
07
2 months ago
Activity icon

Started a new Conversation What Is The Proper Way In Compiling Assets In Webpack?

Hello everyone, I tried to use Laravel with vue in front-end.. and I have two templates to be used one for front-end (landing page) and one for Admin panel. But when i tried to compile the JS it has error.

mix.styles([
    'Imperial/lib/bootstrap/css/bootstrap.min.css',
    ], 'public/css/all.css')
    .scripts([
        'Imperial/lib/jquery/jquery.min.js',
        'Imperial/lib/bootstrap/js/bootstrap.min.js',
        ], 'public/js/all.js');

mix.styles([
    'gentelella-master/vendors/bootstrap/dist/css/bootstrap.min.css',
    'gentelella-master/vendors/font-awesome/css/font-awesome.min.css',
    ],'public/css/main.css')
    .sass('resources/sass/app.scss', 'public/css')
    .scripts([
   'resources/js/app.js',
    'gentelella-master/vendors/jquery/dist/jquery.min.js',
    'gentelella-master/vendors/bootstrap/dist/js/bootstrap.bundle.min.js',
    ], 'public/js/app.js');

I get this error in my console Uncaught ReferenceError: require is not defined at app.js:7

But when I did this

mix.js('resources/js/app.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css');

mix.styles([
    'Imperial/lib/bootstrap/css/bootstrap.min.css',
    ], 'public/css/all.css')
    .scripts([
        'Imperial/lib/jquery/jquery.min.js',
        'Imperial/lib/bootstrap/js/bootstrap.min.js',
        ], 'public/js/all.js');

mix.styles([
    'gentelella-master/vendors/bootstrap/dist/css/bootstrap.min.css',
    'gentelella-master/vendors/font-awesome/css/font-awesome.min.css',
    ],'public/css/main.css')
    .sass('resources/sass/app.scss', 'public/css')
    .scripts([
   'resources/js/app.js',
    'gentelella-master/vendors/jquery/dist/jquery.min.js',
    'gentelella-master/vendors/bootstrap/dist/js/bootstrap.bundle.min.js',
    ], 'public/js/app.js');

then put the two css and js in my app.blade.php

<link href="{{ asset('css/main.css') }}" rel="stylesheet"> 
<link href="{{ asset('css/app.css') }}" rel="stylesheet"> 
 <script src="{{asset('js/main.js')}}"></script>
 <script src="{{asset('js/main.js')}}"></script>

the main.css is not working same with JS is not working...

What should be the proper way to do it?