nnnayeem

nnnayeem

Member Since 10 Months Ago

Experience Points 1,500
Experience
Level
Lessons Completed 1
Lessons
Completed
Best Reply Awards 0
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

20 Oct
4 weeks ago

nnnayeem left a reply on Laravel Is Trying To Update _method Field

Thank you @thomask for your answer. It solved my problem. I dd the vendor() and vendor method. In vendor() it maybe return hasOne relation querey builder and in vendor it returns the instance of the model.

Thanks again for your time.

19 Oct
1 month ago

nnnayeem left a reply on Laravel Is Trying To Update _method Field

@thomaskim thanks for your reply. Actually I have different kind of user like vendor, customer and so on. So, What I am doing here is saving information as per the type of user by eloquent relation. On my user model I have defined one to one relation with vendor model and saved additional data for vendor.

I am trying to update user data and vendor data as the user is a vendor.

nnnayeem left a reply on Laravel Is Trying To Update _method Field

@borisu, @tykis @munazzil , @Snapey Thanks all of you guys for your cool solution. But what I can't understand why I have to use this technique in this case here. I have been updating other model also but I did not have to do this way. What is the main reason for this problem to be caused?

nnnayeem started a new conversation Laravel Is Trying To Update _method Field

Hello everyone,

One my project I am trying to update some data but getting this error SQLSTATE[42S22]: Column not found: 1054 Unknown column '_method' in 'field list' (SQL: update vendors set _method = PATCH, _token = LTWtWQjXpMd5Pi6xQdn2oS6PuaPovsKLP6Sz7M00, name = a, phone = 2323, fatherName = a, motherName = a, gender = male, birthDate = 2018-10-31, permanentAdd = a, altPhone = 121212, nomineeName = a, nomineePhone = 121212, nomineeRelation = Sister, updated_at = 2018-10-19 06:13:35 where vendors.user_id = 103 and vendors.user_id is not null)

My route:

Route::patch('profile/{id}/update','[email protected]');

My Controller:

