Eloquent Update Class Object - eloquent

I have following eloquent statement which works.
GroupRequest::where([['iduser', 1],['idgroups', $request->input('idgroup')]])->update(['request_active' => 0]);
But I need it in a different way. I tried this but it doesn't work.
$groups_request = new GroupRequest();
$groups_request->idgroups::where([['iduser',1],['idgroups',$request->input('idgroup')]]);
$groups_request->update(['request_active' => 0]);
What's wrong with my below code?
Thanks

Wrong code is $groups_request->idgroups::where . Corrected code is
$groups_request = new GroupRequest();
$groups_request->where([
['iduser',1],
['idgroups',$request->input('idgroup')]
])->update(['request_active' => 0]);

Related

Dart convert dynamic to set

I currently have data like this:
_classes = _items.map((e) => e.ClassID).toSet();
print(_classes);
{One, Two} // output
and I am trying to achieve data look like this:
{'One', 'Two'}
But I can't solve it. Any suggestions why is that?
I already got it after hours of trying and trying different codes.
Set<String> _classes;
_classes = _items.map((e) => e.ClassID.toString()).toSet();
The .toString() part is the one that I am looking for.

why difference function does not work (openSCAD)?

I try to learn how to use openSCAD. I 'm reading (also watching) a lot of tutorials but I cannot get why the following code does not work. Could you please help me?
difference() {
polygon(
points=[[2,0],[1.6,2.6],[2.2,3.4],[5.6,4],[11.4,3.4],[11.4,0.6],[10,-1.6],[7.6,-2.4],[4.4,-1.8]]);
polygon(// right len holder in
points=[[2.4,0],[2,2.6],[2.5,3.1],[5.6,3.6],[11,3],[11,0.6],[9.8,-1.2],[7.6,-2],[4.4,-1.45]]);}
your top level object is a 2D-object, use linear_extrude to get 3D-objects:
h = 10;
difference() {
linear_extrude(height=h) polygon(
points=[[2,0],[1.6,2.6],[2.2,3.4],[5.6,4],[11.4,3.4],[11.4,0.6],[10,-1.6],[7.6,-2.4],[4.4,-1.8]]);
linear_extrude(height=h) polygon(// right len holder in
points=[[2.4,0],[2,2.6],[2.5,3.1],[5.6,3.6],[11,3],[11,0.6],[9.8,-1.2],[7.6,-2],[4.4,-1.45]]);
}

Zend_Db magic method specific cell selection

Currently I'm working on a couple of model related improvements and looking into a specific query I've wrote.
$queryGetPages = $this->fetchAll($this->select()
->where('page_active = ?', (int) $active)
->order('page_rank ASC'));
if($queryGetPages) {
$queryGetPages = $queryGetPages->toArray();
foreach($queryGetPages as $key => $value) {
$queryGetPagePrint = $this->find($value['pageid'])
->current()
->findModule_Model_ModulePagesPrintsViaModule_Model_ModulePagesFuses(
$this->select()
->from('module_pages_prints', array('print_title'))
->where('fuse_locale = ?', $this->_toolbox['editor']['translation']) )
}
}
The problem is in the magic method which is requesting data from a related table. I only need the 'title' cell per row, but for some reason it wont let me. Even with this query, it returns all cells from the row. I'm doing something wrong, but have no idea what!
If someone can point me to the right direction, I would be very thankfull.
Best regards !
The function that is implicitly called in your case is findManyToManyRowset() (code available in Zend/Db/Table/Row/Abstract.php, lines 1001-1108 (as of ZF 1.12.1). Have a look at lines 1070-1072:
$select->from(array('i' => $interName), array(), $interSchema)
->joinInner(array('m' => $matchName), $joinCond, Zend_Db_Select::SQL_WILDCARD, $matchSchema)
->setIntegrityCheck(false);
In short: the function that is called will overwrite your from() call and select all rows from the dependent table (module_pages_fuses). This is the way it's designed to work.
Instead, I would recommend writing the query you actually need the "dumb" way, e.g.
$queryGetPagePrint = $this->select()
->from(array('p' => 'module_pages_prints'), array('print_title'))
->join(array('f' => 'module_pages_fuses'),'p.pageid = f.pageid',array())
->where('f.fuse_locale = ?', $this->_toolbox['editor']['translation'])
->where('p.pageid = ?', $value['pageid']);

How do I detect field changes in EF?

In EF4, I want to know if some fields has been changed. How can I do that?
var propertyFooIsModified =
Context.ObjectStateManager.GetObjectStateEntry(someEntity)
.GetModifiedProperties.Any(p => p == "Foo");

Sync Services Ado.net SyncSchema

I'm trying to build a custom ServerSyncProvider
right now. I'm trying to understand the GetScema Method.
I'm trying to build a dataSet and associate it to SyncSchema class
one of my table columns is a nvarchar(50).
Here is what I'm doing this:
DataColumn column = new DataColumn();
column.ColumnName = "Name";
column.DataType = typeof(String);
column.MaxLength = 55;
table.Columns.Add(column);
But it turns out that on my client side, this column becomes nvarchar(1)
any idea?
Thanks a lot for helping me.
Use this code:
column.ExtendedProperties.Add("ColumnLength", 50);