MaverickChan

Experience

28,310

10 Best Reply Awards

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

28th April, 2017

MaverickChan left a reply on Data Not Inserting Into Database • 16 hours ago

save to the database without validation? not good.

maybe you have sent at least one empty field.

add some validation.

25th April, 2017

MaverickChan left a reply on How Do I Delete All User Records Except My Current Session? • 3 days ago

guys , he wants to delete all the records which do not belong to current user.

  1. provide a model relationship , some hasmany , as a user can have many posts.

  2. delete all the records through model.

24th April, 2017

MaverickChan left a reply on Request Header Field X-Requested-With Is Not Allowed By Access-Control-Allow-Headers In Preflight Response. • 4 days ago

by default setting , axios has csrf protection , but some website like

http://www.omdbapi.com

does not accept the token and throw an error.

is there any way to overwrite it in a single vue file?

btw , if i use jquery ajax csrf protection , it will fail too .remove the protection , it is ok.

MaverickChan started a new conversation Request Header Field X-Requested-With Is Not Allowed By Access-Control-Allow-Headers In Preflight Response. • 4 days ago

when i follow some tutorial to get online json data , the server returns this info.

i am using axios as ajax request. a single vue component file . normal form doesn't work either.

but plain html + vue file is working.

MaverickChan left a reply on File Upload With Behat • 4 days ago

check if $request->hasfile('image') first.

then

$fiel = $request->file('image');

https://laravel.com/docs/5.4/requests#retrieving-uploaded-files

MaverickChan left a reply on Laravel Mix Won't Compile Sass Files • 4 days ago

separate in 2 lines start with mix

MaverickChan left a reply on Blade Templates • 4 days ago

@Snapey @zachleigh @bunnypro

Now you guys know who he is .

MaverickChan left a reply on Seperating Html File And Laravel Framework • 4 days ago

you are insulting the others.

MaverickChan left a reply on When I Run Php Artisan Migrate However I Get Following Error: • 4 days ago

@bunnypro no , there is only php5- prefixed or php- prefixed extensions.

run

sudo apt-get update

first, then

sudo apt-get install php-mysql
or 
sudo apt-get install php5-mysql

23rd April, 2017

MaverickChan left a reply on Seperating Html File And Laravel Framework • 5 days ago

@Snapey @jlrdw @EmilMoe @laibaejaz don't waste your time on this guy , he never intend to listen to anyone , and he never want to know laravel . i bet he does not have any idea of MVC .

he said he "watched" some laravel tutorial video , i really doubted.

