dimanche 29 juillet 2018

Import csv using index matching for Laravel

I am thinking of using an index matching while uploading the csv file to the database. So something like, we have a string 'index_to_match [ 'A', 'D', 'C', 'F', 'B', 'E' ]' which are the horizontal index of the csv file (the coloumns of a csv file) and a database table with the following fields, field1, field2, field3, field4, field5 and field6. Now the data in the coloumn "A" will get inserted to field1, the data in coloumn 'D' will get inserted to field2, the data in coloumn 'C' will get inserted to field3 and so on. There are ways to implement this is python, so is there anyway I can do this is laravel?



via Chebli Mohamed

Unable to let tour.next() to work on custom element in a vue component

I finally completed my app using laravel and vue.js and now I'm trying to set up a Bootstrap Tour to let the users understand what and how they can do, but I'm having a problem breaking my head since yestaerdy. So, I set up a bootstrap tour instance in my blade view where I got the vue component `

@auth
    @extends ('layouts.app')
@section('content')
    <head>
    </head>
    <div  class="container-fluid" id="bladeContainVue">
        <list-medias id="mediasList" :sessions="" :filtersession="" ></list-medias>
    </div>
    <script>

        window.onload = function () {
            // jQuery and everything else is loaded
            // Instance the tour
            var tour = new Tour({
                storage: null,
                steps: [
                    {
                        element: "#mediasList",
                        title: "Your medias",
                        content: "Here we are. Take a look on this page."
                    },
                    {
                        element: ".pendingTour:first",
                        title: "Pending eggs",
                        content: "All the eggs of the chicken are golden."
                    },
                    {
                        element: ".pendingTour:first",
                        reflex: true,
                        title: "Pending eggs/2",
                        content: "Click on colorTheEgg "
                    },
                    {
                        element: "#colorTheEgg",
                        reflex: true,
                        title: "Pending eggs preview",
                        content: ""
                    },

                ]});


            // Initialize the tour
            tour.init();
            // Start the tour
            tour.start();
        }

    </script>


    @endsection
@endauth`

Now what my aim is to let pass to the next step of the bootstrap tour when the user click on the button that redirect to a child Vue component, but I can't manange it to work. <img src="/ViewY.png" class="img-fluid inspectElement" v-on:click="openEggManager(userEgg); tour.next(); ">

If I try with tour.next(); or Tour.next(), I get "tour is undefined" in console, if I do _this.next(); I got no error but it doesen't go to the next step...

I'm not good at all in JS, I hope there's somebody that can give me a hint on how to achieve this goal.



via Chebli Mohamed

How to achieve this route?

I'm trying to achieve the route " /stock//quantity ". So i have created a folder named "quantity" inside resources/views/stocks/ . And i have also created an index.blade.php file inside quantity.

" /stock/ "shows the details of the stock i.e "show.blade.php"

Inside "show.blade.php" i have placed the link to my quantity page. Given Below is the code.

<a href="/stocks//quantity">Quantity</a>

But its not working. Am i doing correct?

I did add Route::resource('quanity', 'QuanityController'); to web.php Please help someone!



via Chebli Mohamed

Laravel auto-responder email code

I've been searching Laravel auto-responder email code but I couldn't find it.

I would like to make system like this. A Blade file has one Email input form. A user type own Email address into the input form then press submit buttom. so then Laravel send Auto email reply to the Email address. And also I got a Email "somebody emailed you".

Could someone teach me the link or code please.



via Chebli Mohamed

UnexpectedValueException laravel :protocol error

I am doing a project in Laravel 5.6 homestead. I got this error after i ran php artisan cache:config, the command ran successfully but after I ran this command and refreshed the url in my browser, I get the following error Now nothing routes are opening even the main url ecommerce.test showing this error. Im a Laravel beginer.

Any idea how to solve this???

There is no existing directory at "C:\Laravel_Homestead_Projects\ecommerce\storage\logs" and its not buildable: Protocol error



via Chebli Mohamed

Laravel eloquent returns different result type on local and live

on my local eloquent returns object while on live it returns an array.

Why is this happening is there a setting I need to update?

$parent_user   = User::where('email', $organiser->email)->first();

Laravel v5.2



via Chebli Mohamed

samedi 28 juillet 2018

Laravel 5 - Transfer MySQL data from Dev to Staging/Production

I am having this question that I have been scratch my head for hours... I have build a Laravel 5.4 app that's ready to be tested on staging. I am able to create the database and run migration. So the question is how do I transfer the data from Dev to Staging, and later to Production?

I have a table called "regions" that lists out all regions in the area, such as "San Francisco", "East Bay", "South Bay" and so on. I know there are work around like importing sql file or Laravel Seeding, but I just want to know the proper way to do it.

Thanks in advance.



via Chebli Mohamed