mardi 28 mai 2019

Vuejs component not showing in my laravel blade

I am using laravel and vue and it is unable to load components into blade page. It showing empty.

I have tried many solutions but doesn't work.

welcome.blade

<!doctype html>
<html lang="">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
 <meta name="csrf-token" content="">
 <script>window.Laravel = { csrfToken: '' }</script>
    <title>App</title>

    <!-- Fonts -->
    <link href="https://fonts.googleapis.com/css? family=Nunito:200,600" rel="stylesheet">  
</head>
<body>
<script type="text/javascripts" src="js/app.js"></script>
    <div id ="app">
    <div class="container">
    <articles></articles>
    </div> 
    </div>    
    </body>
    </html>

Articles.vue

<template>
<div>
<h2>Articles</h2>
</div>
</template>

App.js

/** * First we will load all of this project's JavaScript dependencies which * includes Vue and other libraries. It is a great starting point when * building robust, powerful web applications using Vue and Laravel. */

    require('./bootstrap');

import articles from './components/Articles'
    window.Vue = require('vue');

/** * The following block of code may be used to automatically register your * Vue components. It will recursively scan this directory for the Vue * components and automatically register them with their "basename". * */

Eg. ./components/ExampleComponent.vue -> <example-component></example-component>

 const files = require.context('./', true, /\.vue$/i);
 files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default));

/** * Next, we will create a fresh Vue application instance and attach it to * the page. Then, you may begin adding components to this application * or customize the JavaScript scaffolding to fit your unique needs. */

Vue.component('articles', require('./components/Articles.vue'));

const app = new Vue({
el: '#app',
});

Composer.json

  "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^7.1.3",
        "fideloper/proxy": "^4.0",
        "laravel/framework": "5.8.*",
        "laravel/tinker": "^1.0"
    },
    "require-dev": {
        "beyondcode/laravel-dump-server": "^1.0",
        "filp/whoops": "^2.0",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^3.0",
        "phpunit/phpunit": "^7.5"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/"
        },
        "classmap": [
            "database/seeds",
            "database/factories"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    }
}

I was expecting to see Articles as h2 but it shows nothing and when I inspect element I see this error

"Uncaught TypeError: Vue.components is not a function".

Any help will be appreciated.



via Chebli Mohamed

I want if user register successfully then user will come next time the registration will not be show for that user

Can you read my question let me know the solution on that.

I want if user register successfully then user will come next time the registration will not be show for that user.

Please help me to solve this issue.

Thank you.



via Chebli Mohamed

lundi 27 mai 2019

I have uploaded the pdf file and when clicked on website on link it's showing file not found

I am trying to click and open my pdf file on website that I have uploaded from admin , but it's showing not found 404

view

    <div class="entry-content">

   <a  target="_blank" href="">

   <p style="font-size: 18px;color: #468b10;"> 

    </p></a>

                                    </div>

Controller

         if (request('file')) {

        $file = request('file');

        $file=$file_name::get($file);

        $file_name = time() . $file->getClientOriginalName();

        $file->move('uploads/posts', $file_name);

        $data['file'] = 'uploads/posts/'.$file_name;
    }



via Chebli Mohamed

lundi 20 mai 2019

"Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP)" kn laravel

When I am trying to update the file then getting error like "Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP)" kn laravel

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

    $this->validate($request,[

        'name'=>'required',
        'designation'=>'required',
        'contact_ph'=>'required',
        'contact_email'=>'required',
        'featured'=>'mimes:jpeg,pdf,docx,png:5000',
    ]);

    $staff=Staff::find($id);

    if($request->hasFile('featured'))

    {
        $featured=$request->featured;
        $featured_new_name =time() .$featured->getClientOriginalName();
        $featured->move('uploads/srcpost', $featured_new_name);
        $staff->featured='uploads/srcposts/'. $featured_new_name;

    }

    $staff->name=$request=name;
    $staff->designation=$request=designation;
    $staff->ordering=$request=ordering;

    $staff->save();

    return redirect()->back();




}



via Chebli Mohamed

mardi 14 mai 2019

'Call to a member function paginate() on array' Error occurred for multiple join tables

Laravel query builder needs to paginate from multiple join tables.

I've tried many ways to paginate this query. But nothing.

Controller.php

$ord_heds = DB::select('select d.family, d.category, d.product_img, d.ord_ref, m.min_qty, m.max_qty, t.qty, t.value, SUM(replace(d.value,",","")) as ordval, SUM(replace(d.qty,",","")) as Tord_qty, COUNT(d.qty) as no_of_items_ordered, (select COUNT(itemCode) as mcount from item_statuses where '.'s'.$siteG.' ="'.$site.'" and itemCode in (select itemCode FROM items WHERE category=d.category and brand=d.family)) as manCount, (select COUNT(itemCode) as mcount1 from item_statuses where '.'s'.$siteG.' ="'.$site.'" and itemCode in (select itemCode FROM items WHERE category=d.category and brand=d.family and itemCode in (select itemcode FROM ord_dets where ord_dets.site = "'.$ordSite.'"))) as ordManCount FROM ord_dets d JOIN ord__heds h ON d.ord_ref = h.id INNER JOIN min__maxes m ON d.category = m.category AND d.site = m.site AND d.scode = m.season INNER JOIN targets t ON d.category = t.category AND d.family = t.brand AND d.month = t.month AND d.year = t.year AND d.site = t.site WHERE h.month = "'.$date[1].'" AND h.year = "'.$date[0].'" AND h.site = "'.$ordSite.'" GROUP BY d.family, d.category, d.product_img, d.ord_ref, m.min_qty, m.max_qty, t.qty, t.value');

$pag = $ord_heds->paginate(10);

dd($pag);

Above code result an error 'FatalThrowableError Call to a member function paginate() on array'.

Kindly appreciated in quick response.



via Chebli Mohamed

Laravel: Microsoft Single Sign On

I am working on an app with laravel 5.1 and added Google Single Sign On and it's working correctly but I also want to implement Microsoft Single Sign On and till now can not find any way.



via Chebli Mohamed

lundi 13 mai 2019

query builder with pagination in laravel frame work

i'm new in laravel and i have problem i want to make pagination with this query and at same time i want return data in array no in object can any one help me

this is my helper

public static function allData($Tablename,$Condition="",$data="")
        {


            $stattment = DB::table($Tablename)
                ->whereRaw(''.$Condition.'', $data)
                ->get()->toArray()
                ->paginate(1);



            return $stattment;

}

this is my controller

enter code here
    public function getall()
        {

   $dataView['products']=Helper::allData('products','`status`=? AND `deleted`=?',array(1,1));
            return view('productss.getall',$dataView);
        }



via Chebli Mohamed