Resin

Experience

6,540

5 Best Reply Awards

  • Member Since 2 Years Ago
  • 88 Lessons Completed
  • 0 Favorites

21st June, 2018

Resin left a reply on Refresh Page Error • 1 day ago

Please use ``` on each side of your code to format it properly.

20th June, 2018

Resin left a reply on SQLSTATE[23000]: Integrity Constraint Violation: 1452 Cannot Add Or Update A Child Row: A Foreign Key Constraint Fails • 2 days ago

Are you sure you have a row on the requisitions table with id 1? The same question for the schools table

14th June, 2018

Resin left a reply on How To Downgrade Bootstrap Version To 3.3.7 In Laravel 5.6? • 1 week ago

Try installing it specifically

Run this from the terminal

npm install <package>@<version>

Resin left a reply on Eloquent Merge Two Queries • 1 week ago

Use unions https://laravel.com/docs/5.6/queries#unions

$first = DB::table('users')
            ->whereNull('first_name');

$users = DB::table('users')
            ->whereNull('last_name')
            ->union($first)
            ->get();

13th June, 2018

Resin left a reply on Throw New MethodNotAllowedHttpException($others); • 1 week ago

Why are you passing the controller reference in the last route as an array?

Route::post('/readxsl', ['[email protected]_xsl']);

12th June, 2018

Resin left a reply on Passing String (path) From View To Controller • 1 week ago

Ah sorry I misunderstood. What you are looking for is Requests https://laravel.com/docs/5.6/requests#accessing-the-request

You can type hint it in the read_xsl() method and get the current request

To get the file simply use this. https://laravel.com/docs/5.6/requests#retrieving-uploaded-files

Resin left a reply on Passing String (path) From View To Controller • 1 week ago

return view('form')->with('path', $path);

Resin left a reply on How To Add The Color Picker For Form Element • 1 week ago

Did you try a google search? This was the first item I found. https://github.com/xiaokaike/vue-color

11th June, 2018

Resin left a reply on Podcast Download • 1 week ago

Seems that the url to the mp3 file is in the source.

Using chrome:

Right click the player and select "Inspect element" Press ctrl + F and search for "simplecast-player" The src of the element has url to the mp3 file Right click the url and select open in new tab Right click the new player and select "Save as.."

Resin left a reply on Pop Up Alert Message In Laravel • 1 week ago

Are you using ajax to insert the data or a simple form?

6th June, 2018

Resin left a reply on Call Controller Method Inside A Job Handle Method • 2 weeks ago

If that is necessary you are most likely doing something wrong. :) Make a common thing (say a job) that can be called from both your controller and your queue.

Resin left a reply on Hy • 2 weeks ago

Try

explode(', ', Input::get('telefon')->toArray()

5th June, 2018

Resin left a reply on Blank Page After Submitting Form In Laravel • 2 weeks ago

Like @martinbean said if it returns false there will be no output. NULL will evaluate to false and nothing will be rendered.

Resin left a reply on ErrorException (E_ERROR) Undefined Variable: Data • 2 weeks ago

If you dont use compact you need to pass it with a key. Otherwise laravel will have no idea that your variable is called 'data'.

$data = insurance_model::all();

return view('index', ['data' => $data]); 

or use with

$data = insurance_model::all();

return view('index')->with('data', $data); 

Resin left a reply on ErrorException (E_ERROR) Undefined Variable: Data • 2 weeks ago

Compact takes a string not a variable. Use it like this

$data = insurance_model::all();

return view('index',compact('data')); 

1st June, 2018

Resin left a reply on Draggable And Resizable Images Onto Background And Save Into 1 Image • 3 weeks ago

This is quite a big project. I would suggest starting with reading the jQuery UI docs. They have tools for resizable, draggable etc. If you have little experience with jQuery I would suggest breaking it down into smaller goals

  1. Find out how to resize and image and make it movable
  2. Find out how to swap images
  3. Find out to drag new items to your canvas etc.

31st May, 2018

Resin left a reply on Second Parameter DB::raw() • 3 weeks ago

Use selectRaw instead.

From the docs: The selectRaw method can be used in place of select(DB::raw(...)). This method accepts an optional array of bindings as its second argument:

Resin left a reply on Getting Data Using Eloquent/one To Many Relationship • 3 weeks ago

Use it like this

Route::get('/customer',function(){

    $customers=Customer::with("Country")->get();
    foreach($customers as $customer){

        echo $customer->customer_id."|".$customer->customer_name."|".$customer->country_fid."<br/>";
        echo $country->country->country_name."<br/>";


    }

});

Resin left a reply on Getting Data Using Eloquent/one To Many Relationship • 3 weeks ago

$customer->country

This will only get on country back.

Try:

echo $customer->country->country_name . "<br/>";

Resin left a reply on Ajax Post Submit With Laravel • 3 weeks ago

Please post your route

Resin left a reply on Showing Error After Uploading To Server • 3 weeks ago

Try installing php7-json

sudo apt-get install php7.0-json

Resin left a reply on Showing Error After Uploading To Server • 3 weeks ago

Which version of PHP are you using?

30th May, 2018

Resin left a reply on How To Get The First Of Many Relationship? • 3 weeks ago

If it is on the User model you can use.

$user->about->first();

Resin left a reply on The Last Element With Specific Class • 3 weeks ago

The reason is that you used $(this) which refers to the button you are clicking on. It will NEVER have the class mail_block (as this is the class of the actual blocks). You are actually already finding the correct element here

upper = $("#"+this_id+"_row").next('.main_block').attr('id');

I would suggest using variables to cache your items (best practice).

function move_down(this_id)
    {
    var row,
        row_below,
        clone,
        clone_below;

    row =  $("#"+this_id+"_row")
        
        if($(this).is($(".main_block:last"))) {
                alert("This is the last block, don't push no lower");
        return;
            } 

    row_below = row.next('.main_block')

        clone = row.clone();
        clone_below = row_below.clone();

        if(!row.is(':empty'))
            {
                row.replaceWith(clone_below);
                clone_below.replaceWith(clone);
                row_below.addClass("replaced");
            }

    }

Resin left a reply on Translating Only A Portion Of Page • 3 weeks ago

Try this example from w3schools where they translate based on an element id. https://www.w3schools.com/howto/howto_google_translate.asp

Resin left a reply on E_NOTICE : Type 8 -- Array To String Conversion -- At Line 7 Array • 3 weeks ago

Use print_r($ar) instead of echo $ar to see what you actually have to work with.

Resin left a reply on Translating Only A Portion Of Page • 3 weeks ago

If you wish to use google translate I already told you how :)

<div class="notranslate">
Text in english
</div>
<div>
Text to translate
</div>
<div class="notranslate">
More text in english
</div>

Resin left a reply on The Last Element With Specific Class • 3 weeks ago

Did you try this?

if($('#' + this_id + '_row').is($(".main_block:last"))) 
            {
                alert("This is the last block, don't push ano lower");
            } 
        else 
            {
                alert('This is not the las block with .main_block class, push is ok');
            }

Resin left a reply on Seeder For Product, Product Categories, And Product Sub Categories • 3 weeks ago

Try this

Schema::create('products', function (Blueprint $table) {
        $table->increments('id');
        $table->string('user_id');
        $table->string('name');
        $table->longText('description')->nullable();
        $table->integer('sub_category')->unsigned();
        $table->string('image')->nullable();
        $table->string('thumbnail')->nullable();
        $table->string('price');
        $table->string('discount')->nullable();
        $table->timestamps();
    });

    Schema::create('product_categories', function (Blueprint $table) {
        $table->increments('id');
        $table->string('name');
        $table->timestamps();
    });

    Schema::create('product_sub_categories', function (Blueprint $table) {
        $table->increments('id');
        $table->string('name');
        $table->integer('parent_category')->unsigned();
        $table->foreign('parent_category')->references('id')->on('product_categories')->onUpdate('cascade')->onDelete('cascade');
        $table->timestamps();
    });

Schema::table('products', function (Blueprint $table) {
            $table->foreign('sub_category')->references('id')->on('product_sub_categories')->onUpdate('cascade')->onDelete('cascade');
   });

Resin left a reply on The Last Element With Specific Class • 3 weeks ago

I dont see a main_block class anywhere in here?

<span class="btn btn-secondary margin_1_px " title="Cancel" onclick="move_up('<?php echo $element_value['id'];?>');" ><small><i class="fas fa-arrow-circle-up"></i> Up</small></span>

Is main_block the parent class or where is it located?

Did you perhaps mean to use

if($('#' + this_id).is($(".main_block:last"))) 
            {
                alert("This is the last block, don't push ano lower");
            } 
        else 
            {
                alert('This is not the las block with .main_block class, push is ok');
            }

Resin left a reply on The Last Element With Specific Class • 3 weeks ago

Can you post an example of how the function is called? The click button part.

Resin left a reply on The Last Element With Specific Class • 3 weeks ago

Does it register the element if you just use

if($(this).is($(".main_block"))) 
            {
                alert('This is the last block');
            } 
        else 
            {
                alert('This is not the last block with .main_block class');
            } 

My point being that $(this) might not be a .main_block at all

Resin left a reply on Translating Only A Portion Of Page • 3 weeks ago

Add class="notranslate" to parts to not translate https://cloud.google.com/translate/faq#technical_questions

Resin left a reply on First Time Testing. Need Advice • 3 weeks ago

Personally I would break this into alot smaller tests. Eg. create a file just for testing the password field.

/**
     * @group fields
    */
    public function testPasswordFieldIsRequired()
    {
        $this->browse(function (Browser $browser) {
            $browser->visit(route('register'))
                    ->maximize()
                    ->press('Register')
                    ->assertRouteIs('register')
                    ->assertSee('The password field is required')
                    ;
        });
    }

/**
     * @group fields
    */
    public function testPasswordFieldMustHaveLength()
    {
        $this->browse(function (Browser $browser) {
            $browser->visit(route('register'))
                    ->maximize()
                    ->press('Register')
                    ->assertRouteIs('register')
                    ->type('password','test')
                    ;
        });
    }

This is just an example, but should make it fast to stop exactly which test has been broken later on.

Resin left a reply on User Roles And Permissions • 3 weeks ago

I personally use bican/roles It is really easy to setup and works like a charm

https://github.com/romanbican/roles

Resin left a reply on Not Getting The Views • 3 weeks ago

Can you update your example code to reflect you updated code?

29th May, 2018

Resin left a reply on How To Get A Relation Between Two Indirectly Related Tables? • 3 weeks ago

If I understand you correctly, then what you are looking for is a hasManyThrough relationship. https://laravel.com/docs/5.6/eloquent-relationships#has-many-through

Resin left a reply on Shifting All Rows Down By 1 In Sql Using Laravel • 3 weeks ago

Do you intend to increase all ids by one in the table in the database? Eg. 1 becomes 2 and 2 becomes 3 etc. How many rows are we talking about?

Resin left a reply on Create Model/migration With Full Permision • 3 weeks ago

If you need to create it for a different user (say www-data) you can use sudo -u www-data

eg.

sudo -u www-data php artisan make:migration create_country_table

Resin left a reply on How To Call A Controller Function From Schedule And Pass Parameters • 3 weeks ago

I would suggest using a command for your logic instead of a controller. Then you can call the command from your controller. With that said I believe you need to use an associative array. There is a big chance this will never work with a controller.

$schedule->call('\App\Http\Controllers\[email protected]', ['user' => 32])->everyMinute();

I haven't tested this out (as I said you should not use controllers in schedules).

Resin left a reply on Store The Emoji Of Post By Laravel • 3 weeks ago

As I dont want to write all of your code for you I can give you a few generic suggestions instead :)

The jQuery way

  1. Write some jQuery to handle the click on an icon (you suggest using data-icon="angry" etc on the div's to easily get the right icon clicked
  2. Let the jQuery click event call a route where it can be saved (using $.ajax())
  3. Make a controller that is called from the route that has the code for saving the icon

If this makes no sense to you, I would suggest reading up on jQuery :)

The form way

  1. Put each "icon" inside a element with method POST and an action calling a route in laravel.
  2. Add a hidden input field to each form with name="icon" and value="angry" etc.
  3. Change the div icons to buttons instead (you might need to fix some css issues), with type="submit"

If this makes no sense you should read https://www.w3schools.com/html/html_forms.asp

28th May, 2018

Resin left a reply on Sessions When Using Domain Name With And Without Www • 3 weeks ago

Make sure to redirect one to the other. Dont allow users to use both www and non www.

This is .htaccess to go from www to non www

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/ [R=301,L]

Resin left a reply on Stripe Errors And Display Them To The User • 3 weeks ago

Can you try checking xhr.responseJSON in your jQuery?

Resin left a reply on Oracle Authentication Using Laravel Authentication Scafolding Not Working • 3 weeks ago

And laravel has permissions to write to storage/framework/sessions ?

Resin left a reply on Stripe Errors And Display Them To The User • 3 weeks ago

Seems that you are missing a return before response()

catch(\Stripe\Error\InvalidRequest $e) { 
       return response()->json(['message' => $e->getMessage()], 400);
}

https://laravel.com/docs/5.6/responses#json-responses

25th May, 2018

Resin left a reply on Oracle Authentication Using Laravel Authentication Scafolding Not Working • 4 weeks ago

Are you by any chance using array as session driver?

Resin left a reply on Middleware In Package • 4 weeks ago

Route::get('profile', function () { // Only authenticated users may enter... })->middleware('auth');

https://laravel.com/docs/5.6/authentication#protecting-routes

13th January, 2017

Resin started a new conversation Get Object From Own Collection • 1 year ago

I have started working with laravels manually created collections. I cannot quite figure out how to properly build it up when it should be multi dimentional.

I want the same structure as when I use Eloquent. For instance I expected that the following code would let me use $data->item, but it seems that it is simply added as an array.

$data = collect['item' => 'Hello'];

I know I can use $data->item = 'Hello' but when I am dealing with multi level arrays this would seem like quite a hazzle.

Any ideas?

Resin left a reply on Join Tables Using Query Builder • 1 year ago

Any reason you are not using eloquent? If you did you could just do the following.

$provider->where('ref_id', $providerID)->with('offers.features')->get();

This will give you a collection within a collection within a collection, which means it is easy to iterate over.

This of course means that you need to setup models for each and create relationships, but it is well worth it :)

Edit Your Profile
Update

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