php – Call to undefined relationship [sub_category] on model [AppSub_Category]

I'm trying to make a call for get To get all my "subcategories", I get the error:
Call of an indefinite relationship (subcategory) on the model (App Sub_Category).

I am in doubt since I do not know if the error is 100% of the database or the query.

Please if someone could help me, I would appreciate it

Classroom

public function store(Request $request) {
    // Recoger los datos
    $json = $request->input('json', null);
    $params = json_decode($json);
    $params_array = json_decode($json, true);
    if (!empty($params_array)) {

        $jwtAuth = new JwtAuth();
        $token = $request->header('Authorization', null);
        $user = $jwtAuth->checkToken($token, true);

        // Validar los datos
        $validate = Validator::make($params_array, (
                    'name' => 'required'
        ));
        //Guardar los datos
        if ($validate->fails()) {
            $data = (
                'code' => 400,
                'status' => 'error',
                'message' => 'Envia el nombre'
            );
        } else {
            $sub_category = new Sub_Category();
            $sub_category->name = $params_array('name');
            $sub_category->category_id = $params->category_id;
            $sub_category->save();

            $data = (
                'code' => 200,
                'status' => 'success',
                'sub_category' => $sub_category
            );
        }
    } else {
        $data = (
            'code' => 400,
            'status' => 'error',
            'mensage' => 'No has enviado ninguna sub_categoria'
        );
    }

    // Devolcer Sub_Categoria
    return response()->json($data, $data('code'));
}

Model

class Sub_Category extends Model
{
    // Referencia a la base de datos
    protected $table = 'sub_categories';

    // Unos a muchos
    public function give_posts(){
        return $this->hasMany('AppPost');
    }

    // Relación Muchos a uno
    public function category(){
        return $this->belongsTo('AppCategory', 'category_id');
    }

Database

The objective is to be able to obtain all the data to be able to modify them later, I leave here the 2 tables to be connected.

CREATE TABLE categories(
id                  int(255) auto_increment not null,
name                varchar(255)  NOT NULL,
created_at           datetime DEFAULT NULL,
updated_at           datetime DEFAULT NULL,
CONSTRAINT  pk_users PRIMARY KEY(id)
)ENGINE=InnoDb;

CREATE TABLE sub_categories(
id                  int(255) auto_increment not null,
name                varchar(50)  NOT NULL,
category_id         int(255) NOT NULL,
created_at           datetime DEFAULT NULL,
updated_at           datetime DEFAULT NULL,
CONSTRAINT  pk_users PRIMARY KEY(id),
CONSTRAINT  fk_post_category FOREIGN KEY(category_id) REFERENCES categories(id)
)ENGINE=InnoDb;

json rpc – Can not call an rpc API from another computer on the same local network

can not call api rpc from another machine on the same local network

There is a registration node in my local network I can call rpc api only from the node machine, not my local machine.

I know rpcallowip is modified in the recent version https://bitcoin.org/en/release/v0.18.0#configuration-option-changes

http clinet httpie

the ip of my local computer: 192.168.1.155

the address of the btc node: 192.168.1.132

The port 8332 is open.

$ bitcoind -version                 
# Bitcoin Core Daemon version v0.18.0.0-g2472733a24a9364e4c6233ccd04166a26a68cc65

I start regtest, and my ip is 192.168.1.155

bitcoind -regtest -deprecatedrpc=generate -printtoconsole -rpcuser=user -rpcpassword=password -rpcallowip=0.0.0.0/24 -rpcbind=127.0.0.1  -server -rpcport=8332

customer request

# request from btc node's machine
http POST http://user:password@127.0.0.1:8332 jsonrpc="2.0" method="getblockchaininfo" id=1
# successed

# request from my local machine 192.168.1.155
http POST http://user:password@192.168.1.132:8332 jsonrpc="2.0" method="getblockchaininfo" id=1
# http: error: ConnectionError: HTTPConnectionPool(host='192.168.1.132', port=8332): Max retries exceeded with url: / (Caused by NewConnectionError(': Failed to establish a new connection: (Errno 111) Connection refused',)) while doing POST request to URL: http://user:password@192.168.1.132:8332/

sha256 – multiple call of the gcry_md_write function

Maybe this is not an issue of information security stack exchange and if that is true, excuse me for my mistake.

I want to understand how this code works:

char *s = "1";
char *s_2 = "2";

unsigned char *x;

gcry_md_hd_t h;
gcry_md_open(&h, GCRY_MD_SHA256, GCRY_MD_FLAG_SECURE); 

gcry_md_write(h, s, strlen(s)); 
gcry_md_write(h, s_2, strlen(s_2)); 
x = gcry_md_read(h, GCRY_MD_SHA256); 

Well, I have two diets and the two do not work.