public function UpdateProfile(Request $request,$id){ if(Auth::user()->id == $id){ $data = $request->all(); $rules = [ 'name'=>'required|max:100', 'phone'=>'required|max:100', 'fatherName'=>'required|max:100', 'motherName'=>'required|max:100', 'gender'=>'required|max:100', 'birthDate'=>'required|max:100', 'permanentAdd'=>'required|max:100', 'altPhone'=>'required|max:100', 'nomineeName'=>'required|max:100', 'nomineePhone'=>'required|max:100', 'nomineeRelation'=>'required|max:100', ]; $message = [ 'name.required'=>'name re', ]; Validator::make($data,$rules,$message)->validate(); $user = User::findOrFail($id); // array_except($data,'email'); $user->update($data); $user->vendor()->update($data); return redirect('/vendor-profile'); }else{ abort(404); }

}

I have searched solution for this problem onine. The are all telling to except the _method and _token method. Some saying to use $fillable property.

But I have already used $fillable property and also updated model in the above mentioned way. I just cant figure out what is the problem?

28 Sep
1 month ago

nnnayeem left a reply on Laravel Takes Time To Broadcast Event To Pusher

Thanks for your comment @wilk_randall . I made a silly mistake while uploading to server. I did not tell laravel that I am using pusher in env file. After correcting it works perfectly. One thing I want to ask you though. I am not using laravel echo. Is there any problem not using it?

25 Sep
1 month ago

nnnayeem left a reply on Laravel Takes Time To Broadcast Event To Pusher

Thank you Snapery for your answer. Then what could I use other than pusher.

nnnayeem left a reply on What A Appropriate Validation For Value 0 ?

you should add min:0 to the validation rule

nnnayeem left a reply on Laravel Takes Time To Broadcast Event To Pusher

It is also mentionable that sometimes data is being to sent pusher instantly but pusher is not responding to the event,

nnnayeem started a new conversation Laravel Takes Time To Broadcast Event To Pusher

Hello everyone. One of my laravel app, I am broadcasting events using puser. On the local server the event is sent and received perfectly. But after uploading to server laravel sometimes send the event sometime not and pusher takes time to response on the event. But in the localhost it is working perfectly. Instantly sending and receiving the event.

I am using laravel 5.5.

20 Aug
2 months ago

nnnayeem left a reply on Getting Error MethodNotAllowedHttpException

Sorry My mistake I am sending patch to post route. The following change

Route::PATCH('admin/machines/setMachine/{floor_id}','Admin\[email protected]')->name('setMachine');

Solve the problme

nnnayeem started a new conversation Getting Error MethodNotAllowedHttpException

I am trying to update data. I am using laravel Collective as a form builder. whenever I submit the form I face this error. I checked my route if it the method is correctly used. But all seems to okay. I even checked if the laravel collective added _token filed.

I showing my code bellow

    {!! Form::open(['method' => 'PATCH','url' => ['/admin/machines/setMachine', $floor_id],'class' => 'form-horizontal','files' => true]) !!}

                            <div class="form-group {{ $errors->has('machine_category_id') ? 'has-error' : ''}}">
                                {!! Form::label('machine_category_id', 'Select Machine Category', ['class' => 'col-md-4 control-label']) !!}
                                <div class="col-md-6">
                                    {!! Form::select('machine_category_id', [0=>'Select Machine Category']+$machineCats, null, ('' == 'required') ? ['class' => 'form-control', 'required' => 'required'] : ['class' => 'form-control']) !!}
                                    {!! $errors->first('machine_category_id', '<p class="help-block">:message</p>') !!}
                                </div>
                            </div>

                            <div id="machines" style="display: none">
                                <div class="form-group {{ $errors->has('id') ? 'has-error' : ''}}">
                                    {!! Form::label('id', 'Select Machine', ['class' => 'col-md-4 control-label']) !!}
                                    <div class="col-md-6">
                                        {!! Form::select('id', []+$machines, null, ('' == 'required') ? ['class' => 'form-control', 'required' => 'required'] : ['class' => 'form-control','id'=>'machine']) !!}
                                        {!! $errors->first('id', '<p class="help-block">:message</p>') !!}
                                    </div>
                                </div>
                            </div>



                            <div class="form-group">
                                <div class="col-md-offset-4 col-md-4">
                                    {!! Form::submit(isset($submitButtonText) ? $submitButtonText : 'Add Machine', ['class' => 'btn btn-success']) !!}
                                </div>
                            </div>


                    {!! Form::close() !!}

My route

        Route::get('admin/machines/setSwitch/{floor_id}/{switch}','Admin\[email protected]');

Route::post('admin/machines/setMachine/{floor_id}','Admin\[email protected]')->name('setMachine');

29 Jul
3 months ago

nnnayeem left a reply on Trying To Build Rest Api Using Postman

You meant in JSON form

28 Jul
3 months ago

nnnayeem left a reply on Trying To Build Rest Api Using Postman

I am using post. I am not setting header because after getting the result I can see that the postman automatically set the header.

In the raw I wrote like this for html:

<input type="hidden" name="testing" value="v1>

Is it okay or do I have to create a entire form in the raw?

nnnayeem left a reply on Trying To Build Rest Api Using Postman

@Snapey could you give me a answer if you have the solutio of this problem?

nnnayeem started a new conversation Trying To Send Data Using Raw Html Using Postman

Hello everyone. Currently I am working on a project where I am sending data using postman to my laravel app. I want to use laravel raw while the content type is html or plain text and I want to capture the data in laravel controller. So far, I succeeded using json. But I dont want to use json. Everytime I send data It gets me empty array. I also disabled the csrf token for that route. The code is added below:

        //I tried using this but shows empty array
        
        public function getData(Request $request){
                $p = $_POST;
                dd($p);
   
            }




        //I also tried this

            public function getData(Request $request){
                dd($request->all());
   
            }

Everytime gives me empty array. I tried using html raw like following: <input type="hidden" name="testing" value="v1>

15 Jul
4 months ago

nnnayeem left a reply on Laravel Paypal IPN

Could you solve your problem?

13 Jul
4 months ago

nnnayeem started a new conversation Want To Use $_POST['--'] Sending By Ipn To A Http Listener Url That I Registerd

Hello. I am using laravel 5.5. In my app, I am placing order and customer is paying the payment another api. The api sends notification through ipn by a http listener to a specific url that I registered to the ipn setting page in their website. I have to grab the notification by $_POST['--'] because they are sending a post request.

How do I grab the notification. Is it related to laravel event listener? Ho do I use in this case?

Note: I can't grab the post data using $_POST because it shows page expire.

04 Jul
4 months ago

nnnayeem left a reply on Controller Not Found After Uploading To Server

only difference is app folder which is in lower case. But in the namespace it is in uppercase. Other than that all is same.So I changed app to lowercase in controller.

nnnayeem left a reply on Controller Not Found After Uploading To Server

I changed the namespace into the controller still same problem

nnnayeem left a reply on Controller Not Found After Uploading To Server

My directory is:

app/Http/Controllers/Admin

And my namespace is:

namespace App\Http\Controllers\Admin;

Do I have to change it to:

app\Http\Controllers\Admin;

nnnayeem started a new conversation Controller Not Found After Uploading To Server

Hello everyone. I am working on a project which is running fine in the localhost but after uploading to server, I am facing the following problem:

        ReflectionException (-1)
                    Class App\Http\Controllers\Admin\salesController does not exist

But the controller is there. Why showing the error on server but not showing on local environment. My route is:

Route::middleware(['auth','ClearanceMiddleware'])->group(function (){
        Route::prefix('/admin')->group(function(){

                Route::resource('/roles','RoleController');
                Route::resource('/permission','PermissionController');
                Route::resource('/users','AdminUsersController');
                Route::resource('/category','CategoriesController');
                Route::resource('/products','ProductsController');
                Route::resource('/brand','BrandsController');
                Route::resource('/deals','DealsController');
                Route::get('/sales','Admin\[email protected]')->name('SalesHome');
                Route::get('/sales/{id}/show/{print}','Admin\[email protected]')->name('invoice');
                Route::get('/sales/{id}/pdf','Admin\[email protected]');
                Route::get('/report/sales','Admin\[email protected]')->name('SalesReport');

            });

        });

Others are working perfectly fine. I have checked my namespace and is also fine.

        namespace App\Http\Controllers\Admin;

Another thing I have to add that, before uploading to server I ran cache:clear command. But still was showing problem on the first run so I had to manually change the bootstrap cache config by renaming it to old. I added this because I don't know if it is related or not. Because before I was not facing this problem. Running the command was enough. But some reason its not working now. Thought it might be useful to solve the problem.

03 Jul
4 months ago

nnnayeem left a reply on Want To Check If Symlink Exist Or Not

How do I find out the problem?

nnnayeem left a reply on Want To Check If Symlink Exist Or Not

sorry, I forgot to mention I am using laravel 5.5. Is it possible to do that or there is another way to solve this problem.

nnnayeem started a new conversation Want To Check If Symlink Exist Or Not

Hi everyone. I created symbolic link of storage using storage:link command and working perfectly. But after clearing the cache using cache:clear command the link of the storage is getting unlinked(I was also generating new key too).

I want to check on the first time run of the app, after clearing the cache if the link exist or not. If not I want to link the storage again not by command but by automatically so that user does not has to link every time clear the cache.

22 Jun
4 months ago

nnnayeem left a reply on Flash Message Reappearing

No it is not working. Important Note: I am using laravel session in the javascript condition.

nnnayeem left a reply on Flash Message Reappearing

Yes I did. If I use like this when the value becomes false it shows empty string in console but when true it shows 1.

nnnayeem started a new conversation Flash Message Reappearing

I am sending flash message from controller like this: return redirect('admin/goals')->with('created', 'Goal added!'); And I am showing the flash message like this: $(document).ready(function(){ console.log({!! Session::has('deleted') !!}); if({!! Session::has('deleted')?1:0 !!}) { notif({ type: "success", msg: "{{Session('deleted')}}", position: "right", fade: true, multiline: true }); }

            if({!! Session::has('created')?1:0 !!}) {
                notif({
                    type: "success",
                    msg: "{{Session('created')}}",
                    position: "right",
                    fade: true,
                    multiline: true
                });
            }

            if({!! Session::has('updated')?1:0 !!}) {
                notif({
                    type: "success",
                    msg: "{{Session('updated')}}",
                    position: "right",
                    fade: true,
                    multiline: true
                });
            }
        });
    });