MaverickChan left a reply on Removing {id:"0" After SortByDesc Collection • 5 days ago

use array_push() in your contorller then json_encode

MaverickChan left a reply on When I Run Php Artisan Migrate However I Get Following Error: • 5 days ago

1 .please show your .env file 2.if you are using linux , this should be easy to install a php dependency.

  1. did you install your database ? if not
sudo apt-get install mysql-server

or other database .

MaverickChan left a reply on Unable To Initialize Tagit Jquery • 5 days ago

1.order in app.blade.php

<script src="{{ asset('js/app.js') }}"></script>
<script src="{{ asset('js/manifest.js') }}"></script>
<script src="{{ asset('js/vendor.js') }}"></script>

2.in your bootstrap.js not app.js (all in resource/assets/js)

window.$ = window.jQuery = require('jquery');

3.in Example.vue

var $ = require('jquery');
import 'tagit';
export default {
    .....
}

:Important , for the third part , you should use npm install tagit --save,then in your bootstrap.js

window.tagit = require('tagit');

i am new to vue too , hope this could help.

inport jquery ui , if you need it.

MaverickChan left a reply on Mac Mini As Dev Box? • 5 days ago

enough

MaverickChan left a reply on 500 (Internal Server Error) • 5 days ago

where is your code???

MaverickChan left a reply on Blade Templates • 5 days ago

@edoc don't waste your time lecturing him , he won't listen . he does not know what is mvc at all.

MaverickChan left a reply on How To Call The Controller In Laravel? • 5 days ago

@zachleigh you are wasting your time .

MaverickChan left a reply on How To Call The Controller In Laravel? • 5 days ago

i strongly suggest guys stop helping this guy , until he read the document first.

he never intend to understand laravel .

new to laravel is not a sin , but you need to show some respect to yourself and those who want to help you.

read the document , please .

21st April, 2017

MaverickChan left a reply on Enable Mod Rewrite • 1 week ago

what is the server are you using? please provide more info

MaverickChan left a reply on Composer • 1 week ago

i think you REALLY need to read the DOCUMENT , before you start any move .

i don't think you understand MVC and based on what you said , you never know the directory structure of laravel .

in windows , if you just copy everything to your socalled localhost , the important hidden files such as .htaccess and .env will lost.

without config file , how could it run?

here is the advice:

cd into your laravle_new_laravel directiory , run 'php artisan serve', then in the browser , enter 127.0.0.1:8000 or localhost:8000

if there is a welcome page , that means laravel is ok .

and again , you REALLY should read the DOCUMENT and watch some tutuorial.

MaverickChan left a reply on Fail To Download Image • 1 week ago

that means your database has no such record.

20th April, 2017

MaverickChan left a reply on A Post Shouldn't Be Saved If It Doesnt Belong To Any Category. How To Approach That? • 1 week ago

What's your controller look like?

MaverickChan left a reply on How To Refactor Laravel PHP Code In Sublime ? • 1 week ago

Command + p will take you to any where

MaverickChan left a reply on Move Existing Row To Another Table • 1 week ago

$row = DB::table('table1')->where('id',YOUR ROW)->get();

DB::('table2')->insert($row);

both tables should have same structure

MaverickChan left a reply on Fail To Download Image • 1 week ago

try

$file_path = public_path('downloads/'.$data->businessAddImg);

or

$file_path = public_path('downloads/'.$data->businessAddImg.'/');

MaverickChan left a reply on Include Collection In Model Data To Be Returned As JSON • 1 week ago

ok , now i kind understanding your question.

it is a eager loading thing.

if you have a Model called Friend , and user has many friends relationship is defined ,then , all you need to do is

$user = User::findOrfail($id)->load('friend');

now you can parse the $user->friends in your view file. to display each of them , use foreach

MaverickChan left a reply on Web Server • 1 week ago

windows is not that friendly for webserver.

what is your Operating system ? win 7 ? win 10? x86? x64?

everything matters when you install a web environment.

please know your system first .

19th April, 2017

MaverickChan left a reply on Auth::id() Showing Null • 1 week ago

ok , good for you .

i was about to say , sometimes don't make things too complicated.

anyway , congrats

MaverickChan left a reply on Auth::id() Showing Null • 1 week ago

@Kaustubh my thoughts are dried out..... maybe try Route Model binding to avoid these problems

MaverickChan left a reply on Auth::id() Showing Null • 1 week ago

then another way :

$id = Auth::user()->id;

MaverickChan left a reply on Auth::id() Showing Null • 1 week ago

just

use Auth;

MaverickChan left a reply on Vue Component Not Registered • 1 week ago

@silverxjohn delete the script section in your laravel blade view files. then npm run dev then check again

MaverickChan left a reply on Include Collection In Model Data To Be Returned As JSON • 1 week ago

in your contoller

return \Response::json($user->friends());

the data will be transformed to json , and you can use in javascript

MaverickChan left a reply on Vue Component Not Registered • 1 week ago

@silverxjohn

i notice that in your file

var vm = new Vue({
    components: {
        box: require('./path/to/component.vue)
    }
})

it should be

var vm = new Vue({
    components: {
        'box': require('./path/to/component.vue)
    }
})

need to quote box.

18th April, 2017

MaverickChan left a reply on Storing Returned Results From Database In Array And Pass It To View • 1 week ago

so maybe it's $item->Event->type.

MaverickChan left a reply on Storing Returned Results From Database In Array And Pass It To View • 1 week ago

@rematchka please change your view like @edoc said.

i think it is gonna be alright

MaverickChan left a reply on Storing Returned Results From Database In Array And Pass It To View • 1 week ago

public function getmedia() { $medias = Events::all(); $items = array(); $event = ''; foreach($medias as $media) { $event = Media::where('events_id',$media->id)->first(); $items[] = array('Event' => $event);

    }

return view('event',array( 'items' => $items )); }

MaverickChan left a reply on Problems With Modal (can’t Close It) • 1 week ago

maybe you should check if a modal has 'is-active' class

MaverickChan left a reply on Storing Returned Results From Database In Array And Pass It To View • 1 week ago

you lost a 's' in foreach

 public function getmedia()
    {
        $medias = Events::all();
        $items = array('Events');
        $event = '';
        foreach($medias as $media)
        {
            $event = Media::where('events_id',$media->id)->first();
            $items[] = $event;
          
        }
 return view('event')->with($items);
    }

MaverickChan left a reply on Vue.js Component Within Component (passing Data Obtained With Ajax To Child Component) • 1 week ago

i remember someone says , if you are using single vue file component , you just need to import the vue file , not register them in the others. then you could use whatever methods you want . try it .

MaverickChan left a reply on Unable To Run Npm Run Dev • 1 week ago

1.download node.js from Official site , use version 6 , not 7 2.after install , reopen your terminal. 3.run npm install in your project folder 4.it should be fine.

MaverickChan left a reply on Error On Public_html • 1 week ago

why are you sticking to use easyPHP , not using something else like wamp or installing a apache php server ? laravel need some php dependence to work . your server environment does not seem right to me. if php.exe is not working , you cannot clear cache . without composer , you cannot update and install things.

i don't expect you understand , even if you said you have READ the doc.

MaverickChan left a reply on Public_html • 1 week ago

do you have composer installed?? can you run php artisan in command line? if not , don't expect your COPYED files would run.

MaverickChan left a reply on Error On Public_html • 1 week ago

IF you want to use laravel , you need to GET laravel correctly.

please follow the tutorials or read the doc of laravel.com,

instead of just COPYing someone else's code .

It just won't run , no , never and ever.

MaverickChan left a reply on Eloquent Object Passed From Controller To View Is Printing Json • 1 week ago

add

->get()

at the end of your query , that will return an object

MaverickChan left a reply on JQuery & Vue • 1 week ago

before

export default {

    }

prepend

var $ = require('jquery');

any other javascript api could be used the same way.

it should look like:

<script>
var $ = require('jquery');

export default {

    mounted () {

        the usual jQuery way....

            }   

    
    
    }
</script>

MaverickChan left a reply on Vue Component Not Registered • 1 week ago

@silverxjohn

the Vue warning is very friendly , it tells you the best way.

so add a

name : 'box',

inside export default

everything should be fine

MaverickChan left a reply on Bootstrap Modal Edit Form In Laravel • 1 week ago

you need to give each modal a unique id

try

the button:

<a href="{{route('admin.customers.edit',$id)}}" data-hover="tooltip" data-placement="top" data-target="#modal-edit-customers{{ $id }}" data-toggle="modal" id="modal-edit" title="Edit"></a>

the modal you want to use

<div class="modal" id="modal-edit-customers{{ $id}}">

...modal content .....

</div>

17th April, 2017

MaverickChan left a reply on Unable To See Laravel Tutorial • 1 week ago

where are you from ? if you are in some country , use VPN

16th April, 2017

MaverickChan left a reply on Laravel Installation • 1 week ago

first , you should install your php environment right.

or , you can do nothing ,even vanilla php .

Edit Your Profile
Update

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