  1. x = SHA256 (SHA256 ("1") || SHA256 ("2")).

SHA256("1") = 6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b;

SHA256("2") = d4735e3a265e16eee03f59718b9b5d03019c07d8b6c51f90da3a666eec13ab35

SHA256(SHA256("1") || SHA256("2")) = 4295f72eeb1e3507b8461e240e3b8d18c1e7bd2f1122b11fc9ec40a65894031a

  1. x = SHA256 (SHA256 ("1") || "2")

x = a29972da68d930f3bd40fa9c150137c780cf55f4d7187335a9f4b9043736f02a

But the result x (exit of the program) is

6b51d431df5d7f141cbececcf79edf3dd861c3b4069f0b11661a3eefacbba918

How does this code work?

dnd 5th – Will my pet remember me when I call again or is it a new entity?

Jimmy Peanuts, the familiar of my Warlock Chain pact, played at D & D 5th. He fell into the hands of a lizard-man and fainted after touching a power of 0.

I understand that I can start Find Familiar again and invoke a near-familiar, but I'm not quite sure to re-invoke Jimmy Peanuts, or a near-new (almost) (for discussion reasons we Joey Walnuts).

Will the quasit be the Jimmy Peanuts back, with all the memories that the spirit almost familiar with INT 7 is able to train and retain, or a fresh Joey Walnuts, who has no experience previous with me or my party?

(I've read this Q & A, but this particular shade of familiar death is not discussed: what happens when a familiar "dies"?)

False call buttons for action for research

My company runs two week sprints. The product roadmap is set a quarter ahead.
So when a new feature is later identified as important, we do not have time to do it right away. We have a good solution (hopefully) for this:

Have the button call the action of the feature on our website. When users click on it, we post a modal saying:

Hey firstname, the feature is under construction and will be available soon. In the meantime, you can send us an email and we will respond to your request. Thank you!

We are Meanwhile that this method would give us a good idea and research on the number of users actually wanting this feature. How many of them are potential adopters.


  1. Anyone with good ideas on this method, please answer or comment.
  2. A fake call to action buttons will create bad impressions. & # 39; coz the feature itself does not exist.
  3. All previous experiences with similar stories are invited.
  4. A better idea than this one?
  5. Additions or improvements to this method?
  6. Better reasons or arguments than what I have here to implement the method?

Everyone is welcome. Thank you! 🙂

sharepoint online – Call the Graphi API from classic JavaScript via msal.js

I'm trying to log in silently via msal.js and then try to call graph api but I still get 403 error. When I decrypt my access token via jwt.ms, I can see that the audience is correct but the staves show an error. I hope some people will help me.

My code

let config = {
    auth: {
      clientId: _spPageContextInfo.spfx3rdPartyServicePrincipalId,
      authority: `https://login.microsoftonline.com/${_spPageContextInfo.aadTenantId}`,
      redirectUri: 'https://xxx.sharepoint.com/sites/xxx-Dev/Pages/myportal.aspx',
      validateAuthority: false,
      postLogoutRedirectUri: window.origin,
    },
    cache: {
      cacheLocation: 'localStorage',
      storeAuthStateInCookie: true
    }
  }

  let myMSALObj = new Msal.UserAgentApplication(config)
  let graphConfig = {
    graphGroupEndpoint: "https://graph.microsoft.com/v1.0/groups"
  }

  let request = {
    scopes: ("https://graph.microsoft.com/.default")
  }


  myMSALObj.handleRedirectCallback(response => { console.log(response) });
  //const idTokenScope = { scopes: (_spPageContextInfo.spfx3rdPartyServicePrincipalId) }

  const handleError = (error) => {
    if (error.errorCode === 'consent_required'
      || error.errorCode === 'interaction_required'
      || error.errorCode === 'login_required') {
      //myMSALObj.loginRedirect(idTokenScope);
      myMSALObj.loginRedirect(request);
      return;
    }
    throw error;
  };

  const getToken = () => {
    const date = new Date();
    const user = myMSALObj.getAccount();
    if (!user) {
      //myMSALObj.loginRedirect(idTokenScope);
      myMSALObj.loginRedirect(request);
      return;
    }
    //myMSALObj.acquireTokenSilent(idTokenScope).then(response => {
    myMSALObj.acquireTokenSilent(request).then(response => {
      console.log(`${date.toLocaleTimeString()}`, response.accessToken);
      callMSGraph(graphConfig.graphGroupEndpoint, response.accessToken, graphAPICallback)
    }).catch(handleError);
  }
  getToken()

  function callMSGraph(theUrl, accessToken, callback) {
    var xmlHttp = new XMLHttpRequest()
    xmlHttp.onreadystatechange = function () {
      if (this.readyState == 4 && this.status == 200)
        callback(JSON.parse(this.responseText))
    }
    xmlHttp.open("GET", theUrl, true)
    xmlHttp.setRequestHeader('Authorization', 'Bearer ' + accessToken)
    xmlHttp.send()
  }
  function graphAPICallback(data) {
    document.write(JSON.stringify(data, null, 2))
  }

My decoded token
enter the description of the image here

The permission of my application
enter the description of the image here

rest – You call a SOAP endpoint in a browser using the angular / responsive http API libraries?

I want to call SOAP endpoints in a browser using Angular / React libraries.

It looks like it's possible to do it like in the example below. If you have done this, please list the problems you have encountered. In addition, hints if I should take another approach to communicating with SOAP endpoints.

javascript – function call “

I am currently studying WebComponents, Polymer, LitElement, etc., and I discovered this feature of creating models with LitElement that I had never seen before:

html`
Teste
`

The same goes for CSS:

css`div {color: blue}`

The code can be checked here and the result here.

In trying to better understand how this statement works, I went into the source code and discovered that it was only a function. different:

/**
 * Interprets a template literal as an HTML template that can efficiently
 * render to and update a container.
 */
export const html = (strings: TemplateStringsArray, ...values: unknown()) =>
  new TemplateResult(strings, values, 'html', defaultTemplateProcessor);

I have therefore tried to implement something like this to understand how it works:

html = (t, i) => {
  console.log(t, i);
  console.log(typeof t, typeof i);
}

html('teste');

html`teste`;

In the console appears:

enter the description of the image here

Which made me understand even less this statement:

``

Where I pass a string and in fact I get an object that looks like a painting … after all, what is this statement about? And how to access the second variable of the function? What are the real benefits and when should I use this type of statement? Does this have anything to do with String.raw ()?

Call a reference on another page

Guys, I have a basic menu that is linked to the bank and shows a room, I want to get the subject id that is shown in the menu to be able to create the interior of the room of forum, but when I use $ _get (id), never come back and I can not shoot at the subject view.

Extract code that generates the table to display rooms

  //preparando a tabela
                echo ''; 

                while($row = mysqli_fetch_assoc($result))
                {               
                    echo '';
                        echo '';
                        echo '';
                    echo '';
                }

I want to pull it here, to be able to run select & # 39; s, cross people who have already commented on this article and then post the messages:


sharepoint online – Call the custom javascript code on the save button of the new form

Battery Exchange Network

The Stack Exchange network includes 175 question-and-answer communities, including Stack Overflow, the largest and most reliable online community on which developers can learn, share knowledge and build their careers.

Visit Stack Exchange

Proxy Sites Proxy Tunnels Proxy List Working Proxy Sites Hotproxysite Proxy Sites Proxy Sites Anonymous Proxy Anonymous Proxies Top-Proxies.co.uk http://www.proxysitesnow.com Proxy Servers Free Proxies Free Proxy List Proxy List Zoxy Proxy List PR liste all proxy sites More Proxies netgofree netgofree Hide-MyIp - The Best Proxy List American Proxy List www.proxylisty.com/proxylist Web Proxy Submit Proxies Updated Proxy List Updated Proxy List aproxy.org Bypass Proxy Sites Free Proxies List Evolving Critic Business Web Directory Free Proxy List iShortIt MyProxyList Online Proxies Go Proxies Need Proxies PrivateProxies Proxies4MySchool Proxies4Work Free Proxy List Free Proxy Sites ProxyInside Wiksa Proxy ProxyLister.org Free Proxy List ProxyNoid Proxy List Free Proxy List Proxy Sites Proxy TopList ProxyVille UK Proxy WebProxy List RatedProxy.com - Listing the best Web Proxies Free Proxy List SchoolProxiesList Stay Anonymous Proxy List The Power Of Ninja Proxy List UNubstruct Free proxy sites Free proxy sites
Tópico Criado em
'; echo '

' . $row('topic_subject') . '

'; echo '

'; echo date('d-m-Y', strtotime($row('topic_date'))); echo '