</script>

But after generating the flash message on time the message keep appearing whenever I redirect to that url.

21 Jun
4 months ago

nnnayeem started a new conversation Need Help For Chart Implementation

I want to show daily income of two months for comparing between present month and previous month of the same year. I tried using chart.js. While using chart.js I found out that I can't compare two charts because one chart is filled with 30 days while the chart for present month is not. But chart.js line chart wrap to 30 day with the information that is given to its dataset. I need a chart where I can't plot point by point.

nnnayeem left a reply on Get Portion Of The Route

That worked perfectly. Thank you for your help.

nnnayeem left a reply on Get Portion Of The Route

Thanks for your reply. I tried using the first solution. But is not working. It should be working.

    <li class="{{Request::is('admin/deals/*')?'active ':''}}treeview">
                <a href="#">
                    <i class="fa fa-user"></i>
                    <span>Deals</span>
                    <span class="pull-right-container">
                  <i class="fa fa-angle-left pull-right"></i>
                </span>
                </a>
                <ul class="treeview-menu">
                    <li{!! Request::is('admin/deals')?' class="active"':'' !!}><a href="/admin/deals"> 
                     <i class="fa fa-users"></i> Manage Deals</a></li>
                    <li{!! Request::is('admin/deals/create')?' class="active"':'' !!}><a 
                     href="/admin/deals/create"><i class="fa  fa-user-plus"></i> Deals Create</a> 
                   </li>
                </ul>
            </li> 

nnnayeem started a new conversation Get Portion Of The Route

I want to get a portion of laravel route. Suppose my route is: http://bill.local/admin/slider/create I want to get only slider. Basically, I want to validate if the given route is from slider. I am using laravel 5.5.

20 Jun
4 months ago

nnnayeem left a reply on Trying To Add Multiple Model On Polymorphic Relation

It worked perfectly. Could you explain what happened here or share documentation. Thanks a lot.

nnnayeem left a reply on Trying To Add Multiple Model On Polymorphic Relation

on the Product model

    public function deal()
        {
             return $this->morphMany('App\Deal','dealable');
        }

On the Deal Model

        public function dealable()
        {
         return $this->morphTo();
     }

nnnayeem left a reply on Trying To Add Multiple Model On Polymorphic Relation

No it is not. It is polymorphic relationship.

nnnayeem started a new conversation Trying To Add Multiple Model On Polymorphic Relation

I want to add multiple model on polymorphic relation. Because I am getting data from a select tag which contains multiple. I don't want to save data as a string rather I want as multiple model.

    $deals = new Deal($request->all());
    $objects = Product::findOrFail($request->object_id);//here objects is a collection

       foreach ($objects as $object){
               $object->deal()->save($deals);
             }

but this method is not inserting multiple as I expected. How do I solve this.

14 Jun
5 months ago

nnnayeem left a reply on Laravel5 CRUD Generator

Thanks for your amazing package. But the command does not work on cmder. showing following problem:

Too many arguments, expected arguments "command" "name".

nnnayeem left a reply on Showing Undefined Offset: 1

It worked on git bash. But why it is not working on cmder.

nnnayeem left a reply on Showing Undefined Offset: 1

Now showing

    Too many arguments, expected arguments "command" "name".

I am using cmder

nnnayeem left a reply on Showing Undefined Offset: 1

In the log I found this

[2018-06-14 12:47:10] local.ERROR: Undefined offset: 1 {"exception":"[object] (ErrorException(code: 0): Undefined offset: 1 at D:\xampp\htdocs\laravelProject\commerce\vendor\appzcoder\crud-generator\src\Commands\CrudCommand.php:107)

[stacktrace] #0 D:\xampp\htdocs\laravelProject\commerce\vendor\appzcoder\crud-generator\src\Commands\CrudCommand.php(107): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined offse...', 'D:\\xampp\\htdocs...', 107, Array) #1 [internal function]: Appzcoder\CrudGenerator\Commands\CrudCommand->handle() #2 D:\xampp\htdocs\laravelProject\commerce\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(29): call_user_func_array(Array, Array) #3 D:\xampp\htdocs\laravelProject\commerce\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() #4 D:\xampp\htdocs\laravelProject\commerce\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure)) #5 D:\xampp\htdocs\laravelProject\commerce\vendor\laravel\framework\src\Illuminate\Container\Container.php(549): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL) #6 D:\xampp\htdocs\laravelProject\commerce\vendor\laravel\framework\src\Illuminate\Console\Command.php(183): Illuminate\Container\Container->call(Array) #7 D:\xampp\htdocs\laravelProject\commerce\vendor\symfony\console\Command\Command.php(251): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle)) #8 D:\xampp\htdocs\laravelProject\commerce\vendor\laravel\framework\src\Illuminate\Console\Command.php(170): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle)) #9 D:\xampp\htdocs\laravelProject\commerce\vendor\symfony\console\Application.php(946): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #10 D:\xampp\htdocs\laravelProject\commerce\vendor\symfony\console\Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(Appzcoder\CrudGenerator\Commands\CrudCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #11 D:\xampp\htdocs\laravelProject\commerce\vendor\symfony\console\Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #12 D:\xampp\htdocs\laravelProject\commerce\vendor\laravel\framework\src\Illuminate\Console\Application.php(88): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #13 D:\xampp\htdocs\laravelProject\commerce\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(121): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #14 D:\xampp\htdocs\laravelProject\commerce\artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #15 {main} "}

nnnayeem started a new conversation Showing Undefined Offset: 1

Hello good people. I was trying to use appzcoder. After installing the package I gave the following command:

     php artisan crud:generate Stocks--fields="category#select#options={"1": "Men","2":"Women"}; sub_category#select#options={"technology": "Technology"}; product#string; quantity#number; rate#number; total#number" --view-path=admin/stocks --controller-namespace=App\Http\Controllers --route-group=admin --form-helper=html

But showing

    Undefined offset: 1

I am using laravel 5.5

09 Jun
5 months ago

nnnayeem left a reply on I Have A Problem With Uploading Photos

$path = Storage::putFile('logo', $request->file(logo'));

nnnayeem left a reply on Want To Access Javascript Variable Inside Laravel Function

@Snapey I know that. I was trying to find out in this way it works or not. But it does not work. But how do I create html element and use laravel functions. Do I have to mark the html up in the controller then send the data using ajax success?

nnnayeem left a reply on Want To Access Javascript Variable Inside Laravel Function

But how do I implement the javascript variable inside laravel function:

    $.each($.paraseJSON(data),function(key,value){
        var element = "{!! Storage::url('value.photo') !!}"
    });

nnnayeem left a reply on Want To Access Javascript Variable Inside Laravel Function

Currently I want to solve it using jquery

nnnayeem left a reply on Want To Access Javascript Variable Inside Laravel Function

Here is the full code: $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') } });

    $('#pagination-demo').twbsPagination({
        initiateStartPageClick:false,
        totalPages: 35,
        visiblePages: 3,
        paginationClass:'',
        first:'<span class="text-uppercase">Page:</span>',
        prev: '<i class="fa fa-caret-left"></i>',
        next: '<i class="fa fa-caret-right"></i>',
        last:'',
        pageClass:'',
        onPageClick: function (event, page) {
            $('#products').html("");
            var pdPerPage = $('#pdPerPage').val();


            $.ajax({
                type:'POST',
                url:'/getPaginateProducts',
                data:{page:page,pdPerPage:pdPerPage},
                success:function(data){

                    rendarElements(data);

                },
                error:function (data) {
                    console.log(data);
                }
            }).done(function () {

            });

            function rendarElements(data) {
                var element ="";
                var elementData = "";
                if(data.success){
                    $.each(data.success,function (key,val) {

                        var element = '<div class="col-md-4 col-sm-6 col-xs-6"><div class="product product-single"><div class="product-thumb"><div class="product-label"><span>New</span><span class="sale">-20%</span></div><a href="{{ route("product-details",'+val.id+') }}"><button class="main-btn quick-view"><i class="fa fa-search-plus"></i> Quick view</button></a><img src="{!! Storage::url("val.photo") !!}"></div><div class="product-body"><h3 class=product-price>$'+val.price+' <del class="product-old-price">$'+val.actual_price+'</del></h3><div class="product-rating"><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-o empty"></i></div><h2 class="product-name"><a href="#">'+val.product+val.id+'</a></h2><div class="product-btns">{!! Form::open(["action"=>["[email protected]",'+val.id+'],"method"=>"post"]) !!}{!! Form::hidden("type","wish") !!}<button class="main-btn icon-btn"><i class="fa fa-heart"></i></button> {!! Form::close() !!}{!! Form::open(["action"=>["[email protected]",'+val.id+'],"method"=>"post"]) !!}{!! Form::hidden("type","compare") !!}<button class="main-btn icon-btn"><i class="fa fa-exchange"></i></button>{!! Form::close() !!}{!! Form::open(["action"=>["[email protected]",'+val.id+'],"method"=>"post"]) !!}{!! Form::hidden("type","cart") !!}<button class="primary-btn add-to-cart"><i class="fa fa-shopping-cart"></i> Add to Cart</button>{!! Form::close() !!}</div></div></div></div>';

                        element = element + elementData;

                    });
                    $('#products').html(element);
                }
            }
        }
    });
</script>

nnnayeem left a reply on Want To Access Javascript Variable Inside Laravel Function

I got it from the ajax success(through laravel json method)

nnnayeem started a new conversation Want To Access Javascript Variable Inside Laravel Function

I am fetching data using ajax request. After gettting the data I want to mark html element up using the data. There I am using laravel function and I need to set the javascript function inside the laravel function. It gives me error. I want solution or a better professional way to do it.I am using laravel 5.5.

function rendarElements(data) { var element =""; var elementData = ""; if(data.success){ $.each(data.success,function (key,val) {

                        var element = '<div class="col-md-4 col-sm-6 col-xs-6"><div class="product product-single"><div class="product-thumb"><div class="product-label"><span>New</span><span class="sale">-20%</span></div><a href="{{ route("product-details",'+val.id+') }}"><button class="main-btn quick-view"><i class="fa fa-search-plus"></i> Quick view</button></a><img src="{!! Storage::url("val.photo") !!}"></div><div class="product-body"><h3 class=product-price>$'+val.price+' <del class="product-old-price">$'+val.actual_price+'</del></h3><div class="product-rating"><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-o empty"></i></div><h2 class="product-name"><a href="#">'+val.product+val.id+'</a></h2><div class="product-btns">{!! Form::open(["action"=>["[email protected]",'+val.id+'],"method"=>"post"]) !!}{!! Form::hidden("type","wish") !!}<button class="main-btn icon-btn"><i class="fa fa-heart"></i></button> {!! Form::close() !!}{!! Form::open(["action"=>["[email protected]",'+val.id+'],"method"=>"post"]) !!}{!! Form::hidden("type","compare") !!}<button class="main-btn icon-btn"><i class="fa fa-exchange"></i></button>{!! Form::close() !!}{!! Form::open(["action"=>["[email protected]",'+val.id+'],"method"=>"post"]) !!}{!! Form::hidden("type","cart") !!}<button class="primary-btn add-to-cart"><i class="fa fa-shopping-cart"></i> Add to Cart</button>{!! Form::close() !!}</div></div></div></div>';

                        element = element + elementData;

                    });
                    $('#products').html(element);
                }
            }
06 Jun
5 months ago

nnnayeem left a reply on Country-State-City-Model Relationships

you can access state via county by has_many relationship and city via country by has many through relationship.

After accessing city you will be able to access stores via has many through relationship.

nnnayeem left a reply on Validating Polymorphic Commentable_id

No it is not an ajax call and I am not using vue either. I am trying to insert data using simple post request. Exception occurs when I am trying to insert commetable_id(dealable_id in my table) and commetable_type(dealable_type in my table) is not unique. So I followed burlresearch idea but in a way it gives exception. I am giving my code below in the method:

public function store(Request $request) {

    $type = $request->object_type;
    $deals = new Deal($request->all());
    if($type == "Category"){
        $object = Category::findOrFail($request->object_id);
    }elseif($type == "Product"){
        $object = Product::findOrFail($request->object_id);
    }elseif($type == "SubCategory"){
        $object = SubCategories::findOrFail($request->object_id);
    }else{
        $object = Product::findOrFail($request->object_id);
    }
    try{
        $object->deal()->save($deals);
        return redirect('/admin/deals/create');
    }catch (\Illuminate \ Database \ QueryException $e){

// //I want to feedback some custom message here with a friendly way so that user can solve the mystic } // return redirect('/admin/deals');

}